hg: valhalla/valhalla: 8197799: Add support for ACC_FLATTENABLE flag for fields.

Srikanth srikanth.adayapalam at oracle.com
Mon Feb 19 04:40:06 UTC 2018



On Monday 19 February 2018 10:07 AM, srikanth.adayapalam at oracle.com wrote:
> Changeset: 51eab9946bcb
> Author:    sadayapalam
> Date:      2018-02-19 10:02 +0530
> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/51eab9946bcb
>
> 8197799: Add support for ACC_FLATTENABLE flag for fields.

Notes:

     - Add support in javac and javap for ACC_FLATTENABLE flag for fields
     - Introduce a new annotation in java.lang package called 
@Flattenable whose declaration looks like:

             @Target(ElementType.FIELD)
             @Retention(RetentionPolicy.SOURCE) // lowered into flag 
bit, so not required further.
             public @interface Flattenable {}

     - Reject at compile time any attempt to apply this annotation to a 
field whose type is not a value class
     - Persist this field in the class file via ACC_FLATTENABLE flag bit 
(0x100) on the concerned field

Follow ups under progress:

JDK-8197911 <https://bugs.openjdk.java.net/browse/JDK-8197911>: A field 
flagged as ACC_FLATTENABLE must never store the null reference
JDK-8197909 <https://bugs.openjdk.java.net/browse/JDK-8197909>: Check 
impact of ACC_FLATTENABLE on compiler diagnostic 
cyclic.value.type.membership

Thanks!
Srikanth
>
> + src/java.base/share/classes/java/lang/Flattenable.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
> ! src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
> ! src/jdk.jdeps/share/classes/com/sun/tools/classfile/AccessFlags.java
> + test/langtools/tools/javac/diags/examples/BadFlattenableAnno.java
> + test/langtools/tools/javac/valhalla/lworld-values/FlattenableFlagTest.java
>



More information about the valhalla-dev mailing list