-
Notifications
You must be signed in to change notification settings - Fork 354
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
Support AutoOneOf #3775
Comments
I am also interested in any short-term workarounds. My current project is to enable checkerframework by default throughout the project and suppress at the class level (rather than the module level), so that fixing up individual classes can be starter bugs. |
The public boolean equals(@Nullable MyClass other) { ... } It seems the problem is that AutoValue isn't generating the Is that your analysis of the problem as well? Here are some ideas, off the cuff. Maybe other people can come up with better ideas. Things you could do:
Things the Checker Framework could do, to support cases like this where source code is compiled by the Checker Framework but for some reason the programmer is unable to edit the source code.
|
Yes, my analysis of the issue matches yours. I notice that AutoValue generates Thank you for the suggestion of Separately, it does make sense for |
I don't know why AutoValue-generated code would typecheck without If AutoValue already uses |
I figured out why we did not hit errors in AutoValue-generated classes: apache/beam@1742154 :-) As for Nullable in AutoValue: the framework uses Nullable annotations to guide their code gen (doing the necessary runtime checks) and propagates the user's annotations. But I think the problem is in this case they would need to synthesize a Nullable annotation. The ecosystem of annotations is splintered enough that there may be an issue with choosing which annotation to insert since the I believe that this ticket is probably not worth tracking in light of the fact that my project already uses |
AutoOneOf
is a very nice autovalue extension for creating tagged unions in Java. It seems that it does not "just work" with checkerframework.I have saved a repo to reproduce:
The repo is configured to use checkerframework 3.5.0. I have upgraded to 3.7.0 and the result is the same.
This will produce a number of crashes in Checkerframework (which I will file next), but also:
I have not found any way to annotate
FieldAccessDescriptor.FieldDescriptor.Qualifier
(the abstract base for theAutoOneOf
) to make this work or to suppress the nullness checker temporarily.The text was updated successfully, but these errors were encountered: