commons-dev mailing list archives

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


On Sun, 24 Nov 2002, Max Rydahl Andersen wrote:

> To have correct classloading semantics the class that is used to load
> classes dynamically (e.g. RequestUtils) needs to have been loaded by the
> same classloader as the caller of the function ......that actually means it
> cannot be generalized to be a general function in a general library that is
> just loaded by some "global" or "third-party" classloader...

Ouch. I'm writing a letter to my nearest Java senator.

> This should not
> stop one from using the proposed load semantics, it should just be
> documented that that is the case (no one newer said that java classloading
> should be easy :)

So the fix would be that in the class-loading aspects of Lang, we would
use the code James Strachan points out, but if an exception is thrown as
Juozas points out, we would catch it and run the tried and tested forName?

And in some cases the code would never work, ie) in container where
another classloader had the gall to load us first.

So I can understand... do you mean that if Commons Lang becomes used in
Tomcat, and Tomcat loads a webapp, would that webapp not be able to use this
code?

Because first it would throw the class cast, and then forName would fail?

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