uber / NullAway

A tool to help eliminate NullPointerExceptions (NPEs) in your Java code with low build-time overhead
MIT License
3.63k stars 293 forks source link

Fix backwards-incompatible calls to ASTHelpers.hasDirectAnnotationWithSimpleName #894

Closed msridhar closed 9 months ago

msridhar commented 9 months ago

Error Prone 2.24.0 introduces new overloads of ASTHelpers.hasDirectionAnnotationWithSimpleName; see https://github.com/google/error-prone/commit/aa6e3e7be223e5f8319609281b229d4db4219654. This causes backward compatibility issues when compiling against EP 2.24.0+ and then running on an older version of Error Prone. We introduce a wrapper method to avoid this issue. We also modify our testJdk8 tasks to properly test the scenario of compiling against the newest supported Error Prone version and then running on the oldest supported version, which would have caught this issue.

Ideally we would have our own EP check preventing direct calls to ASTHelpers.hasDirectionAnnotationWithSimpleName, but that can be done in a follow-up.

msridhar commented 9 months ago

@yuxincs this fixes the issue that caused release 0.10.20 to be unusable on older Error Prone versions

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (abff73e) 86.94% compared to head (77067b0) 86.95%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #894 +/- ## ========================================= Coverage 86.94% 86.95% - Complexity 1952 1953 +1 ========================================= Files 77 77 Lines 6314 6315 +1 Branches 1222 1222 ========================================= + Hits 5490 5491 +1 Misses 420 420 Partials 404 404 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.