RFR: 8316470: Incorrect error location for "invalid permits clause" depending on file order
Jan Lahoda
jlahoda at openjdk.org
Tue Oct 17 15:20:25 UTC 2023
Consider code like (in two different files, but accessible through source path):
class Main extends C {}
sealed class C {} //does not permit Main
and a javac process that will start attribution with `Main`. As part of `Main` attribution, its superclasses will be attributed, hence `C` will be attributed. And there will be a sealing error reported for `C` (missing permitted). But, the source in the logger will still be set to `Main`, and hence the report will be reported at a weird place in `Main`, not in `C`.
The proposed solution is simple: move the code to set the source to logger (and related code) before the sealed checks. The diff looks scary, but it is movement of several lines up, and whitespace changes.
-------------
Commit messages:
- 8316470: Incorrect error location for "invalid permits clause" depending on file order
Changes: https://git.openjdk.org/jdk/pull/16221/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16221&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8316470
Stats: 279 lines in 2 files changed: 178 ins; 31 del; 70 mod
Patch: https://git.openjdk.org/jdk/pull/16221.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16221/head:pull/16221
PR: https://git.openjdk.org/jdk/pull/16221
More information about the compiler-dev
mailing list