Name: dm26566 Date: 08/01/97
class X
{
final int c1 = 1;
final int c2 = 2;
//
// There seems to be a problem in a switch statement that
// uses constants in the constructor, causing the error message given.
//
// This is as simple as I can make the code and still cause the compiler
// error.
//
public X()
{
switch ( 1 ) {
case c1 :
case c2 :
}
}
//
// This function presents no problem, although it contains the same code,
// the only difference is that the code is not contained within a constructor.
//
public void _X()
{
switch ( 1 ) {
case c1 :
case c2 :
}
}
}
Added by dalem:
Using JDK 1.1.3:
javac X.java
sun.tools.java.CompilerError: addReference X this
at sun.tools.java.ClassDefinition.addReference(ClassDefinition.java)
at sun.tools.java.ClassDefinition.getReference(ClassDefinition.java)
at sun.tools.tree.Context.noteReference(Context.java)
at sun.tools.tree.Context.makeReference(Context.java)
at sun.tools.tree.ThisExpression.checkValue(ThisExpression.java)
at sun.tools.tree.Expression.checkAmbigName(Expression.java)
at sun.tools.tree.FieldExpression.checkCommon(FieldExpression.java)
at sun.tools.tree.FieldExpression.checkValue(FieldExpression.java)
at sun.tools.tree.IdentifierExpression.checkValue(IdentifierExpression.java)
at sun.tools.tree.CaseStatement.check(CaseStatement.java)
at sun.tools.tree.SwitchStatement.check(SwitchStatement.java)
at sun.tools.tree.Statement.checkBlockStatement(Statement.java)
at sun.tools.tree.CompoundStatement.check(CompoundStatement.java)
at sun.tools.tree.Statement.checkMethod(Statement.java)
at sun.tools.javac.SourceField.check(SourceField.java)
at sun.tools.javac.SourceClass.checkFields(SourceClass.java)
at sun.tools.javac.SourceClass.checkInternal(SourceClass.java)
at sun.tools.javac.SourceClass.check(SourceClass.java)
at sun.tools.javac.Main.compile(Main.java)
at sun.tools.javac.Main.main(Main.java)
error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
java_g does not provide much more info.
company - 45 Devon Rd. , email - ###@###.###
======================================================================
- duplicates
-
JDK-4062064 javac: sun.tools.java.CompilerError: addReference <whatever> this
-
- Closed
-