RFR: 8316470: Incorrect error location for "invalid permits clause" depending on file order

Vicente Romero vromero at openjdk.org
Mon Oct 23 20:39:47 UTC 2023


On Tue, 17 Oct 2023 15:10:19 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> 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.

lgtm

-------------

Marked as reviewed by vromero (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16221#pullrequestreview-1693480827


More information about the compiler-dev mailing list