On Thu, 12 Mar 2026 13:42:30 GMT, David Beaumont <[email protected]> wrote:
> Clone of https://github.com/openjdk/jdk/pull/30110, original description: > > As part of @david-beaumont's work on > https://github.com/openjdk/valhalla/pull/2180, it turned out warnings are > sometimes reported to a wrong file when annotation processors are present, > and, as a consequence, these warnings are not properly suppressed by > @SuppressWarnings. > > The reason is simple: the log.useSource is misplaced, and the source in the > Log may not be correctly reset. The source is correctly reset if tree == > null, which is the normal case without annotation processing. But with > annotation processing combined with implicit compilation, tree != null, and > the source is never reset to the original value. And subsequent diagnostic > then may be assigned to a wrong file. > > This PR is moving setting the source to the correct place. > > Note that for testCorrectSource, there are multiple warnings printed. This is > an pre-existing problem that is sadly harder to fix albeit hopefully with a > smaller severity. I think it would be better tackled separately. I've filled > https://bugs.openjdk.org/browse/JDK-8378950 for it. This pull request has now been integrated. Changeset: 8aada8bd Author: David Beaumont <[email protected]> Committer: Chen Liang <[email protected]> URL: https://git.openjdk.org/valhalla/commit/8aada8bd2b3d1b269cd8e9d0b9529d4425924cec Stats: 166 lines in 2 files changed: 164 ins; 1 del; 1 mod 8379906: [lworld] CLONE - Suppressed warnings reported when implicit compilation is combined with annotation processing Reviewed-by: liach ------------- PR: https://git.openjdk.org/valhalla/pull/2221
