This content has been marked as final.
Show 8 replies
-
1. Re: JBMICROCONT-224
adrian.brock Jan 11, 2008 9:41 AM (in response to alesj)I'd just change all the uses of the classloader.loadClass() to be Class.forName()
Actually resolve=false is the equalivent of ClassLoader.loadClass()
e.g.private TypeInfo resolveComplexTypeInfo(ClassLoader cl, String name) throws ClassNotFoundException { if (cl == null) cl = Thread.currentThread().getContextClassLoader(); - Class clazz = cl.loadClass(name); + Class<?> clazz = Class.forName(name, false, cl); return getTypeInfo(clazz); }
-
2. Re: JBMICROCONT-224
alesj Jan 11, 2008 10:10 AM (in response to alesj)"adrian@jboss.org" wrote:
I'd just change all the uses of the classloader.loadClass() to be Class.forName()
Actually resolve=false is the equivalent of ClassLoader.loadClass()
Initialize, not resolve. :-)public static Class<?> forName(String name, boolean initialize, ClassLoader loader) throws ClassNotFoundException
But in our case, as the JIRA (http://jira.jboss.com/jira/browse/JBMICROCONT-224) suggest (as you suggest :-)), initialize=true must be used.
Which still calls for a new method. :-) -
3. Re: JBMICROCONT-224
adrian.brock Jan 11, 2008 10:36 AM (in response to alesj)"alesj" wrote:
"adrian@jboss.org" wrote:
I'd just change all the uses of the classloader.loadClass() to be Class.forName()
Actually resolve=false is the equivalent of ClassLoader.loadClass()
Initialize, not resolve. :-)
It's resolve. It means do you resolveClass() when you load the class. ;-)"alesj" wrote:
public static Class<?> forName(String name, boolean initialize, ClassLoader loader) throws ClassNotFoundException
But in our case, as the JIRA (http://jira.jboss.com/jira/browse/JBMICROCONT-224) suggest (as you suggest :-)), initialize=true must be used.
Which still calls for a new method. :-)
No. The parameter is false when you invoke loadClass() on the ClassLoader,
see the javadoc. -
4. Re: JBMICROCONT-224
alesj Jan 11, 2008 11:02 AM (in response to alesj)"adrian@jboss.org" wrote:
It's resolve. It means do you resolveClass() when you load the class. ;-)
OK, I see what you mean now. :-)
But I don't understand what has this got to do with Class.forName(name, true, classloader); -
5. Re: JBMICROCONT-224
adrian.brock Jan 11, 2008 11:08 AM (in response to alesj)"alesj" wrote:
"adrian@jboss.org" wrote:
It's resolve. It means do you resolveClass() when you load the class. ;-)
OK, I see what you mean now. :-)
But I don't understand what has this got to do with Class.forName(name, true, classloader);
? I've said it twice above.
The second parameter in Class.forName() is the same as resolve.
ClassLoader.loadClass() is the same as Class.forName(name, false, classLoader)
except it also loads array classes in JDK7+, they both did before.
initialize or resolve=true is a red herring. I just wrote true "at random" on the bug report
because the parameter needs a value. -
6. Re: JBMICROCONT-224
alesj Jan 11, 2008 11:20 AM (in response to alesj)"adrian@jboss.org" wrote:
The second parameter in Class.forName() is the same as resolve.
ClassLoader.loadClass() is the same as Class.forName(name, false, classLoader)
except it also loads array classes in JDK7+, they both did before.
OK, that's what I thought.
Got confused somewhere along the way with that red herring true. ;-)
JDK7? Or 6, right?"adrian@jboss.org" wrote:
is a red herring.
http://en.wikipedia.org/wiki/Red_herring :-) -
7. Re: JBMICROCONT-224
adrian.brock Jan 11, 2008 11:54 AM (in response to alesj)"alesj" wrote:
JDK7? Or 6, right?
Yes JDK6 is when it was changed in the Sun JDK. -
8. Re: JBMICROCONT-224
alesj Jan 11, 2008 4:37 PM (in response to alesj)"adrian@jboss.org" wrote:
I'd just change all the uses of the classloader.loadClass() to be Class.forName()
Even in the classloader module?
- BaseClassLoaderDomain
- ClassLoaderToLoaderAdapter