harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@realityforge.org>
Subject Re: Class Library Modularity [Was Re: State of the World]
Date Thu, 12 May 2005 01:24:42 GMT
Richard S. Hall wrote:
> Well, I can think of one thing I would like, some way for the packages 
> contained in a JAR file be able to inform the underlying runtime not 
> only its external dependencies, but also what it provides (or what it 
> exposes). Due to limitations in the Java visibility/protection rules, 
> sometimes it is not possible to avoid making implementation API public 
> because you are forced to declare classes/methods as public if you need 
> to use them from more than one package.

What you are asking for here is new language extensions - effectively an 
"assembly" or "jar" access specifier to go along with private, 
protected, public and package access. This would be very useful - 
particularly if different jars/assemblies were of higher importance in 
runtime. However it is not part of the Java standard and thus I suspect 
that best way to achieve this goal is go through the jcp process.

You *could* implement this in Suns java by writing a custom ClassLoader 
and using Annotations but ... unless it is part of a standard somewhere 
it is unlikely to get broad adoption.

> Of course, you could just put everything in the same package and use 
> package protection, but that also defeats the purpose of trying to 
> structure things into modules. So, for a module to be able to say that I 
> export package "foo", but not "foo.FooImpl" would be very useful from my 
> perspective. Then other packages inside the JAR are privy to 
> implementation APIs, where packages outside the JAR are not.

You can implement this in suns java. Just write your own ClassLoader to 
"hide" specified classes, set the ClassLoader as the bootstrap 
classloader and it is done.

> I also have lots of interesting ideas about dynamic deployment/updates 
> too, but I am sure that these things would be extension to the platform 
> as opposed to implementing a conforming J2SE platform. :-)

Fun parts ;)

I would love get my hands on the platform to implement Isolate and 
Resource Managers as in Suns MVM (research JVM) as that would make 
writing scalable applications in java so much easier.



Mime
View raw message