<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex, thanks for the Q&A's we have had! Looking at the history, I get one more question about reflective preview APIs:<br>
<br>
Per JEP 12, reflective preview APIs do not allow preview features to be used; rather, they allow programs compiled without preview to run correctly in a Java Runtime Environment running with preview features enabled.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I just reviewed the preview APIs introduced for Value Objects JEP: it has a few, such as IdentityException, Objects.requireIdentity, that perform inspection on object instances but are not marked as reflective. I believe they should be marked reflective, as
they are critical for non-preview programs to run correctly when preview is enabled (when they can receive value objects, and JVM can throw IdentityException for certain bytecode instructions). Meanwhile, the constructor for IdentityException are all essential
preview APIs - they are necessary for the Value Objects feature, but not for non-preview programs to run correctly when preview features are enabled.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is my rationale for categorizing reflective vs essential preview APIs correct? In particular, can inspection on object instances via getClass() be considered reflection as well?</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards, Chen</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Alex Buckley <alex.buckley@oracle.com><br>
<b>Sent:</b> Monday, April 21, 2025 12:26 PM<br>
<b>To:</b> Chen Liang <chen.l.liang@oracle.com>; valhalla-dev@openjdk.org <valhalla-dev@openjdk.org>; compiler-dev@openjdk.org <compiler-dev@openjdk.org><br>
<b>Subject:</b> Re: Preview features and class file formats</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 4/21/2025 9:20 AM, Chen Liang wrote:<br>
> That said, I wish to come back to the non SourceVersion/ <br>
> ClassFileFormatVersion-aware query methods - should they just return the <br>
> behavior when preview is enabled in the current release even when <br>
> preview is not enabled?<br>
<br>
I thought we had agreed that if version-sensitive query methods can only <br>
be made aware of "25", not "25 with preview enabled", then their results <br>
should indicate the permanent behavior of 25 _regardless of whether the <br>
Java runtime was started with --enable-preview_.<br>
<br>
> Coming back to the JEP 12 example of reserving _ as a keyword, the <br>
> SourceVersion.isIdentifier API will return false for _ in an <br>
> implementation of Java SE 8, regardless if the runtime has preview <br>
> features enabled or not, instead of only declaring that _ is not an <br>
> identifier when preview is enabled <br>
<br>
That's tricky because _ in 8 caused a warning but was technically legal. <br>
We knew there would be code compiled and run on 8 for many years, and <br>
did not wish to break it. _ only caused an error in 8 with <br>
--enable-preview. So, consistent with my cautious position above, <br>
SourceVersion.isIdentifier("_") would have returned true on an 8 runtime <br>
_regardless of whether the runtime was started with --enable-preview_.<br>
<br>
Alex<br>
</div>
</span></font></div>
</body>
</html>