findLoadedClass
breed at almaden.ibm.com
breed at almaden.ibm.com
Thu Sep 17 12:43:22 PDT 1998
Sorry, I'm behind in my snap shot... I didn't realize you guys had fixed
it...
One thing with the code segment you sent. With Sun's JVM if loader.get()
returns null, a NullPointerException will be thrown when you try to do the
cast. Is it not the same with Kaffe?
ben
Godmar Back <gback at cs.utah.edu> on 09/17/98 10:05:12 AM
Please respond to kaffe at rufus.w3.org
To: kaffe at rufus.w3.org
cc:
Subject: Re: findLoadedClass
>
> ClassLoader.findLoadedClass() as implemented is wrong. (As noted in the
> code.) While the JDK 1.1 was silent as to what it did, the 1.2 doc is
> clear. Basically it should return a reference to the class if it is
loaded
> or null if not. I use it in my classloader in loadClass to check if the
> class is loaded before trying to define the class, but with the current
> implementation an infinitely recursive call results...
>
> Looking into the code there didn't seem to be a nice way using native
code
> to check for a class being loaded without causing creation of a class
entry
> for the class being looked for. (Boy my english suxs!) I would be glad
> fix it if somebody could suggest the best way of checking for a loaded
> class.
>
Hmmm, you say "as noted in the code"? Could you be more specific?
The implementation simply looks whether it's in the hashtable
of classes loaded by the classloader:
final protected Class findLoadedClass(String name) {
return ((Class)loader.get(name));
}
Can you described where the infinitely recursive call results?
- Godmar
More information about the kaffe
mailing list