You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ECJ crashes compiling the following code; javac complains error: the switch statement does not cover all possible input values
public class X {
public static void main(String[] args) {
switch (main(null)) {
}
}
}
Stack trace on master (problem can be seen from 4.34 M2)
Caused by: java.util.EmptyStackException
at java.base/java.util.Stack.peek(Stack.java:103)
at org.eclipse.jdt.internal.compiler.codegen.OperandStack.peek(OperandStack.java:123)
at org.eclipse.jdt.internal.compiler.codegen.CodeStream.dup(CodeStream.java:1082)
at org.eclipse.jdt.internal.compiler.ast.SwitchStatement.generateCodeSwitchPatternPrologue(SwitchStatement.java:850)
at org.eclipse.jdt.internal.compiler.ast.SwitchStatement.generateCode(SwitchStatement.java:708)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:395)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.generateCode(AbstractMethodDeclaration.java:331)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:773)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:843)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:403)
at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1119)
at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1155)
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:292)
The text was updated successfully, but these errors were encountered:
Not sure this should compile, but does with both javac and ECJ:
public class X {
public static void main(String[] args) {
switch (null) {
case null -> System.out.println("Null");
default-> System.out.println("Default");
}
}
}
Not sure this should not (two nots there) compile, but doesn't with both ECJ and javac: Both complain about missing default
public class X {
public static void main(String[] args) {
switch (null) {
case null -> System.out.println("Null");
// default-> System.out.println("Default");
}
}
}
Found by code inspection and white box testing:
ECJ crashes compiling the following code; javac complains
error: the switch statement does not cover all possible input values
Stack trace on master (problem can be seen from 4.34 M2)
The text was updated successfully, but these errors were encountered: