Integrated: 7194212: NPE in Flow.visitIdent

Jan Lahoda jlahoda at openjdk.org
Fri Aug 12 08:16:13 UTC 2022


On Thu, 19 Nov 2020 18:24:00 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> A somewhat corner-case issue, but consider a case where classfiles for:
> 
> 
> public class Outer {
>     public class Inner { }
> }
> 
> 
> Are on a classpath while compiling:
> 
> 
> public class Outer$Inner extends Outer { }
> 
> 
> This leads to a crash in javac (in Flow), because when Outer is completed, its InnerClasses attribute is read, and, based on it, the flags_field of Outer$Inner is (re)set (and it is put as an nested class to Outer, although that is not correct). But the flags_field used to contain UNATTRIBUTED flag. As this flag is cleared, the method bodies for Outer$Inner are never attributed (its default constructor in this case), which ultimately leads to the crash in Flow.
> 
> The proposed patch is to ensure the InnerClasses entry is ignored if we are compiling a same-named class from source. The cost is yet another Flag bit.

This pull request has now been integrated.

Changeset: 0c40128f
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/0c40128fec41cf69821dbf7f1b19600560e8ac12
Stats:     120 lines in 6 files changed: 110 ins; 1 del; 9 mod

7194212: NPE in Flow.visitIdent

Reviewed-by: vromero

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

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


More information about the compiler-dev mailing list