- 
    Bug 
- 
    Resolution: Fixed
- 
     P3 P3
- 
    17
- 
        b31
| Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build | 
|---|---|---|---|---|---|---|
| JDK-8270220 | 18 | Jan Lahoda | P3 | Resolved | Fixed | b06 | 
| JDK-8270741 | 17.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b03 | 
                    Mostly based on:
https://mail.openjdk.java.net/pipermail/compiler-dev/2021-June/017343.html
The following should not compile:
---
void testInt(Integer i) {
switch (i) {
case Integer o && o != null, 1: //cannot combine type patterns and constants
System.out.println("s1");
default:
System.out.println("def");
}
}
---
---
void testInt(Integer i) {
switch (i) {
case null, Integer o && o != null: //must be a type pattern
System.out.println("s1");
default:
System.out.println("def");
}
}
---
---
switch(selExpr) {
case String s, null, default : //illegal combination of (type) pattern and default
}
---
https://mail.openjdk.java.net/pipermail/compiler-dev/2021-June/017343.html
The following should not compile:
---
void testInt(Integer i) {
switch (i) {
case Integer o && o != null, 1: //cannot combine type patterns and constants
System.out.println("s1");
default:
System.out.println("def");
}
}
---
---
void testInt(Integer i) {
switch (i) {
case null, Integer o && o != null: //must be a type pattern
System.out.println("s1");
default:
System.out.println("def");
}
}
---
---
switch(selExpr) {
case String s, null, default : //illegal combination of (type) pattern and default
}
---
- backported by
- 
                    JDK-8270220 Missing unreported constraints on pattern and other case label combination -           
- Resolved
 
-         
- 
                    JDK-8270741 Missing unreported constraints on pattern and other case label combination -           
- Resolved
 
-         
 
        