<div dir="ltr"><div dir="ltr"><div dir="ltr">On Fri, Jan 10, 2025 at 1:49 AM Jan Lahoda <<a href="mailto:jan.lahoda@oracle.com" target="_blank">jan.lahoda@oracle.com</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  
  <div><p>I And
      the "lint" here is the "global" Lint instance, that (AFAIK) never
      suppresses anything. I.e. the condition in the "if" statement is
      always true, I believe.</p></div></blockquote><div>The root Lint instance doesn't include any <span style="font-family:monospace">@SuppressWarnings</span> suppressions but it does include suppressions from command line flags like <span style="font-family:monospace">-Xlint:-preview</span>, so the "if" statement can be false.</div><div><br></div><div>Upon further analysis it appears that this doesn't matter - except in the case of <span style="font-family:monospace">PREVIEW_REFLECTIVE</span> - because otherwise the code that emits the warning also explicitly invokes <span style="font-family:monospace">preview.markUsesPreview(pos)</span>. See here: <a href="https://github.com/openjdk/jdk/blob/beb0e607d3b66b9e97c263cd8f2e23f447ebfc50/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java#L3827-L3838" target="_blank">Check.java</a>.</div><div><br></div><div>So I'm still unsure whether there is a bug. I thought the test below would trigger that <span style="font-family:monospace">PREVIEW_REFLECTIVE</span> code branch and generate a classfile that erroneously does NOT have the <span style="font-family:monospace">0xffff</span> minor version, but it doesn't:</div><div><br></div><div style="margin-left:40px"><span style="font-family:monospace">$ cat PreviewTest.java <br>import <a href="http://java.io.IO">java.io.IO</a>;<br>public class PreviewTest {<br>    public static void main(String[] args) {<br>        IO.println("OK");       // preview API<br>    }<br>}<br>$ javac -version<br>javac 25-internal<br>$ javac -d classes --enable-preview --release 25 -Xlint:-preview PreviewTest.java<br>Note: PreviewTest.java uses preview features of Java SE 25.<br>Note: Recompile with -Xlint:preview for details.</span></div><div style="margin-left:40px"><span style="font-family:monospace">$</span><span style="font-family:monospace"> file classes/PreviewTest.class<br></span></div><div style="margin-left:40px"><span style="font-family:monospace">classes/PreviewTest.class: compiled Java class data, version 69.65535</span></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">-Archie</div><div class="gmail_quote"><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>
</div>