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

Jan Lahoda jlahoda at openjdk.org
Tue Oct 24 12:21:45 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.

This pull request has now been integrated.

Changeset: bf1a14e3
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/bf1a14e3672b7d92b10d16210faf4fd99a860731
Stats:     279 lines in 2 files changed: 178 ins; 31 del; 70 mod

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

Reviewed-by: vromero

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

PR: https://git.openjdk.org/jdk/pull/16221


More information about the compiler-dev mailing list