Test failure using Java SE EG TCK

Alex Buckley alex.buckley at oracle.com
Tue Mar 10 16:09:06 UTC 2020


The v58.65535 class file version indicates that the tests' class files 
depend on preview features. I suspect the tests' source code refers to 
API elements associated with records, a preview feature in Java SE 14.

The key thing to know is that Foo.java may refer to reflective APIs 
which understand/support a preview feature (such as javax.lang.model.*) 
_without_ Foo.class depending on preview features. This was a goal of 
JEP 12 in order to allow popular libraries to use SE APIs to reflect 
over class files which depend on preview feature, without forcing the 
libraries' own class files to depend on preview features too [1].

On the other hand, if Foo.java refers directly to `java.lang.Record`, 
then Foo.class must be marked as depending on preview features. If 
Foo.java is a JCK test, then that marking is undesirable, and the source 
code has to refer to `java.lang.Record` indirectly, via a `Class` object.

I'm not sure how JCK test feedback is handled, but I recommend that the 
JCK team look again at which API elements the tests are referring to.

Alex

[1] http://openjdk.java.net/jeps/12#Relationship-to-Java-SE-APIs

On 3/10/2020 5:54 AM, Simon Ritter wrote:
> Hi,
> we have been using the JCK test suite available to the Java SE EG
> through the Java Partner Login.  When using the FCS version (build 14,
> dated 03/04/2020) we get the following failure.
> 
> Who would be the best people to forward this to so that we can ensure
> this either resolved or excluded for the JCK of Java SE 14 GA?
> 
> Regards,
> 
> Simon.
> 
>      Test Challenger Name and Company: Azul Systems, Inc.
> 
>      Specification Name(s) and Version(s): Java Platform SE 14 API
>      Specification
> 
>      Test Suite Name and Version: JCK-compiler-14
> 
>      Exclude List Version: n/a
> 
>      Tests Names:
> 
>      api/javax_lang/model/element/TypeElement/GetRecCompDefault.html
>      api/javax_lang/model/util/SimpleElementVisitor14/SEVRecComp.html
>      api/javax_lang/model/util/ElementKindVisitor14/EKVRecord14.html
>      api/javax_lang/model/util/ElementScanner14/ScanExecutableParams_Preview.html
>      api/javax_lang/model/util/ElementKindVisitor6/EKVRecord.html
>      api/javax_lang/model/util/ElementFilter/EFRecComp.html
>      api/javax_lang/model/util/ElementScanner14/ScanTypeParams_Preview.html
>      api/javax_lang/model/element/RecordComponentElement/GetSimpleName.html
>      api/javax_lang/model/util/ElementFilter/EFRecComp1.html
>      api/javax_lang/model/util/ElementKindVisitor14/EKVBindingVar.html
>      api/javax_lang/model/util/ElementScanner14/ESRecordComponent.html
>      api/javax_lang/model/element/TypeElement/GetRecComponents.html
>      api/javax_lang/model/element/Element/GetEnclosedElements.html
>      api/javax_lang/model/util/ElementKindVisitor6/EKVBindingVar.html
>      api/javax_lang/model/element/RecordComponentElement/GetEnclosingElement.html
>      api/javax_lang/model/util/ElementKindVisitor14/EKVRecordComponent.html
>      api/javax_lang/model/element/RecordComponentElement/GetAccessor.html
>      api/javax_lang/model/util/AbstractElementVisitor14/AEVRecComp.html
> 
>      Complaint (argument for why test is invalid):
>      All tests in challenge fail being run by Java 14 Reference
>      Implementation with the message shown in the next section.
>      Several classes in the compiler suite have been built using javac of
>      the different version than 14-GA which blocks test class loading by
>      javasoft.sqe.jck.lib.javax.annotation.processing.ProcessorMultiTestWrapper.
>      javap shows minor version 65535 for these classes and minor version
>      0 for all other classes.
> 
>      Error message:
>      Class linking error while trying to load test class "...":
>      java.lang.UnsupportedClassVersionError: Preview features are not
>      enabled for ... (class file version 58.65535).
> 
>      Quick demo:
>      $ jdk-14.jdk/Contents/Home/bin/javap -verbose
>      JCK-compiler-14/classes/javasoft/sqe/tests/api/javax/lang/model/element/TypeElement/GetRecCompDefaultTests.class
>      | grep version
>        minor version: 65535
>        major version: 58
> 


More information about the java-se-spec-experts mailing list