This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Sun's java vs. gij : Own classloader and static attributes
- From: Tom Tromey <tromey at redhat dot com>
- To: prelle at tzi dot de
- Cc: java at gcc dot gnu dot org
- Date: 22 Jun 2004 12:44:27 -0600
- Subject: Re: Sun's java vs. gij : Own classloader and static attributes
- References: <1087920139.6329.27.camel@Menacor.Sphaerentor.DE>
- Reply-to: tromey at redhat dot com
>>>>> "Stefan" == Stefan Prelle <prelle@informatik.uni-bremen.de> writes:
Stefan> [ Sun's java ]
Stefan> In Loaded: Value is 0
Hmm, I don't see this with 1.4.2:
fleche. /usr/java/j2sdk1.4.2/bin/java Test
Value is 5
In Loaded: Value is 5
In Loaded: Classloader is sun.misc.Launcher$AppClassLoader@136228
... nor would I expect to.
I would expect the base `MyStatic' to be found by `MyClassLoader' due
to class loader delegation.
Oh, I just saw the bit about changing the name from loadClass to
findClass. This is interesting, perhaps we aren't supposed to have
loadClass(String) call loadClass(String,boolean). Perhaps for legacy
applications we should instead do calls in the other order, and put
the logic in loadClass(String). That would let us duplicate Sun's
behavior here. The docs are a bit vague about this.
Meanwhile, you aren't supposed to override ClassLoader.loadClass.
Instead, as you discovered, you are supposed to override findClass.
Tom