Hi Konstantin,

> -----Original Message-----
> From: Konstantin Kolinko [mailto:knst.koli...@gmail.com]
> Sent: Friday, May 10, 2013 11:46 PM
> 
> Yes, the same.
> 
> BTW, Oracle JDKs come with source code for their public classes, On
> Windows that is %JAVA_HOME%/src.zip. Do you have such file?

Thank you for your answer. Yes, I have that file and I looked there, but that 
Class.forName(String) method calls a native method for which I couldn't find 
the source.

I asked this question because the above is not what is implemented by 
Sun/Oracles JRE (I tested with Windows 32-bit versions of JRE 1.7.0_21, Java 8 
EA (b88) and Java 5).

It seems that in Oracles Java, Class.forName(String) uses the ClassLoader of 
the class which implements the method that makes the call to Class.forName(), 
not the ClassLoader of the class on whose instance the method is called (which 
is the one used when calling getClass().getClassLoader()). This can make a 
difference e.g. if the Class with that method has a subclass and you call the 
method on an instance of the subclass (which is what I experienced with a 
Eclipse RCP app which uses a ClassLoader hierarchy for plugins).

However, since the bug exists in current Java 1.7.0_21 (from 2013) and even in 
Java 1.5.0 (2004), I wondered if nobody else noticed this discrepancy between 
the JavaDoc and the actual implementation or maybe if Sun/Oracle just doesn't 
fix such bugs. (I already submitted a bug report on December 1, 2012, but did 
not yet receive a response - so I wanted to make sure my understanding was 
correct).

Thanks!


Regards,
Konstantin Preißer 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to