A dynamically create Jar -File contains the same class twice (fully qualified class name is identical). This is allowed by the zip format and the error causing zip file is the result of a merge process of different jar files.
The runtime does not have a problem, but the compiler fails -> this seems to be a bug.
Test Case:
Class A and Class B uses Class A
jar File x.jar containing twice Class A (in different size)
javac -cp x.jar B.java
[build] An exception has occurred in the compiler (1.4.2_05). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
[build] java.lang.ArrayIndexOutOfBoundsException: 1932486510
[build] at com.sun.tools.javac.v8.code.ClassReader.nextInt(ClassReader.java:335)
[build] at com.sun.tools.javac.v8.code.ClassReader.skipMember(ClassReader.java:820)
[build] at com.sun.tools.javac.v8.code.ClassReader.readClass(ClassReader.java:861)
[build] at com.sun.tools.javac.v8.code.ClassReader.readClassFile(ClassReader.java:936)
[build] at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1091)
[build] at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1049)
[build] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:372)
[build] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:691)
[build] at com.sun.tools.javac.v8.code.ClassReader.loadClass(ClassReader.java:1130)
[build] at com.sun.tools.javac.v8.comp.Resolve.loadClass(Resolve.java:471)
[build] at com.sun.tools.javac.v8.comp.Resolve.findIdentInPackage(Resolve.java:644)
[build] at com.sun.tools.javac.v8.comp.Attr.selectSym(Attr.java:1127)
[build] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1076)
[build] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:1091)
[build] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:198)
[build] at com.sun.tools.javac.v8.comp.Attr.attribType(Attr.java:228)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitImport(Enter.java:763)
[build] at com.sun.tools.javac.v8.tree.Tree$Import.accept(Tree.java:407)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:715)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:727)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitTopLevel(Enter.java:746)
[build] at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:390)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:715)
[build] at com.sun.tools.javac.v8.comp.Enter$CompleteEnter.complete(Enter.java:848)
[build] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:372)
[build] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:691)
[build] at com.sun.tools.javac.v8.comp.Enter.complete(Enter.java:601)
[build] at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:582)
[build] at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:331)
[build] at com.sun.tools.javac.v8.Main.compile(Main.java:569)
[build] at com.sun.tools.javac.Main.compile(Main.java:36)
This occurs because the developer has merged a.jar with b.jar both are containing the class a.b.AB
After the merge the ab.jar will contain twice the class a.b.AB.
The merge is done with Ant's zip functions, *not* with jar.
###@###.### 2005-2-24 14:52:45 GMT
The runtime does not have a problem, but the compiler fails -> this seems to be a bug.
Test Case:
Class A and Class B uses Class A
jar File x.jar containing twice Class A (in different size)
javac -cp x.jar B.java
[build] An exception has occurred in the compiler (1.4.2_05). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
[build] java.lang.ArrayIndexOutOfBoundsException: 1932486510
[build] at com.sun.tools.javac.v8.code.ClassReader.nextInt(ClassReader.java:335)
[build] at com.sun.tools.javac.v8.code.ClassReader.skipMember(ClassReader.java:820)
[build] at com.sun.tools.javac.v8.code.ClassReader.readClass(ClassReader.java:861)
[build] at com.sun.tools.javac.v8.code.ClassReader.readClassFile(ClassReader.java:936)
[build] at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1091)
[build] at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1049)
[build] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:372)
[build] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:691)
[build] at com.sun.tools.javac.v8.code.ClassReader.loadClass(ClassReader.java:1130)
[build] at com.sun.tools.javac.v8.comp.Resolve.loadClass(Resolve.java:471)
[build] at com.sun.tools.javac.v8.comp.Resolve.findIdentInPackage(Resolve.java:644)
[build] at com.sun.tools.javac.v8.comp.Attr.selectSym(Attr.java:1127)
[build] at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1076)
[build] at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:1091)
[build] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:198)
[build] at com.sun.tools.javac.v8.comp.Attr.attribType(Attr.java:228)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitImport(Enter.java:763)
[build] at com.sun.tools.javac.v8.tree.Tree$Import.accept(Tree.java:407)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:715)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:727)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitTopLevel(Enter.java:746)
[build] at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:390)
[build] at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:715)
[build] at com.sun.tools.javac.v8.comp.Enter$CompleteEnter.complete(Enter.java:848)
[build] at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:372)
[build] at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:691)
[build] at com.sun.tools.javac.v8.comp.Enter.complete(Enter.java:601)
[build] at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:582)
[build] at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:331)
[build] at com.sun.tools.javac.v8.Main.compile(Main.java:569)
[build] at com.sun.tools.javac.Main.compile(Main.java:36)
This occurs because the developer has merged a.jar with b.jar both are containing the class a.b.AB
After the merge the ab.jar will contain twice the class a.b.AB.
The merge is done with Ant's zip functions, *not* with jar.
###@###.### 2005-2-24 14:52:45 GMT
- relates to
-
JDK-6225605 Speed up indexing of Jar files and reduce compile time by 10%
- Resolved
-
JDK-4376065 ArrayIndexOutOfBoundsException in ClassReader.readPool
- Closed