[lworld] RFR: 8244231: [lworld] Add support for ref-default and val-default inline classes.

Srikanth Adayapalam sadayapalam at openjdk.java.net
Mon Jul 19 06:49:10 UTC 2021

On Fri, 16 Jul 2021 08:05:02 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

> Code changes and tests

I have annotated the code changes with hopefully helpful comments that will help the reviewer. 
https://bugs.openjdk.java.net/browse/JDK-8270882 has various tasks deliberately deferred.

src/jdk.jdeps/share/classes/com/sun/tools/classfile/AccessFlags.java line 65:

> 63: 
> 64:     public static enum Kind { Class, InnerClass, Field, Method, JavacExtra}
> 65: 

This is an half hearted attempt to find a place for ACC_REF_DEFAULT - I don't think it belongs here really since it is not a part of the class flags. But I have stuck this in here for now - In javap code to reference ACC_REF_DEFAULT symbolically this is useful (since the compiler's definition from Flags.java is not visible there in javap). To be cleaned up in JDK-8270882

src/jdk.jdeps/share/classes/com/sun/tools/classfile/Attribute.java line 52:

> 50:     public static final String InnerClasses             = "InnerClasses";
> 51:     public static final String JavaFlags                = "JavaFlags";
> 52:     public static final String LineNumberTable          = "LineNumberTable";

The name and attribute syntax was suggested by Dan, this may incur/undergo some bikeshedding later.

src/jdk.jdeps/share/classes/com/sun/tools/javap/AttributeWriter.java line 364:

> 362:         if ((attr.extendedFlags & ACC_REF_DEFAULT) != 0)
> 363:             println("ACC_REF_DEFAULT");
> 364:         indent(-1);

com.sun.tools.javac.code.Flags#ACC_REF_DEFAULT is not visible here. So com.sun.tools.classfile.AccessFlags has been enhanced to define ACC_REF_DEFAULT - but this is a stop gap

test/langtools/tools/javac/valhalla/lworld-values/CheckFinal.out line 5:

> 3: CheckFinal.java:17:13: compiler.err.cant.assign.val.to.final.var: xsf
> 4: CheckFinal.java:19:29: compiler.err.cant.inherit.from.final: CheckFinal
> 5: 4 errors

The (now deleted) attempt to avoid further secondary errors in Attr.java having outlived its purpose was actually causing additional errors to be emitted! Fixed.


PR: https://git.openjdk.java.net/valhalla/pull/482

More information about the valhalla-dev mailing list