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

Consider adopting NullAway into the build process #1680

Open
trustin opened this issue Mar 26, 2019 · 6 comments
Open

Consider adopting NullAway into the build process #1680

trustin opened this issue Mar 26, 2019 · 6 comments
Labels

Comments

@trustin
Copy link
Member

trustin commented Mar 26, 2019

See: https://github.com/uber/NullAway

@anuraaga
Copy link
Collaborator

anuraaga commented Jun 2, 2020

Ah yeah now I remember this issue. Seems NullAway is a faster but potentially less precise checker good enough for almost all cases. But can't find any good resource listing out what cases it misses vs checker framework. Do you have any idea?

@trustin
Copy link
Member Author

trustin commented Jun 2, 2020

No. 😄 I didn't take a close look at all. IIRC JetBrains had some contract annotations, too. Not sure which is the best 🤔

@ikhoon
Copy link
Contributor

ikhoon commented Jun 4, 2020

I tried to test and compare NullAway and the Checker Framework.

The Checker Framework - It does not support Java 13 yet.

> org.checkerframework.javacutil.UserError: 
The Checker Framework cannot be run with JDK 13+.  You are using version 13. Please use JDK 8 or JDK 11.

So I don't think we need to go any further now.

NullAway

It produces some useful error messages. But it could not cover all of our null checking code.
For example, it does not recognize null checking in checkArgument(). uber/NullAway#47

checkArgument(value != null, "unknown session protocol: ", uriText);
return value;

SerializationFormat.java:131: error: [NullAway] returning @Nullable expression from method with @NonNull return type

I am not sure that we can put NullAway into the build process.
Anyway, I am going to make a PR to fix True Positive errors detected by NullAway. 😀

@anuraaga
Copy link
Collaborator

anuraaga commented Jun 5, 2020

@ikhoon Since checker framework also can't be run together with error prone from what I understand, we'd have two builds anyways, and I guess with some configuration tweaks that could be set to Java 11. Probably not worth the trouble though, but I'm curious whether checker framework would catch checkArgument. Do you have a branch I can play with (or you can try playing with Java 11? :D)

@ikhoon
Copy link
Contributor

ikhoon commented Jun 5, 2020

Since checker framework also can't be run together with error prone from what I understand,

It looks resolved in Error Prone 2.4.0
https://github.com/kelloggm/checkerframework-gradle-plugin#incompatibility-with-error-prone

Do you have a branch I can play with (or you can try playing with Java 11? :D)

Yeah, let me push the branch tested locally.

@ikhoon
Copy link
Contributor

ikhoon commented Jun 5, 2020

ikhoon added a commit to ikhoon/armeria that referenced this issue Jun 5, 2020
Motivation:

Before adopting NullAway(line#1680) or other static analysis tools.
Manually run it and clean up errors.

Modifications:

- Fix all true positives reported by NullAway

Result:

Less NullAway errors
trustin pushed a commit that referenced this issue Jun 8, 2020
Motivation:

Before adopting NullAway(#1680) or other static analysis tools.
Manually run it and clean up errors.

Modifications:

- Fix all true positives reported by NullAway

Result:

Less NullAway errors
fmguerreiro pushed a commit to fmguerreiro/armeria that referenced this issue Sep 19, 2020
Motivation:

Before adopting NullAway(line#1680) or other static analysis tools.
Manually run it and clean up errors.

Modifications:

- Fix all true positives reported by NullAway

Result:

Less NullAway errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants