loadClass(String) vs loadClass(String, bool)

Andrew Haley aph@redhat.com
Sat Apr 16 11:05:00 GMT 2005


Calling loadClass(String) is different from calling loadClass(String, false) 
because some class loaders override one method but not the other.
I'm looking here at org.eclipse.help.internal.appserver.PluginClassLoaderWrapper:
	public Class loadClass(String className) throws ClassNotFoundException {
		return pluginLoader.loadClass(className);
	}
So, invoking PluginClassLoaderWrapper.loadClass(String) will work, but
if you invoke PluginClassLoaderWrapper.loadClass(String, bool) that
won't work because it isn't overridden.
This is an old version of PluginClassLoaderWrapper so this might now
have been fixed -- it's just an example. But it does mean that in
some applications we have to be very careful about what we call within
libgcj. It looks to me like loadClass(String) is always to be
preferred.
I suppose this is really an example of a bad inheritance design. Sigh...
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /