RFR: 7194212: NPE in Flow.visitIdent

Vicente Romero vromero at openjdk.java.net
Mon Dec 7 20:36:14 UTC 2020


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.

looks sensible

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

Marked as reviewed by vromero (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1326


More information about the compiler-dev mailing list