On 19/12/2017 11:42 AM, Paul Sandoz wrote:
Looks good to me.

I am including HS dev for the class file version changes:

http://cr.openjdk.java.net/~psandoz/jdk/JDK-8173382-classfile-version/webrev/
http://cr.openjdk.java.net/~psandoz/jdk/JDK-8173382-classfile-version-build-changes/webrev/

We can push the above patches under the following issue rather that merge into Joe's patch:

https://bugs.openjdk.java.net/browse/JDK-8191913

Hopefully by the next release we can merge together and with less changes required.

Changes seem okay, but I'm still a little concerned about using classfile version 55 before we actually bump the JDK version to 11.

And it still isn't clear to me who will be doing the actual version update and when?

Thanks,
David

Paul.

On 18 Dec 2017, at 17:33, Joseph D. Darcy <joe.da...@oracle.com <mailto:joe.da...@oracle.com>> wrote:

Hello,

A follow-up on defining a final field RELEASE_CURRENT  as an alias for the latest SourceVersion constant to allow easier updating of annotations using SourceVersion constants. Somewht surprisingly, this is not legal Java code; an annotation must use an enum constant directly and not a constant expression which evaluates to an enum constant.

This rules is given in JLS 9.7.1 Normal Annotations:

T [ the element type] is not an array type, and the type of V [the element value] is assignment compatible (§5.2) with T, and:

   If T is a primitive type or String, then V is a constant expression (§15.28).    If T is Class or an invocation of Class (§4.5), then V is a class literal (§15.8.2).
   If T is an enum type (§8.9), then V is an enum constant (§8.9.1).
   V is not null.
https://docs.oracle.com/javase/specs/jls/se9/html/jls-9.html#jls-9.7.1

The wording goes back to JLS 3rd edition which introduced enums and annotations.

Formally, the constant expression concept in JLS 15.28 only applies to primitive types and Strings. Presumably, it would not be too difficult to expand this concept to include class literals and enum constants.

In any case, in the mean time the suggested idiom will not work and the changes of RELEASE_9 => RELEASE_10 will need to stay.

Updated webrev with a minor merge:

   http://cr.openjdk.java.net/~darcy/8173382.3/

Cheers,

-Joe


Reply via email to