<div dir="ltr"><div>I have a question about preview and classfile minor versions.</div><div><br></div><div>In <span style="font-family:monospace">Preview.java</span> there is this:</div><div><br><span style="font-family:monospace">    /**<br>     * Report usage of a preview feature. Usages reported through this method will affect the<br>     * set of sourcefiles with dependencies on preview features.<br>     * @param pos the position at which the preview feature was used.<br>     * @param feature the preview feature used.<br>     */ <br>    public void warnPreview(DiagnosticPosition pos, Feature feature) {<br>        Assert.check(isEnabled());<br>        Assert.check(isPreview(feature));<br>        if (!lint.isSuppressed(LintCategory.PREVIEW)) {<br>            <span style="background-color:rgb(255,255,0)"><b>sourcesWithPreviewFeatures.add(log.currentSourceFile());</b></span><br>            previewHandler.report(pos, feature.isPlural() ?<br>                    LintWarnings.PreviewFeatureUsePlural(feature.nameFragment()) :<br>                    LintWarnings.PreviewFeatureUse(feature.nameFragment()));<br>        }<br>    }</span><br></div><div><br></div><div>The highlighted line causes the written classfile to have minor version <span style="font-family:monospace">0xffff</span>, which triggers a preview warning at runtime.<br></div><div><br></div><div>That makes sense, but what I don't understand is: Why is that line inside the IF statement, instead of before it (i.e., always executed)?</div><div><br></div><div>It seems (to me) like the behavior of the generated classfile at runtime should not depend on how you've configured warning suppression at compile time.<br></div><div><br></div><div>At least, it seems like <span style="font-family:monospace">--enable-preview</span> would be a better candidate for controlling the classfile minor version in this case... or perhaps some new flag.<br></div><div><br></div><div>Thanks for any insights.</div><div><br></div><div>-Archie<br></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Archie L. Cobbs<br></div></div>