Skip to content

Commit

Permalink
[Switch Expression] Internal compiler error: java.util.EmptyStackExce…
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanth-sankaran authored Apr 12, 2024
1 parent 8fd8594 commit 8784ff4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3980,7 +3980,7 @@ public void i2c() {
public void i2d() {
this.countLabels = 0;
this.stackDepth++;
pushTypeBinding(1, TypeBinding.INT);
pushTypeBinding(1, TypeBinding.DOUBLE);
if (this.stackDepth > this.stackMax)
this.stackMax = this.stackDepth;
if (this.classFileOffset >= this.bCodeStream.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7130,4 +7130,35 @@ public static void notmain(String [] args) {
},
"");
}
// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/2322
// [Switch Expression] Internal compiler error: java.util.EmptyStackException at java.base/java.util.Stack.peek
public void testIssue2322() {
if (this.complianceLevel < ClassFileConstants.JDK14)
return;
this.runConformTest(
new String[] {
"X.java",
"""
public class X {
public static void main(String [] args) {
int lineCount = 10;
long time = 1000;
print((int) (lineCount * 10000.0 / time));
print((double) (lineCount * 10000.0 / time));
System.out.println(switch(lineCount) {
default -> {
try {
yield "OK";
} finally {
}
}
});
}
static void print(double d) {}
}
"""
},
"OK");
}
}

0 comments on commit 8784ff4

Please sign in to comment.