-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
hopper
-
generic
-
solaris_8
Subject: New, serious generics problem.
Date: Mon, 28 Jan 2002 17:18:05 -0800
From: Neal M Gafter <###@###.###>
To: ###@###.###
I ran into the strangest problem in a completely trivial piece of code.
Here's the test program to reproduce the problem:
import java.util.Collections;
class Test2 {
public static void main(String[] args) {
}
}
Compile this with -gj and with the generic stubs on the bootclasspath.
You'll get a very strange completion failure. Obviously the array in
memory holding the class file has been overwritten.
I tracked the problem down to a class being loaded WHILE another class
is already in the process of being loaded. I added a simple assertion
in ClassReader to catch this occurrence, and enclosed is the resulting
stack trace.
At (*1) the compiler is loading java.util.Collections. In the process,
the compiler needs to make a compound type (*2) which requires flags
that force the loading (*3) of another class, in this case java.lang.Object.
frog:~/gjc-work/generics.ref $ newjavac -gj Test2.java
An exception has occurred in the compiler (1.4.0-rc). 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.
java.lang.AssertionError
at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1160)
*3 at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1136)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:302)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:606)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.flags(Symbol.java:506)
*2 at com.sun.tools.javac.v8.code.Type$ClassType.makeCompoundType(Type.java:554)
at com.sun.tools.javac.v8.code.Type$TypeVar.setBounds(Type.java:1226)
at com.sun.tools.javac.v8.code.ClassReader.sigToTypeParam(ClassReader.java:745)
at com.sun.tools.javac.v8.code.ClassReader.sigToTypeParams(ClassReader.java:720)
at com.sun.tools.javac.v8.code.ClassReader.sigToType(ClassReader.java:641)
at com.sun.tools.javac.v8.code.ClassReader.sigToType(ClassReader.java:573)
at com.sun.tools.javac.v8.code.ClassReader.readType(ClassReader.java:510)
at com.sun.tools.javac.v8.code.ClassReader.readMemberAttr(ClassReader.java:795)
at com.sun.tools.javac.v8.code.ClassReader.readMemberAttrs(ClassReader.java:812)
at com.sun.tools.javac.v8.code.ClassReader.readMethod(ClassReader.java:883)
at com.sun.tools.javac.v8.code.ClassReader.readClass(ClassReader.java:964)
at com.sun.tools.javac.v8.code.ClassReader.readClassFile(ClassReader.java:1022)
*1 at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1175)
at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1136)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:302)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:606)
at com.sun.tools.javac.v8.code.ClassReader.loadClass(ClassReader.java:1202)
at com.sun.tools.javac.v8.comp.Resolve.loadClass(Resolve.java:557)
at com.sun.tools.javac.v8.comp.Resolve.findIdentInPackage(Resolve.java:727)
at com.sun.tools.javac.v8.comp.Attr.selectSym(Attr.java:1540)
at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1472)
at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:906)
at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:287)
at com.sun.tools.javac.v8.comp.Attr.attribType(Attr.java:315)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitImport(Enter.java:855)
at com.sun.tools.javac.v8.tree.Tree$Import.accept(Tree.java:360)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:790)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:802)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitTopLevel(Enter.java:829)
at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:347)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:790)
at com.sun.tools.javac.v8.comp.Enter$CompleteEnter.complete(Enter.java:954)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:302)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:606)
at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:651)
at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:632)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:317)
at com.sun.tools.javac.v8.Main.compile(Main.java:439)
at com.sun.tools.javac.Main.compile(Main.java:28)
at com.sun.tools.javac.Main.main(Main.java:19)
frog:~/gjc-work/generics.ref $
Date: Mon, 28 Jan 2002 17:18:05 -0800
From: Neal M Gafter <###@###.###>
To: ###@###.###
I ran into the strangest problem in a completely trivial piece of code.
Here's the test program to reproduce the problem:
import java.util.Collections;
class Test2 {
public static void main(String[] args) {
}
}
Compile this with -gj and with the generic stubs on the bootclasspath.
You'll get a very strange completion failure. Obviously the array in
memory holding the class file has been overwritten.
I tracked the problem down to a class being loaded WHILE another class
is already in the process of being loaded. I added a simple assertion
in ClassReader to catch this occurrence, and enclosed is the resulting
stack trace.
At (*1) the compiler is loading java.util.Collections. In the process,
the compiler needs to make a compound type (*2) which requires flags
that force the loading (*3) of another class, in this case java.lang.Object.
frog:~/gjc-work/generics.ref $ newjavac -gj Test2.java
An exception has occurred in the compiler (1.4.0-rc). 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.
java.lang.AssertionError
at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1160)
*3 at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1136)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:302)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:606)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.flags(Symbol.java:506)
*2 at com.sun.tools.javac.v8.code.Type$ClassType.makeCompoundType(Type.java:554)
at com.sun.tools.javac.v8.code.Type$TypeVar.setBounds(Type.java:1226)
at com.sun.tools.javac.v8.code.ClassReader.sigToTypeParam(ClassReader.java:745)
at com.sun.tools.javac.v8.code.ClassReader.sigToTypeParams(ClassReader.java:720)
at com.sun.tools.javac.v8.code.ClassReader.sigToType(ClassReader.java:641)
at com.sun.tools.javac.v8.code.ClassReader.sigToType(ClassReader.java:573)
at com.sun.tools.javac.v8.code.ClassReader.readType(ClassReader.java:510)
at com.sun.tools.javac.v8.code.ClassReader.readMemberAttr(ClassReader.java:795)
at com.sun.tools.javac.v8.code.ClassReader.readMemberAttrs(ClassReader.java:812)
at com.sun.tools.javac.v8.code.ClassReader.readMethod(ClassReader.java:883)
at com.sun.tools.javac.v8.code.ClassReader.readClass(ClassReader.java:964)
at com.sun.tools.javac.v8.code.ClassReader.readClassFile(ClassReader.java:1022)
*1 at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1175)
at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:1136)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:302)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:606)
at com.sun.tools.javac.v8.code.ClassReader.loadClass(ClassReader.java:1202)
at com.sun.tools.javac.v8.comp.Resolve.loadClass(Resolve.java:557)
at com.sun.tools.javac.v8.comp.Resolve.findIdentInPackage(Resolve.java:727)
at com.sun.tools.javac.v8.comp.Attr.selectSym(Attr.java:1540)
at com.sun.tools.javac.v8.comp.Attr.visitSelect(Attr.java:1472)
at com.sun.tools.javac.v8.tree.Tree$Select.accept(Tree.java:906)
at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:287)
at com.sun.tools.javac.v8.comp.Attr.attribType(Attr.java:315)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitImport(Enter.java:855)
at com.sun.tools.javac.v8.tree.Tree$Import.accept(Tree.java:360)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:790)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:802)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.visitTopLevel(Enter.java:829)
at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:347)
at com.sun.tools.javac.v8.comp.Enter$MemberEnter.memberEnter(Enter.java:790)
at com.sun.tools.javac.v8.comp.Enter$CompleteEnter.complete(Enter.java:954)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:302)
at com.sun.tools.javac.v8.code.Symbol$ClassSymbol.complete(Symbol.java:606)
at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:651)
at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:632)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:317)
at com.sun.tools.javac.v8.Main.compile(Main.java:439)
at com.sun.tools.javac.Main.compile(Main.java:28)
at com.sun.tools.javac.Main.main(Main.java:19)
frog:~/gjc-work/generics.ref $