RFR: 8370800: Downgrade cant.attach.type.annotations diagnostics to warnings [v7]
Liam Miller-Cushon
cushon at openjdk.org
Fri Nov 7 20:28:02 UTC 2025
On Thu, 6 Nov 2025 11:32:34 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:
>> Hi, please consider this fix for [JDK-8370800: Downgrade cant.attach.type.annotations diagnostics to warnings](https://bugs.openjdk.org/browse/JDK-8370800).
>>
>> As discussed in the, this reduces the compatibility impact of these diagnostics for builds that deliberately omit transitive annotation dependencies, for example if they are only referenced through javadoc `@link` tags, or by frameworks that conditionally load the classes.
>>
>> The PR changes the existing error diagnostic to an unconditional warning. Another alternative would be to make it an optional xlint diagnostic, perhaps as part of `-Xlint:classfile`, or as another category.
>
> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
>
> Adjust tests
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. It would be possible to fix that by ensuring that methods like `MethodSymbol#asType` call `complete()`.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28018#issuecomment-3504775392
More information about the compiler-dev
mailing list