-
Bug
-
Resolution: Fixed
-
P4
-
21, 22
-
b10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8313862 | 21.0.1 | Jan Lahoda | P4 | Resolved | Fixed | b06 |
Consider code like:
---
public class Err {
record R(String x) {}
public void(Object obj) {
switch(obj) {
case R(var v, ) -> 1;
}
}
}
---
javac may crash on this code:
---
$ ./build/linux-x86_64-server-release/images/jdk/bin/javac -XDdev -XDshould-stop.at=FLOW /tmp/Err.java
/tmp/Err.java:5: error: <identifier> expected
public void(Object obj) {
^
/tmp/Err.java:9: error: illegal start of type
case R(var v, ) -> 1;
^
/tmp/Err.java:9: error: not a statement
case R(var v, ) -> 1;
^
/tmp/Err.java:9: error: incorrect number of nested patterns
case R(var v, ) -> 1;
^
required: String
found: String,<any>
4 errors
An exception has occurred in the compiler (22-internal). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
at jdk.compiler/com.sun.tools.javac.comp.Flow.makePatternDescription(Flow.java:3483)
...
---
---
public class Err {
record R(String x) {}
public void(Object obj) {
switch(obj) {
case R(var v, ) -> 1;
}
}
}
---
javac may crash on this code:
---
$ ./build/linux-x86_64-server-release/images/jdk/bin/javac -XDdev -XDshould-stop.at=FLOW /tmp/Err.java
/tmp/Err.java:5: error: <identifier> expected
public void(Object obj) {
^
/tmp/Err.java:9: error: illegal start of type
case R(var v, ) -> 1;
^
/tmp/Err.java:9: error: not a statement
case R(var v, ) -> 1;
^
/tmp/Err.java:9: error: incorrect number of nested patterns
case R(var v, ) -> 1;
^
required: String
found: String,<any>
4 errors
An exception has occurred in the compiler (22-internal). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
at jdk.compiler/com.sun.tools.javac.comp.Flow.makePatternDescription(Flow.java:3483)
...
---
- backported by
-
JDK-8313862 javac may crash on a record pattern with too few components
-
- Resolved
-