Skip to content

Fix PropertySetter handling of TYPE_USE nullable - #2112

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_960135243
Aug 10, 2026
Merged

Fix PropertySetter handling of TYPE_USE nullable#2112
copybara-service[bot] merged 1 commit into
mainfrom
test_960135243

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Fix PropertySetter handling of TYPE_USE nullable

javac has a bug (https://bugs.openjdk.org/browse/JDK-8389859) where annotations
that target both TYPE_USE and declaration targets only appear on the
declaration if the type use is a type variable. This doesn't happen for other
non-type variable type uses, or annotations that are exclusively targeting
TYPE_USE.

For example in <T> void f(@Nullable T t) {} javac will not report the
annotation as being on the parameter's TypeMirror, just the Element.

In AutoBuilder, PropertySetter was checking the AnnotatedTypeMirror#getType
for TYPE_USE annotations, which was incorrectly checking the derived type
created by asMemberOf that removes type annotations, instead of checking
AnnotatedTypeMirror#annotations. The path that actually printed the type was
using AnnotatedTypeMirror#annotations.

RELNOTES=n/a

javac has a bug (https://bugs.openjdk.org/browse/JDK-8389859) where annotations
that target both `TYPE_USE` and declaration targets only appear on the
declaration if the type use is a type variable. This doesn't happen for other
non-type variable type uses, or annotations that are exclusively targeting
`TYPE_USE`.

For example in `<T> void f(@nullable T t) {}` javac will not report the
annotation as being on the parameter's `TypeMirror`, just the `Element`.

In AutoBuilder, PropertySetter was checking the `AnnotatedTypeMirror#getType`
for `TYPE_USE` annotations, which was incorrectly checking the derived type
created by `asMemberOf` that removes type annotations, instead of checking
`AnnotatedTypeMirror#annotations`. The path that actually printed the type was
using `AnnotatedTypeMirror#annotations`.

RELNOTES=n/a
PiperOrigin-RevId: 961970022
@copybara-service
copybara-service Bot merged commit 383ff77 into main Aug 10, 2026
@copybara-service
copybara-service Bot deleted the test_960135243 branch August 10, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant