I think this is user error, but the compiler requested I file this report.
The following java code doesn't compiler:
public class test2
{
static Class m_c = Character.class;
void xxx(Class c)
{
if (c == Character.class)
{
}
}
}
It fails with the following traceback:
wildhorses% javac test2.java
java.lang.NullPointerException
at sun.tools.tree.ConditionalExpression.costInline(ConditionalExpression.java)
at sun.tools.tree.ExpressionStatement.costInline(ExpressionStatement.java)
at sun.tools.java.FieldDefinition.cleanup(FieldDefinition.java)
at sun.tools.java.ClassDefinition.cleanup(ClassDefinition.java)
at sun.tools.javac.Main.compile(Main.java)
at sun.tools.javac.Main.main(Main.java)
error: An exception has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
But if you change (c == Character.class) to (c.equals(Character.class))
it compiles.
Or if you change (c == Character.class) to (c == m_c) it compiles.
janet.koenig@Eng 1997-08-05
The following java code doesn't compiler:
public class test2
{
static Class m_c = Character.class;
void xxx(Class c)
{
if (c == Character.class)
{
}
}
}
It fails with the following traceback:
wildhorses% javac test2.java
java.lang.NullPointerException
at sun.tools.tree.ConditionalExpression.costInline(ConditionalExpression.java)
at sun.tools.tree.ExpressionStatement.costInline(ExpressionStatement.java)
at sun.tools.java.FieldDefinition.cleanup(FieldDefinition.java)
at sun.tools.java.ClassDefinition.cleanup(ClassDefinition.java)
at sun.tools.javac.Main.compile(Main.java)
at sun.tools.javac.Main.main(Main.java)
error: An exception has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
But if you change (c == Character.class) to (c.equals(Character.class))
it compiles.
Or if you change (c == Character.class) to (c == m_c) it compiles.
janet.koenig@Eng 1997-08-05
- duplicates
-
JDK-4113185 An exception has occurred in the compiler
-
- Closed
-
-
JDK-4167445 compiler crashes with this code
-
- Closed
-
-
JDK-4215152 javac internal error: conditional statement involving reflection
-
- Closed
-