JDK 16 RFR of JDK-8235496 : "Start of release updates for JDK 16" and related work
James Laskey
james.laskey at oracle.com
Sat May 30 22:27:17 UTC 2020
+1 though Rémi pointed the default with null is unnecessary (all cases covered.)
> On May 30, 2020, at 7:21 PM, Joe Darcy <Joe.Darcy at oracle.com> wrote:
>
> Hi Jim and Rémi,
>
> I updated the webrev in place for the second refactored switch:
>
> http://cr.openjdk.java.net/~darcy/8235496.5/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java.sdiff.html
>
> While I double-checked that all the enum constants were present, javac gave me a compilation error without the "default -> null" code so I left it in; although I don't think it should be necessary.
>
> Thanks,
>
> -Joe
>
>> On 5/30/2020 5:44 AM, Remi Forax wrote:
>> 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