Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6553734
Votes 3
Synopsis package-info class compiled on JDK 6 target 1.5 cannot be loaded by JDK 5
Category hotspot:runtime_system
Reported Against 5.0
Release Fixed
State 11-Closed, Not Reproducible, bug
Priority: 3-Medium
Related Bugs 6313196 , 6351740 , 6557865 , 6581929 , 6232928
Submit Date 04-MAY-2007
Description
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.
Posted Date : 2007-05-04 12:41:40.0
Work Around
Compile with JDK 5
Evaluation
This is an accomodation for a compiler bug.  It is possible that there are people out there that are using an non-updated JDK6 which will generate code that JDK5 runtime won't recognize.
Posted Date : 2007-06-27 02:00:00.0
Comments
  
  Include a link with my name & email   

Submitted On 29-JUN-2007
I'm not sure what "non-updated JDK6" means, but this bug is present when compiling with JDK6u1 (build 1.6.0_01-b06) - which is the latest one listed - and running on JDK5u12 (build 1.5.0_12-b04) - which is also the latest one listed.


Submitted On 30-NOV-2007
This bug is still present with classes compiled with JDK6u3 running under JDK5u14.


Submitted On 21-DEC-2007
4894437
I developed a fix for this at https://fix1600.dev.java.net/


Submitted On 24-DEC-2007
The maven fix at https://fix1600.dev.java.net/ is awesome, great workaround!  Thanks!


Submitted On 07-FEB-2008
hego
Can someone put "fix1600" back on server "http://download.java.net/maven/2/org/jvnet/" ?
The server was down earlier this week, and now seems to be running on a Nov2007-backup that is missing "fix1600".


Submitted On 07-NOV-2008
ajs123
It seems this is fixed in some update release, don't know in which one, but seems to work at least in u10, and probably in u7 too.



PLEASE NOTE: JDK6 is formerly known as Project Mustang