JDK 16 RFR of JDK-8235496 : "Start of release updates for JDK 16" and related work

Remi Forax forax at univ-mlv.fr
Sat May 30 12:44:31 UTC 2020


Hi Jim,
the default -> null is not necessary.

Rémi

----- Mail original -----
> De: "Jim Laskey" <james.laskey at oracle.com>
> À: "joe darcy" <joe.darcy at oracle.com>
> Cc: "compiler-dev" <compiler-dev at openjdk.java.net>
> Envoyé: Samedi 30 Mai 2020 14:25:42
> Objet: Re: JDK 16 RFR of JDK-8235496 : "Start of release updates for JDK 16" and related work

> Would it also make sense for readability and consistency to change
> toSourceVersion as well?
> 
>    public static SourceVersion toSourceVersion(Source source) {
>        return  switch(source) {
>        case JDK1_2 -> RELEASE_2;
>        case JDK1_3 -> RELEASE_3;
>        case JDK1_4 -> RELEASE_4;
>        case JDK5   -> RELEASE_5;
>        case JDK6   -> RELEASE_6;
>        case JDK7   -> RELEASE_7;
>        case JDK8   -> RELEASE_8;
>        case JDK9   -> RELEASE_9;
>        case JDK10  -> RELEASE_10;
>        case JDK11  -> RELEASE_11;
>        case JDK12  -> RELEASE_12;
>        case JDK13  -> RELEASE_13;
>        case JDK14  -> RELEASE_14;
>        case JDK15  -> RELEASE_15;
>        case JDK16  -> RELEASE_16;
>        default     -> null;
>        };
>    }
> 
> Cheers,
> 
> -- Jim
> 
> 
> 
>> On May 29, 2020, at 9:07 PM, Joe Darcy <joe.darcy at oracle.com> wrote:
>> 
>> On 5/28/2020 7:26 PM, Joe Darcy wrote:
>>> Before pushing, I'll also update the copyright year.
>>> 
>>> On 5/28/2020 4:10 PM, Jonathan Gibbons wrote:
>>>> Reading the javac parts ...
>>>> 
>>>> 
>>>> http://cr.openjdk.java.net/~darcy/8235496.4/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java.sdiff.html
>>>> 
>>>> The tbd in "15, tbd" should be updated sometime.
>>> 
>>> 
>>> Sure; I'll all a note for "text blocks", as done in SourceVersion.
>>> 
>>> 
>>>> 
>>>> Lines 161-174: why not a switch?
>>> 
>>> 
>>> Hmm. Not sure; the method may date back to the pre-enum days and it wasn't
>>> updated to use a switch. I'm convert it over.
>>> 
>> 
>> Refactored successfully to use an expression switch:
>> 
>> http://cr.openjdk.java.net/~darcy/8235496.5/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java.sdiff.html
>> 
>> Other changes made as well, including update reference JDK 15 build to b25:
>> 
>>     http://cr.openjdk.java.net/~darcy/8235496.5/
>> 
>> Thanks,
>> 
> > -Joe


More information about the compiler-dev mailing list