-
Notifications
You must be signed in to change notification settings - Fork 291
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
Discrepancy in expected Nullness checks when upgrading from v0.8.0 to v0.9.+ #635
Comments
Thanks for the report! I assume all these tests are with Guava 31.x? Regarding examples 3 and 4, these work as expected since NullAway does not support For Example 1, can you try passing the newly added config flag Line 45 in a8051cd
I think that may fix the problem; let us know. We are planning to default this flag to |
Possible to update the Configuration documentation here? |
Sure, it's updated: https://github.com/uber/NullAway/wiki/Configuration#acknowledge-library-models-of-annotated-code Sorry for not doing it before the release. |
No worries - we really appreciate the feature! Also I think this is related and likely can be closed now. |
Thanks a lot for linking #453! There is some history here that I had forgotten. We should think more carefully about how exactly this new flag should interact with inheritance and write some tests around that. Once we figure that out we can close the issues. /cc @lazaroclapp |
Agreed! (And sorry to see we kinda dropped the ball on that issue!) I actually ran into this due to our test suite (not that issue specifically, but rather #445) when working to remove p.s. If we do remove |
@holtherndon-stripe @rwinograd FYI, in just-released NullAway 0.9.10, the @holtherndon-stripe are we ok to close out this issue now? |
If you think you found a bug, please include a code sample that reproduces the problem. A test case that reproduces the issue is preferred. A stack trace alone is ok but may not contain enough context for us to address the issue.
Please include the library version number, including the minor and patch version, in the issue text.
Current Production Version of NullAway: v0.8.0
Attempting to move to NullAway: v0.9.9
Tests performed on NullAway: v0.9.0 and v0.9.9 (with same result)
Errorprone Version: 2.4.0
Bazel Version: 5.0.0
We are currently trying to migrate to v0.9.9 so we can upgrade our Guava version (see: #628), however, when we attempted to upgrade, we got the follow error message from Bazel:
On the code:
After digging for a while, I was able to pin the issue down to us including
com.google.common
in ourAnnotatedPackages
flag - after removing it, it worked. However, that removed NullAway's ability to check against Guava's annotations. I wasn't able to find where in NullAway this discrepancy was occurring, but I was able to put together a set of tests that have contradicting results.Thanks in advance! 😄
Reproducing code samples in test format:
Example 1: This example fails, however, we are checking
a
's NullnessStrings.isNullOrEmpty
- this works as expected in v0.8.0, but fails in v0.9.+. This is the issue we ran into in CI while trying to upgrade.Example 2: This example passes, however, we've removed
com.google.common
as a properly annotated package.The following two examples are synthetic examples to show the discrepancy.
Example 3: This example passes, but should fail. Without
com.google.common
as a properly annotated package, we pass@Nullable String a
toBigDecimalMath.roundToDouble
which is in a class marked with@ElementTypesAreNonnullByDefault
.Example 4: This example fails, with
com.google.common
as a properly annotated package - this behaves as we expect in both v0.8.0 and v0.9.+, and this is the result we would expect. However, this now contradicts the result in Example 1.The text was updated successfully, but these errors were encountered: