commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject [lang] reflect - Class.forName
Date Sun, 24 Nov 2002 02:17:31 GMT

I've not really been paying attention to the reflect stuff, and had missed
a question about it in a blog I usually read:

http://radio.weblogs.com/0112098/2002/09/24.html#a114

Rather than using:

Class theClass = Class.forName( className );

in reflect.ReflectionUtils, James suggests we should use:

****
Class theClass = null;

try {
 theClass = Thread.currentThread().getContextClassLoader().loadClass(
className );
} catch (ClassNotFoundException e) {
 theClass = getClass().getClassLoader().loadClass( className );
}
****

as "Class.forName is evil".

Any views on this??

Hen


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message