-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AutoFactory generated code is mis-annotating parameters #949
Labels
Comments
wesalvaro
changed the title
I have a different (perhaps larger) issue although I'm surprised hasn't come up...
AutoFactory generated code is mis-annotating parameters
Jan 7, 2021
copybara-service bot
pushed a commit
that referenced
this issue
Jan 8, 2021
Treating them the same as other annotations leads to problems with nested types like `Map.Entry`. If a field or parameter is a `Map.Entry` that is `@Nullable`, and if `@Nullable` is a `TYPE_USE` annotation, then the declaration must use `Map.@nullable Entry`. JavaPoet will do this correctly if the annotations are applied to the `TypeName` for the declaration. Also ensure that type annotations are included in the `T` of `Provider<T>` when that appears in field or parameter declarations. Fixes #949. RELNOTES=AutoFactory type annotations are now placed correctly even for nested types. PiperOrigin-RevId: 350804805
copybara-service bot
pushed a commit
that referenced
this issue
Jan 8, 2021
Treating them the same as other annotations leads to problems with nested types like `Map.Entry`. If a field or parameter is a `Map.Entry` that is `@Nullable`, and if `@Nullable` is a `TYPE_USE` annotation, then the declaration must use `Map.@nullable Entry`. JavaPoet will do this correctly if the annotations are applied to the `TypeName` for the declaration. Also ensure that type annotations are included in the `T` of `Provider<T>` when that appears in field or parameter declarations. Fixes #949. RELNOTES=AutoFactory type annotations are now placed correctly even for nested types. PiperOrigin-RevId: 350804805
copybara-service bot
pushed a commit
that referenced
this issue
Jan 9, 2021
Treating them the same as other annotations leads to problems with nested types like `Map.Entry`. If a field or parameter is a `Map.Entry` that is `@Nullable`, and if `@Nullable` is a `TYPE_USE` annotation, then the declaration must use `Map.@nullable Entry`. JavaPoet will do this correctly if the annotations are applied to the `TypeName` for the declaration. Also ensure that type annotations are included in the `T` of `Provider<T>` when that appears in field or parameter declarations. Fixes #949. RELNOTES=AutoFactory type annotations are now placed correctly even for nested types. PiperOrigin-RevId: 350804805
Thank you for the quick fix! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using the Checker Framework's
TYPE_USE
Nullable annotation,AutoFactory is generating code that changes the scoping (?) of the inner-class which causes the annotation to be placed in the wrong location.
The above seems to be generating:
Because the build dies with this error:
Why isn't the generated code using the same scoping setup as the source?
Issue #732 may be related?
The text was updated successfully, but these errors were encountered: