findLoadedClass
    Godmar Back 
    gback at cs.utah.edu
       
    Thu Sep 17 10:05:12 PDT 1998
    
    
  
> 
> 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