-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0, 1.2.2
-
beta
-
x86, sparc
-
linux, solaris_2.5.1
-
Verified
Name: tb29552 Date: 04/28/99
/*
While attempting to compile a java program I got the following error.
(Bug ID 4062064 describes a similar problem, however 4062064 is marked
"fixed" in JDK 1.2beta, and this crash is still observed in 1.2.x)
% java -version ; java -fullversion
java version "1.2"
Classic VM (build JDK-1.2-V, green threads, sunwjit)
java full version "JDK-1.2-V"
% javac -J-Djava.compiler=NONE Crash.java
sun.tools.java.CompilerError: addReference Crash.1$ConsitVars this
at sun.tools.java.ClassDefinition.addReference(ClassDefinition.java:1896)
at sun.tools.java.ClassDefinition.getReference(ClassDefinition.java:1891)
at sun.tools.tree.Context.noteReference(Context.java:336)
at sun.tools.tree.Context.makeReference(Context.java:357)
at sun.tools.tree.ThisExpression.checkValue(ThisExpression.java:86)
at sun.tools.tree.Expression.checkAmbigName(Expression.java:254)
at sun.tools.tree.FieldExpression.checkCommon(FieldExpression.java:501)
at sun.tools.tree.FieldExpression.checkValue(FieldExpression.java:220)
at sun.tools.tree.IdentifierExpression.checkAssignOp(IdentifierExpression.java:255)
at sun.tools.tree.AssignOpExpression.checkValue(AssignOpExpression.java:137)
at sun.tools.tree.BinaryAssignExpression.check(BinaryAssignExpression.java:55)
at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java:39)
at sun.tools.tree.Statement.checkBlockStatement(Statement.java:157)
at sun.tools.tree.SwitchStatement.check(SwitchStatement.java:116)
at sun.tools.tree.Statement.checkBlockStatement(Statement.java:157)
at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:65)
at sun.tools.tree.Statement.checkMethod(Statement.java:92)
at sun.tools.javac.SourceMember.check(SourceMember.java:539)
at sun.tools.javac.SourceClass.checkMembers(SourceClass.java:1002)
at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:612)
at sun.tools.javac.SourceClass.checkLocalClass(SourceClass.java:1346)
at sun.tools.tree.VarDeclarationStatement.checkDeclaration(VarDeclarationStatement.java:58)
at sun.tools.tree.DeclarationStatement.checkBlockStatement(DeclarationStatement.java:54)
at sun.tools.tree.CompoundStatement.check(CompoundStatement.java:65)
at sun.tools.tree.Statement.checkMethod(Statement.java:92)
at sun.tools.javac.SourceMember.check(SourceMember.java:539)
at sun.tools.javac.SourceClass.checkMembers(SourceClass.java:1002)
at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:612)
at sun.tools.javac.SourceClass.check(SourceClass.java:511)
at sun.tools.javac.Main.compile(Main.java:550)
at sun.tools.javac.Main.main(Main.java:733)
error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
*/
import java.lang.NoSuchFieldException;
public class Crash {
private static final boolean sumCounterparts() {
class ConsitVars {
public final int AMOUNT = 0; /* This version crashes javac */
//public static final int AMOUNT = 0; /* This version compiles */
private double amount;
ConsitVars () {
}
public void add(int field, double value)
throws NoSuchFieldException {
switch (field) {
case AMOUNT:
amount += value;
break;
default:
throw new NoSuchFieldException();
}
}
} /* End "class ConsitVars" */
ConsitVars consit = new ConsitVars ();
return (false);
}
}
(Review ID: 57543)
======================================================================
- duplicates
-
JDK-4330364 javac compiler error "sun.tools.java.CompilerError: addReference"
-
- Closed
-
- relates to
-
JDK-4062064 javac: sun.tools.java.CompilerError: addReference <whatever> this
-
- Closed
-