mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8318144: Match on enum constants with body compiles but fails with MatchException
Reviewed-by: liach, vromero
This commit is contained in:
parent
42f43c520c
commit
541ff7149f
3 changed files with 122 additions and 2 deletions
|
@ -394,9 +394,13 @@ public class SwitchBootstraps {
|
|||
Object resolved;
|
||||
|
||||
try {
|
||||
if (!(value instanceof Enum<?> enumValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Class<?> clazz = label.constantType().resolveConstantDesc(lookup);
|
||||
|
||||
if (value.getClass() != clazz) {
|
||||
if (enumValue.getDeclaringClass() != clazz) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue