RFR: 8370800: Downgrade cant.attach.type.annotations diagnostics to warnings [v7]
Liam Miller-Cushon
cushon at openjdk.org
Sun Nov 9 18:30:55 UTC 2025
On Fri, 7 Nov 2025 20:25:46 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:
> I have realized this approach doesn't work for all cases, because there are public APIs that allow accessing type annotations on an `ExecutableElement` that don't result in the underlying `MethodSymbol` getting completed
In particular, `JavacElements#getAllMembers` doesn't complete the elements it returns. `Element#getEnclosedElements` _does_ complete the members it returns, and many annotation processors use `#getEnclosedElements` to get `ExecutableElement`s they process, which partly explains why this was working in many cases.
`getAllMembers` could be updated to do completion, but there may be other paths that return `ExecutableElement`s that would need similar updates, the way that methods that return or operate on class symbols all ensure the class has been completed.
in general I'm still unsure if using the completion mechanism for `MethodSymbol` is an acceptable approach.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28018#issuecomment-3508660661
More information about the compiler-dev
mailing list