review comments for JEP 12: Preview Language and VM Features JDK-8195734

Alex Buckley alex.buckley at oracle.com
Mon Dec 10 20:41:44 UTC 2018


On 12/10/2018 12:26 PM, Harold David Seigel wrote:
> On 12/10/2018 3:00 PM, Alex Buckley wrote:
>> 3. The wording of the logging output is "Loading preview feature type
>> $NAME". That sounds like the type is part of the preview feature,
>> i.e., involved in supporting the preview feature, e.g., the
>> java.lang.AutoCloseable type if the try-with-resources statement had
>> been a preview feature. The word "type" also seems unusually abstract
>> for logging output. Recommend "Loading class file that depends on
>> preview features: $NAME", or, if it's redundant to say "Loading class
>> file" in a log about class loading, then "$NAME depends on preview
>> features of Java SE $RELEASE_THAT_CORRESPONDS_TO_MAJOR_VERSION"
>
> We don't know if the class file actually depends on the preview
> features, just that it was compiled with 65535.  So, how about:
>
>     "Loading class file that is enabled for preview features: $NAME" ?

Per JEP 12, "A class file denotes that it depends on the preview VM 
features of Java SE $N by having a major_version item that corresponds 
to Java SE $N and a minor_version item that has all 16 bits set." 
What's actually in the code array is immaterial.

We already speak of enabling preview features in the Java compiler / JVM 
implementation, so it would be confusing to have an individual class 
file that "enabled" anything. (Would the file auto-enable the preview 
features of the compiler/runtime even if --enable-preview hadn't been 
passed?)

That said, it would be useful to draw attention to the class file 
version: "Class $NAME depends on preview features (class file version 
$MAJOR_VERSION.65535)"

Alex


More information about the jdk-dev mailing list