Name: ddT132432 Date: 11/05/2001
java version "1.4.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta2-b77)
Java HotSpot(TM) Client VM (build 1.4.0-beta2-b77, mixed mode)
This bug is reported against JDK 1.4-beta2, but was present even in JDK 1.3.0.
JLS 8.1.3 specifically forbids an implementation of java.lang.Object from having
an extends clause. The Jikes compiler gracefully handles this, but javac
crashes with a NullPointerException:
$ cat java/lang/Object.java
package java.lang;
class C {}
public class Object extends C {}
$ jikes +D java/lang/Object.java
java/lang/Object.java:2:7:2:7: Error: The class "java/lang/C" is circularly
defined with its super type(s).
java/lang/Object.java:3:22:3:22: Error: The type java/lang/Object must not have
a super type.
$ javac java/lang/Object.java
An exception has occurred in the compiler (1.4.0-beta2). 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.NullPointerException
at com.sun.tools.javac.v8.comp.TransTypes._case(TransTypes.java:434)
at com.sun.tools.javac.v8.tree.Tree$Ident.visit(Tree.java:1083)
at
com.sun.tools.javac.v8.tree.TreeTranslator.translate(TreeTranslator.java:44)
at
com.sun.tools.javac.v8.tree.TreeTranslator._case(TreeTranslator.java:99)
at com.sun.tools.javac.v8.comp.TransTypes._case(TransTypes.java:184)
at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:435)
at com.sun.tools.javac.v8.comp.TransTypes.translate(TransTypes.java:162)
at
com.sun.tools.javac.v8.comp.TransTypes.translateTopLevelClass(TransTypes.java:48
5)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:398)
at com.sun.tools.javac.v8.Main.compile(Main.java:506)
at com.sun.tools.javac.Main.compile(Main.java:32)
at com.sun.tools.javac.Main.main(Main.java:23)
Likewise, although JLS 8.1.4 is missing this restriction, it would make sense
that an implementation of java.lang.Object must not have an implements clause.
However, in this case, the core dump of jikes is no better than the
StackOverflowError of javac:
$ cat java/lang/Object.java
package java.lang;
interface I {}
public class Object implements I {}
$ jikes java/lang/Object.java
assertion "type -> Identity() != control.object_name_symbol || type ->
ContainingPackage() != control.system_package" failed: file "decl.cpp", line
1001
Aborted (core dumped)
$ javac java/lang/Object.java 2>&1 |less
An exception has occurred in the compiler (1.4.0-beta2). 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.StackOverflowError
at com.sun.tools.javac.v8.comp.Check.firstUndef(Check.java:862)
at com.sun.tools.javac.v8.comp.Check.firstUndef(Check.java:866)
at com.sun.tools.javac.v8.comp.Check.firstUndef(Check.java:862)
at com.sun.tools.javac.v8.comp.Check.firstUndef(Check.java:866)
...
at com.sun.tools.javac.v8.comp.Check.firstUndef(Check.java:866)
(Review ID: 134690)
======================================================================
- duplicates
-
JDK-4091755 java.lang.Object can't be redefined without crashing javac
-
- Closed
-