RFR: 8259905: Compiler treats 'sealed' keyword as 'var' keyword
Vicente Romero
vromero at openjdk.java.net
Thu Jan 28 18:50:49 UTC 2021
Hi,
Please review this fix which is basically fixing an oversaw issue affecting new restricted keywords: `sealed` and `permits`. The fix per se is in lines: 3341-3343, but then I made some additional changes to the position where previous errors were reported at method JavacParser::variableDeclaratorRest. That was done for consistency with the new code. I could have done the other way but then users would have two error notifications for some code, one for the use of the restricted type per se and another one for the use of the variable or field so like:
void m() {
sealed s1;
^
compiler error here
^
and before you go, compiler error here too
}
I guess it make sense for the already existing code to be positioned on the use of the restricted type and not on the variable declared afterwards. Doing that adjustment has implied some changes to the golden file associated to test ParserTest. Also I added another case and did some additional editing to test SealedCompilationTests.
TIA
-------------
Commit messages:
- 8259905: Compiler treats 'sealed' keyword as 'var' keyword
Changes: https://git.openjdk.java.net/jdk/pull/2298/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2298&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8259905
Stats: 48 lines in 3 files changed: 14 ins; 22 del; 12 mod
Patch: https://git.openjdk.java.net/jdk/pull/2298.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2298/head:pull/2298
PR: https://git.openjdk.java.net/jdk/pull/2298
More information about the compiler-dev
mailing list