Add class qualified is broken for enums
See original GitHub issueBug Description When the flag is activated, the plugin adds class qualifier to static member access outside classes which is nice. However, when you are inside a switch-case for an enum. It is adding the enum name as qualifier which is not allowed
To Reproduce
-
Create an enum, say:
enum Day { MON, WED, FRI }
-
Create a Main class, say:
public class Main { public static void main(String[] args) { Day day = Day.MON; switch (day) { case MON: System.out.println("oh no"); break; case WED: System.out.println("oh ok"); break; case FRI: System.out.println("oh nice"); break; default: break; } } }
Expected behavior The above should be kept as is!
Actual behavior
The plugin does:
case Day.MON
, case Day.WED
, case Day.FRI
which weirdly is not allowed in Java
On compilation, this error is thrown:
an enum switch case label must be the unqualified name of an enumeration constant
Versions IntelliJ IDEA 2019.1 EAP (Ultimate Edition) Build #IU-191.5849.21, built on February 27, 2019 IntelliJ IDEA EAP User Expiration date: March 29, 2019 JRE: 1.8.0_202-release-1483-b31 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 7 6.1
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top GitHub Comments
Ok, reopening. PRs welcomed.
@dubreuia: I can confirm the not fully fixed issue of @RSLak1 in 2019.3.1 with version 1.9.0 and 2019.2.4 with unknown version both linux and community edition