That is true, arrays are not constructed by loadClass() calls.
Class.forName() does
it, but has this ugly and uneblievably stupid in-VM cache.
Maybe a solution would be to have a surrogate method that does array
construction but does not rely
on Class.forName, like this
not at all tested, rapidly hacked and not checked for performance piece of
code
package org.jboss.util;
public class Clazz {
public static Class forName(String bla) throws WhateverException {
if(bla.endsWith("[];")) {
Class
componentClass=forName(bla.substring(0,bla.length()-3));
return
java.lang.reflect.Array.newInstance(componentClass,0).getClass();
} else {
return
Thread.currentThread().getContextClassLoader().loadClass(bla);
}
}
CGJ
-----Urspr�ngliche Nachricht-----
Von: marc fleury [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 3. Mai 2002 05:00
An: Hiram Chirino; [EMAIL PROTECTED]
Betreff: RE: [JBoss-dev] getContextClassLoader() vs. Class.forName(x,y,z)
makes no sense to me, ask for clarification and example
marcf
|-----Original Message-----
|From: [EMAIL PROTECTED]
|[mailto:[EMAIL PROTECTED]]On Behalf Of
|Hiram Chirino
|Sent: Thursday, May 02, 2002 7:30 PM
|To: [EMAIL PROTECTED]
|Subject: [JBoss-dev] getContextClassLoader() vs. Class.forName(x,y,z)
|
|
|Question for you classloading feaks out there, what is the difference
|between:
|
|x = "some.class.name";
|Thread.currentThread().getContextClassLoader().loadClass(x);
|
|and
|
|x = "some.class.name";
|Class.forName(x, false,
| Thread.currentThread().getContextClassLoader());
|
|Peter Levart, submitted a patch that replaces a statment like the
|first with
|a statment like the seconds. It's supposed to allow "loading
|array class for a base class that hasn't been loaded yet."
|
|My thing is, it seems like they do the same thing. What's the
|difference?
|
|Regards,
|Hiram
|
|_________________________________________________________________
|Chat with friends online, try MSN Messenger: http://messenger.msn.com
|
|
|_______________________________________________________________
|
|Have big pipes? SourceForge.net is looking for download mirrors. We
|supply the hardware. You get the recognition. Email Us:
|[EMAIL PROTECTED]
|_______________________________________________
|Jboss-development mailing list
|[EMAIL PROTECTED]
|https://lists.sourceforge.net/lists/listinfo/jboss-development
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Jboss-development mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development