[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:33:16 UTC 2021


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

> Code changes and tests

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 326:

> 324:                 */
> 325:                 if (env.info.inWithField && v.getKind() == ElementKind.FIELD && (v.flags() & STATIC) == 0 && v.owner.isPrimitiveClass()) {
> 326:                     if (env.enclClass.sym.outermostClass() == v.owner.outermostClass())

This is an example of a code change you will see recur several times: Earlier when we had only value default primitive classes to check if a field is a field of a primitive class it was alright to ask

types.isPrimitiveClass(v.owner.type)

With ref-default classes entering the picture if v.owner is a ref-default primitive class then v.owner.type will not
answer true for the above check. (For a ref-default primitive class Optional.val, Optional.type is 'L' type not Q type) and we need to check

owner.isPrimitiveClass()

which will answer true for both val-default and ref-default primitive classes.

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

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


More information about the valhalla-dev mailing list