<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
This is unrelated to the discussion of bumping the minimum version
to JDK 21, since we can already use switch expressions (they were
added in JDK 14, which is below the current minimum of JDK 17).<br>
<br>
I recommend starting a new thread if you would like to discuss
this.<br>
<br>
-- Kevin<br>
<br>
<br>
<div class="moz-cite-prefix">On 2/20/2024 8:16 AM, Andy Goryachev
wrote:<br>
</div>
<blockquote type="cite" cite="mid:BL3PR10MB6185642E6900856B4A6F27A4E5502@BL3PR10MB6185.namprd10.prod.outlook.com">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}@font-face
{font-family:"Iosevka Fixed SS16";
panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
{font-family:"Times New Roman \(Body CS\)";
panose-1:2 11 6 4 2 2 2 2 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Iosevka Fixed SS16";
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">+1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">I
would like to put forth an opinion that we should NOT use
non-comprehensive switch expressions over enums, as they
introduce a major incompatibility when evolving that enum
(i.e. when adding new values).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Consider
this:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"" lang="DE">enum E { A, B }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"" lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"" lang="DE">E e;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"" lang="DE">switch(e) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">case
A -> "a";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">case
B -> "b";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">evolving
to<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">enum
A { A, B, C };<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">previously
comprehensive switch expression explodes.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">From:
</span></b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">openjfx-dev
<a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev-retn@openjdk.org"><openjfx-dev-retn@openjdk.org></a> on behalf of
Kevin Rushforth <a class="moz-txt-link-rfc2396E" href="mailto:kevin.rushforth@oracle.com"><kevin.rushforth@oracle.com></a><br>
<b>Date: </b>Friday, February 16, 2024 at 14:12<br>
<b>To: </b>openjfx-dev
<a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Proposal: Bump minimum JDK version
for JavaFX 23 to JDK 21<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt">All,<br>
<br>
Even though we build JavaFX binaries with JDK 21 as
the boot JDK, the <br>
latest version of JavaFX still runs with JDK 17,
although it isn't <br>
tested with older JDK versions. In order for JavaFX to
be able to use <br>
newer JDK features, such as code snippets (in API
docs), record <br>
patterns, pattern matching for switch statements, and
so forth, we need <br>
to increase the minimum version of the JDK that can
run the latest <br>
JavaFX. Additionally, there is an ongoing cost to
keeping JavaFX <br>
buildable and runnable on older versions of Java, and
very little reason <br>
to continue to do so.<br>
<br>
A question was raised [1] as to whether we should go
even further and, <br>
once JDK 22 is released, jump straight to JDK 22 as a
minimum. While we <br>
could do that, I feel that there isn't sufficient
justification for this <br>
at this time, although we could reconsider for next
release.<br>
<br>
To this end, I propose to bump the minimum version of
the JDK needed to <br>
run JavaFX 23 to JDK 21. I filed JDK-8321603 [2] to
track this and <br>
prepared PR #1370 [3] (I've moved the PR back to
Draft, pending this <br>
discussion). This will not affect update releases of
earlier versions of <br>
JavaFX (e.g., JavaFX 21.0.NN or JavaFX 17.0.NN), which
will continue to <br>
run with the same minimum JDK that they run on today.<br>
<br>
As a reminder, we only assure that JavaFX NN will run
with JDK NN-1 or <br>
later, although in practice, we don't bump the minimum
required JDK <br>
version without a good reason. For example, while
JavaFX 22 is built <br>
using JDK 21 as the boot JDK, it produces class files
that will run with <br>
JDK 17, using "--release 17". The proposed change
discussed here would <br>
update that in JavaFX 23 to "--release 21".<br>
<br>
NOTE: this will not be an invitation to do wholesale
refactoring of <br>
existing classes or methods to use newer language
features (e.g., a PR <br>
that refactors existing switch statements and switch
expressions into <br>
pattern-matching switch expressions would not be
welcome). Rather, this <br>
can be seen as enabling judicious use of new features
in new code, much <br>
as we did when we started allowing the use of "var",
records, and <br>
pattern-matching instanceof.<br>
<br>
Comments are welcome.<br>
<br>
-- Kevin<br>
<br>
[1] <a href="https://mail.openjdk.org/pipermail/openjfx-dev/2023-December/044081.html" moz-do-not-send="true" class="moz-txt-link-freetext">
https://mail.openjdk.org/pipermail/openjfx-dev/2023-December/044081.html</a><br>
[2] <a href="https://bugs.openjdk.org/browse/JDK-8321603" moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8321603</a><br>
[3] <a href="https://github.com/openjdk/jfx/pull/1370" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/openjdk/jfx/pull/1370</a><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>