On Tue, 23 Sep 2025 21:02:03 GMT, Pavel Rappo <[email protected]> wrote:
> While I've read the CSR, I haven't read any compiler-dev thread(s). At least > not carefully. I also haven't seen the diff. FWIW there is a discussion thread (starting [here](https://mail.openjdk.org/pipermail/compiler-dev/2024-November/028573.html)), but it's been on/off since November 2024. > IIUC, this annotation can be applied to itself: > `@SupressWarnings("suppression")`. Has the scope of `@SupressWarnings` always > included the annotation itself, or it's something that you had to tweak in > this PR? Astute question :) In general, it's completely up to the particular warning. The scope can even extend _before_ the annotation; this is the case with `"dangling-doc-comments"` (see #24600). But normally the "scope" of a declaration includes any annotations on that declaration, simply because the start position of the declaration includes them (the annotations are part of the declaration, not a separate prior thing). Regarding exactly how "it's completely up to the particular warning": Since #26138, the `DiagnosticPosition` class now has a `getLintPosition()` property. This allows the caller to specify any arbitrary source code position at which to define which `@SuppressWarnings` annotations apply to the warning. Search for `withLintPosition()` to see a couple of uses of it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25167#issuecomment-3325592697
