-
Bug
-
Resolution: Fixed
-
P5
-
8, 9
-
b55
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085363 | emb-9 | Srikanth Adayapalam | P5 | Resolved | Fixed | team |
Consider the following code:
---
enum EnumSwitch {
A, B;
public static int c(EnumSwitch e) {
switch (e) {
case EnumSwitch.A: return 1;
case EnumSwitch.B: return 2;
}
}
}
---
Compiling this will produce these three errors:
---
EnumSwitch.java:5: error: an enum switch case label must be the unqualified name of an enumeration constant
case EnumSwitch.A: return 1;
^
EnumSwitch.java:6: error: an enum switch case label must be the unqualified name of an enumeration constant
case EnumSwitch.B: return 2;
^
EnumSwitch.java:6: error: duplicate case label
case EnumSwitch.B: return 2;
^
3 errors
---
The first two errors are appropriate, but the third one is not: there is no duplication in the labels.
This has originally been filed as part ofJDK-8048805.
---
enum EnumSwitch {
A, B;
public static int c(EnumSwitch e) {
switch (e) {
case EnumSwitch.A: return 1;
case EnumSwitch.B: return 2;
}
}
}
---
Compiling this will produce these three errors:
---
EnumSwitch.java:5: error: an enum switch case label must be the unqualified name of an enumeration constant
case EnumSwitch.A: return 1;
^
EnumSwitch.java:6: error: an enum switch case label must be the unqualified name of an enumeration constant
case EnumSwitch.B: return 2;
^
EnumSwitch.java:6: error: duplicate case label
case EnumSwitch.B: return 2;
^
3 errors
---
The first two errors are appropriate, but the third one is not: there is no duplication in the labels.
This has originally been filed as part of
- backported by
-
JDK-8085363 Improper "duplicate case label" error
-
- Resolved
-