Question about preview and classfile versions

Archie Cobbs archie.cobbs at gmail.com
Mon Jan 13 14:34:13 UTC 2025


Hi Maurizio,

On Mon, Jan 13, 2025 at 6:56 AM Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:

> It seems to be that:
>
> * Lint::isEnabled correctly reflects the command line flags
> * Lint::isSuppressed does not
>
> As such, isEnabled is correctly used in the constructor of Preview, to set
> the value of MandatoryWarningHandler::verbose.
>
> But the isSuppressed check in Preview::warnPreview seems redundant,
> because no suppression will ever be found this way.
>
> IMHO, Preview should not hold on to Lint after it uses it to initialize
> the MandatoryWarningHandler. The suppressions checks, where possible,
> should be left to clients (as code in Check etc. will be in a better
> position to know which Lint to actually use).
>
> Alternalively, warnPreview could take a Lint as well, but then we'd have
> to think about how to model cases where no meaningful Lint exists (Scanner
> and Parser).
>

Thanks for confirming all of the above.

I'm working on some cleanups in this area (pr #23056) and will include your
suggested simplification to Preview.java.

-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250113/286b588f/attachment.htm>


More information about the compiler-dev mailing list