Switch label: do not resolve unqualified enum constants referenced on the right side of arrow

Fixes IDEA-210771 Error message should be exposed for the new 'case' label in Java 12 in case of wrong constant usage
This commit is contained in:
Tagir Valeev
2019-04-12 10:56:13 +07:00
parent ce627ce81c
commit fbd8237916
3 changed files with 14 additions and 1 deletions
@@ -0,0 +1,12 @@
import java.util.Random;
class SwitchExpressionsEnumResolve {
enum E { E1, E2 }
E test(E e) {
return switch (e) {
case E1 -> <error descr="Cannot resolve symbol 'E2'">E2</error>;
case E2 -> <error descr="Cannot resolve symbol 'E1'">E1</error>;
};
}
}