commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Re: [lang] enhanced version of Class.forName
Date Tue, 06 Sep 2005 14:11:42 GMT
On 9/6/05, James Carman <james@carmanconsulting.com> wrote:
> Okay, I caved (or compromised)! :-)  I re-wrote the method to use your
> little trick of loading the array version of the class and taking the
> component type.  The only problem I have with this is that I'm passing the
> "initialize" parameter in when I call forName() for the array version.  I
> guess it doesn't really hurt to initialize the array version, but does that
> cause the component class to get initialized?  Of course, this only happens
> for primitives, so it's probably not a big issue, since the primitive
> classes will most likely be loaded by the bootstrap classloader.  I'm
> attaching the code as a patch for others to review.

Since all we're doing is creating the "[I" / "[L..." version and pass
it to the classloader, we would get the same effect as by using the
bytecode version directly. Isn't that desired ?
 
> I still have the problem that my code uses a regex to check the validity of
> the class name that's passed in.  Darn backward compatibility!

Why don't you merge our versions ? I think my stringtokenizer usage is
reasonably well behaved and its 1.2 compatible. It should not be too
difficult to adapt it so that the bytecode specifications
("[I"/"L...;") can also be parsed.

Tom

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


Mime
View raw message