-
Bug
-
Resolution: Fixed
-
P3
-
17
-
b30
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8269783 | 18 | Jan Lahoda | P3 | Resolved | Fixed | b05 |
JDK-8270695 | 17.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b03 |
Consider this code:
---
public class PatternTest {
public static void main(String[] args) {
Object expr = "a";
boolean b = expr instanceof (String a && a.equals("a"));
}
}
---
This crashes javac:
$ javac --enable-preview -source 17 PatternTest.java
Note: PatternTest.java uses preview features of Java SE 17.
Note: Recompile with -Xlint:preview for details.
An exception has occurred in the compiler (17-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://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.NullPointerException: Cannot read field "sym" because "this.lvar[3]" is null
at jdk.compiler/com.sun.tools.javac.jvm.Code.emitop0(Code.java:577)
at jdk.compiler/com.sun.tools.javac.jvm.Items$LocalItem.load(Items.java:399)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2339)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2450)
...
---
---
public class PatternTest {
public static void main(String[] args) {
Object expr = "a";
boolean b = expr instanceof (String a && a.equals("a"));
}
}
---
This crashes javac:
$ javac --enable-preview -source 17 PatternTest.java
Note: PatternTest.java uses preview features of Java SE 17.
Note: Recompile with -Xlint:preview for details.
An exception has occurred in the compiler (17-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://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.NullPointerException: Cannot read field "sym" because "this.lvar[3]" is null
at jdk.compiler/com.sun.tools.javac.jvm.Code.emitop0(Code.java:577)
at jdk.compiler/com.sun.tools.javac.jvm.Items$LocalItem.load(Items.java:399)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2339)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2450)
...
---
- backported by
-
JDK-8269783 javac crashes when processing parenthesized pattern in instanceof
-
- Resolved
-
-
JDK-8270695 javac crashes when processing parenthesized pattern in instanceof
-
- Resolved
-
- relates to
-
JDK-8278834 Error "Cannot read field "sym" because "this.lvar[od]" is null" when compiling
-
- Resolved
-