-
Bug
-
Resolution: Fixed
-
P3
-
14, 17, 20, 21
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8307018 | 20u-cpu | Matthias Baesken | P3 | Resolved | Fixed | master |
JDK-8305123 | 20.0.2 | Matthias Baesken | P3 | Resolved | Fixed | b03 |
JDK-8310050 | 17.0.9-oracle | Adam Sotona | P3 | Resolved | Fixed | b01 |
JDK-8305238 | 17.0.8 | Matthias Baesken | P3 | Resolved | Fixed | b01 |
This fails to work with JDK14 (and newer):
--------------
OpenJDK\14\bin\javac --release 8 UnderscoreEnum.java
UnderscoreEnum.java:4: error: enum constant expected here
NULL(null), _("&&"), __("||"), OR("OR");
^
UnderscoreEnum.java:4: warning: as of release 9, '_' is a keyword, and may not be used as an identifier
NULL(null), _("&&"), __("||"), OR("OR");
^
UnderscoreEnum.java:4: error: illegal start of type
NULL(null), _("&&"), __("||"), OR("OR");
^
UnderscoreEnum.java:9: error: illegal start of expression
CCEnum(final String value) {
^
UnderscoreEnum.java:9: error: ';' expected
CCEnum(final String value) {
^
4 errors
1 warning
With JDK13 or below, it still works nicely:
--------------
OpenJDK\13\bin\javac.exe --release 8 UnderscoreEnum.java
UnderscoreEnum.java:4: warning: as of release 9, '_' is a keyword, and may not be used as an identifier
NULL(null), _("&&"), __("||"), OR("OR");
^
1 warning
Simple identifiers named '_' work with --release 8 (or -source 8); but when used in enum the compatibility breaks.
- backported by
-
JDK-8305123 javac regression: Compilation with --release 8 fails on underscore in enum identifiers
- Resolved
-
JDK-8305238 javac regression: Compilation with --release 8 fails on underscore in enum identifiers
- Resolved
-
JDK-8307018 javac regression: Compilation with --release 8 fails on underscore in enum identifiers
- Resolved
-
JDK-8310050 javac regression: Compilation with --release 8 fails on underscore in enum identifiers
- Resolved
- relates to
-
JDK-8228647 Broken enum produce inconvenient errors and AST
- Resolved
- links to
-
Commit openjdk/jdk17u-dev/8bc5ad10
-
Commit openjdk/jdk20u/0d717958
-
Commit openjdk/jdk/63d4afbe
-
Review openjdk/jdk17u-dev/1216
-
Review openjdk/jdk20u/23
-
Review openjdk/jdk/13137