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

Jim Laskey github.com+63007666+JimLaskey at openjdk.java.net
Thu Apr 23 13:06:28 UTC 2020


On Thu, 16 Apr 2020 11:29:18 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> 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

Marked as reviewed by JimLaskey at github.com (no known OpenJDK username).

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

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



More information about the valhalla-dev mailing list