| Other | Other |
|---|---|
| 5.0-poolResolved | 5.0u13Resolved |
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
A package-info class contains annotated package and annotation type. These classes are compiled using JDK 6 compiler with target 1.5. JDK 5 fails to load the generated package-info with the following error:
Exception in thread "main" java.lang.ClassFormatError: Illegal class modifiers in class pack/package-info: 0x1600
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at java.lang.Package.getPackageInfo(Package.java:350)
at java.lang.Package.getDeclaredAnnotations(Package.java:375)
at pack.Main.main(Main.java:26)
It seems that the problem is that the JDK 6 compiler target 1.5 adds "synthetic" and "abstract" attributes for the package-info classes that JDK 5 runtime doesn't understand.
Package-info, annotation type and Main class java source files are attached. As well as the output of the Jcoder tool for package-info classes compiled by different compilers.
Related information:
JVMS 3ed spec update: http://ccc.sfbay/6232928
CRs: 6313196, 6232928
If this is a compiler bug, please reassign it to the java/compiler category.
|