Redo of backport of JDK-8225377 (type annotations are not visible to javac plugins across compilation boundaries)

Werner Dietl wdietl at gmail.com
Thu Aug 1 16:31:10 UTC 2024


I would also be very happy if this were backported to earlier JDKs.
The pluggable type system frameworks I work on mostly have work-arounds for
this issue, but it would be much nicer to have correct type-use annotation
information from javac directly.
I also agree with Chris's comment on having a positive feedback loop. Any
positive change has some danger of breaking existing code. This shouldn't
stop us from fixing bugs, improving the type-use annotation infrastructure,
and enabling more adoption.

Best,
cu, WMD.

On Mon, Jul 29, 2024 at 11:22 AM Chris Povirk <cpovirk at google.com> wrote:

> Manu spoke about the ability to annotate different positions (e.g.,
> type-parameter bounds) for improved nullness checking. I'd also call out
> that this affects even users who use nullness annotations on "basic"
> locations like fields, parameters, and return types: Unless tools use
> internal javac APIs, type-use annotations in even these basic locations in
> class files are invisible until JDK 22. (And as Josiah points out, this
> affects more tools than just "nullness checkers." We've also seen it with
> AutoValue
> <https://github.com/google/auto/blob/main/value/userguide/index.md>.)
> This means that type-use annotations are worse than declaration annotations
> in some ways, even as they're better in others. As a result, users can't
> confidently pick even a set of nullness annotations without evaluating the
> tradeoffs. It would be great to be able to tell users "Use type-use
> annotations" without waiting for them all to update to JDK 22.
>
> Plus: Even if the fix is backported today, experience shows that users
> will also have to wait for some annotation processors to be enhanced to
> start looking for type-use annotations _at all_. I'd be happy to see us
> continue to drive that positive feedback loop: As type-use annotations
> become more visible to annotation processors, tools increasingly get
> modified to recognize them, leading to more adoption of type-use
> annotations and more opportunity to identify and iron out remaining
> wrinkles.
>
> Thanks,
> Chris
>


-- 
https://ece.uwaterloo.ca/~wdietl/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20240801/bb2929e3/attachment-0001.htm>


More information about the compiler-dev mailing list