Skip to content
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 @MonotonicNonNullDecl by default as an excluded field annotation #93

Open
chengniansun opened this issue Dec 21, 2017 · 5 comments

Comments

@chengniansun
Copy link

Do you plan to support @MonotonicNonNullDecl? Recently I added this annotation to guava (https://github.com/google/guava/blob/master/guava/src/com/google/common/reflect/TypeToken.java#L105)

Or more generally, do you support the nullness annotations of the checker framework?

@msridhar
Copy link
Collaborator

We can easily support interpreting the CF annotations as best as possible within the (less sophisticated) NullAway type system. Actually enhancing the power of the type system would be more work and would require some further justification in terms of additional reliability in practice, etc.

For this one, I think by default we would just treat the field as @NonNull. Are you looking for deeper support than that?

@msridhar
Copy link
Collaborator

Ah, I see. You're probably looking to not see reports of initialization errors on such fields, yes? If so, that can easily be handled using the -XepOpt:NullAway:ExcludedFieldAnnotations option (see here).

@chengniansun
Copy link
Author

For this one, should we treat it in the following way,

If a field $f$ annotated with @monotonicnonnulldecl is not initialized in a constructor, NullAway does not emit a warning saying that " initializer method does not guarantee @nonnull fields f is initialized along all control-flow paths"

I am currently focusing on eliminating all warnings on uninitialized fields.

@msridhar
Copy link
Collaborator

Yeah, for now you can handle this by passing -XepOpt:NullAway:ExcludedFieldAnnotations=MonotonicNonNullDecl as an Error Prone / javac argument. For CF compatibility we should probably bake in support for this annotation.

@chengniansun
Copy link
Author

Neat. Thank you.

@msridhar msridhar changed the title Do you plan to support @MonotonicNonNullDecl Support @MonotonicNonNullDecl by default as an excluded field annotation Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants