-
Enhancement
-
Resolution: Fixed
-
P5
-
1.1.1, 1.1.6, 1.2.2
-
b19
-
x86, sparc
-
solaris_2.5.1, windows_nt
-
Verified
Name: tb29552 Date: 11/18/97
Submitter of this Incident modified java/lang/Object.java as follows:
In a copy of java/lang/Object.java, add the
default constructor method containing a
call to super(), as follows:
public Object () {
super();
}
Attempt to compile the file and get the exception
java.lang.NullPointerException
at sun.tools.tree.MethodExpression.checkValue(MethodExpression.java:72)
at sun.tools.tree.MethodExpression.check(MethodExpression.java:340)
at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:46)
at sun.tools.tree.Statement.checkBlockStatement(Statement.java:120)
at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:70)
at sun.tools.tree.Statement.checkMethod(Statement.java:98)
at sun.tools.javac.SourceField.check(SourceField.java:402)
at sun.tools.javac.SourceClass.checkFields(SourceClass.java:852)
at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:615)
at sun.tools.javac.SourceClass.check(SourceClass.java:566)
at sun.tools.javac.Main.compile(Main.java:318)
at sun.tools.javac.Main.main(Main.java:473)
The Object class has no superclass, so constructor
chaining can't work. But it ought to fail gracefully.
(Review ID: 14418)
======================================================================
- duplicates
-
JDK-4206212 super() in constructor of java.lang.Object class crashes javac
- Closed