Sun's java vs. gij : Own classloader and static attributes

Bryce McKinlay mckinlay@redhat.com
Tue Jun 22 16:17:00 GMT 2004


Stefan Prelle wrote:

>---Using Sun's java----------------------
>Value is 5
>MyClassLoader.loadClass(Loaded)
>MyClassLoader.loadClass(java.lang.Object)
>MyClassLoader.loadClass(java.lang.System)
>MyClassLoader.loadClass(java.lang.StringBuffer)
>MyClassLoader.loadClass(MyStatic)
>MyClassLoader.loadClass(java.io.PrintStream)
>In Loaded: Value is 0
>MyClassLoader.loadClass(java.lang.Class)
>
>---Using GNU gij--------------------------
>Value is 5
>MyClassLoader.loadClass(Loaded)
>In Loaded: Value is 5
>
>
>I figured that I still don't use my ClassLoader subclass the correct
>way, since it should only load that classes that haven't been loaded so
>far and I think I better overwrite the findClass-Method. 
>But anyway: Is the different behaviour of gij considered a bug or
>feature?
>  
>

It looks like a bug to me. The Sun implementation appears to be defining 
a new instance of MyStatic.class in a different classloader context, 
while the libgcj implementation is not. It would be good to add this 
testcase to mauve.

Regards

Bryce



More information about the Java mailing list