[lworld] RFR: 8242900: [lworld] Allow an inline type to declare a superclass that meets specified restrictions

Srikanth srikanth.adayapalam at oracle.com
Thu Apr 16 11:59:03 UTC 2020

Hi Jim,

May I request you to please review this change ?? TIA. See below for a 
detailed instructions.

(I changed my mind: Rather than throw a large patch that implements the 
entire kitchen sink at the reviewers, I will divide it up into 3-4 
manageable chunks. Here is first set of changes)


On 16/04/20 5:23 pm, Srikanth Adayapalam wrote:
> Here is a change set that implements the changes for
>       https://bugs.openjdk.java.net/browse/JDK-8242900 ([lworld] Allow an inline type to declare a superclass that meets
>       specified restrictions)
> and its prerequisite blocker:
>      https://bugs.openjdk.java.net/browse/JDK-8242912 (Abstract classes should not implement IdentityObject)
> Here is a roadmap that would make it easier for you to review:
>      - Go over to the JBS tickets above and read up the description of the tasks
>      - Start with the new tests to understand what is being implemented and tested:
>              test/langtools/tools/javac/valhalla/lworld-values/BinarySuperclassConstraints.java
>              test/langtools/tools/javac/valhalla/lworld-values/BinarySuperclassConstraints.out
>              test/langtools/tools/javac/valhalla/lworld-values/SuperclassCollections.java
>              test/langtools/tools/javac/valhalla/lworld-values/SuperclassConstraints.java
>              test/langtools/tools/javac/valhalla/lworld-values/SuperclassConstraints.out
>       - Review of source files is best taken up in this order:
>              Flags.java: defines two new flags to decorate classes with initializer blocks and empty no-arg constructor as being
>              such. Attr.java:    During attribution flag classes that have initializer blocks and constructors that are empty no-arg
>              constructors.
>                                Arrange to check for constraints of a super class of an inline class.
>              Check.java: Check the superclass's constraints when asked by the attributor.
>              ClassReader.java: When reading class files, flags constructors that are empty no-arg constructors (save for chaining to
>              super's no-arg ctor) compiler.properties: new errors.
>              TransValues.java: In earlier versions, Inline types implicitly extended jlO, so any super() chaining call must be jlO's
>              ctor. This is no longer the case. So remove the assertion. TreeInfo.java: Tweak to a utility method to make it more
>              general and suitable for our present needs. TypeEnter.java: Earlier specs forbid an inline type declaration to have an
>              extends clause. This is no longer illegal. So we don't error anymore. Abstract types should not implement the new top
>              interface (IdentityObject)
>      - These changes are simply rolling back prior changes made at the time of injection of new top interfaces. Because we
>        don't inject them anymore for abstract classes, we should not encode them in "golden" files:
>              test/jdk/java/lang/annotation/TypeAnnotationReflection.java
>              test/jdk/java/lang/reflect/Generics/TestC1.java
>              test/jdk/java/lang/reflect/Generics/TestC2.java
>              test/langtools/tools/javac/processing/rounds/OverwriteBetweenCompilations_2.out
>              test/langtools/tools/javac/processing/rounds/OverwriteBetweenCompilations_3.out
>              test/langtools/tools/javap/AnnoTest.java
>      - To shut up CheckExamples.java from spuriously failing, for the time being add the new compiler message keys to the
>        white list:
>              test/langtools/tools/javac/diags/examples.not-yet.txt
>      - Other minorly modified tests that you may want to eyeball: (The diagnostics change a little bit since "extends" clause
>        is no longer illegal. I have added -XDallowEmptyValues in some cases to exercise different code paths and elicit
>        different diagnostics)
>              test/langtools/tools/javac/valhalla/lworld-values/CheckExtends.java
>              test/langtools/tools/javac/valhalla/lworld-values/CheckExtends.out
>              test/langtools/tools/javac/valhalla/lworld-values/IllegalByValueTest2.out
>              test/langtools/tools/javac/valhalla/lworld-values/InlineAnnotationTest.java
>              test/langtools/tools/javac/valhalla/lworld-values/InlineAnnotationTest.out
>              test/langtools/tools/javac/valhalla/lworld-values/ValueAnnotationTest.out
>              test/langtools/tools/javac/valhalla/lworld-values/ValueModifierTest.out
>      - This one is an odd man out: (Earlier Number implemented IdentityObject, but not anymore since it is abstract, so it is
>        injected deeper now and surfaces - but this whole express injection is a temporary thing and will go away with
>        JDK-8242612
>          test/langtools/tools/javac/varargs/6806876/T6806876.out
> -------------
> Commit messages:
>   - 8242900: Fix training white spaces
>   - 8242900: Tests for supertypes constraints for inline types
>   - 8242900: [lworld] Allow an inline type to declare a superclass that meets specified restrictions
> Changes: https://git.openjdk.java.net/valhalla/pull/23/files
>   Webrev: https://webrevs.openjdk.java.net/valhalla/23/webrev.00
>    Issue: https://bugs.openjdk.java.net/browse/JDK-8242900
>    Stats: 448 lines in 28 files changed: 397 ins; 11 del; 40 mod
>    Patch: https://git.openjdk.java.net/valhalla/pull/23.diff
>    Fetch: git fetch https://git.openjdk.java.net/valhalla pull/23/head:pull/23
> PR: https://git.openjdk.java.net/valhalla/pull/23

More information about the valhalla-dev mailing list