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.

Marked as reviewed by liach (Committer).

-------------

PR Review: 
https://git.openjdk.org/valhalla/pull/2221#pullrequestreview-3936789380

Reply via email to