Review request for 6516909: (cl spec) ClassLoader.loadClass() clarification to indicate it shouldn't be used for array classes

Mandy Chung mandy.chung at oracle.com
Mon Jan 13 23:02:39 UTC 2014


Webrev:
http://cr.openjdk.java.net/~mchung/jdk9/webrevs/6516909/webrev.00/

This patch is to fix:

6516909: (cl spec) ClassLoader.loadClass() clarification to indicate it 
shouldn't be used for array classes
4932272: (cl) Remove declaration of the unused private method 
ClassLoader.defineClass0

In JDK 5, parameter checking of ClassLoader.loadClass and other methods 
was modified to validate if the given class name is a binary name.  
ClassLoader.loadClass cannot be used to load an array class; instead it 
should use Class.forName.   This patch adds a sentence in the "Binary 
Name" section in the ClassLoader class description to clarify that.

This patch also removes the "sun.lang.ClassLoader.allowArraySyntax" 
system property that was added in JDK 5 to allow existing code to 
workaround the incompatibility issue.  It was disabled by default in JDK 
6.  It's over 7 years and it's time to remove it.  Also remove the 
unused private ClassLoader.defineClass0.

Mandy

[1] http://www.oracle.com/technetwork/java/javase/compatibility-137462.html



More information about the core-libs-dev mailing list