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 jarinfer cli output determinism #884

Closed oliviernotteghem closed 10 months ago

oliviernotteghem commented 10 months ago

When invoking CLI, jar output sha is not constant. This breaks cacheability in build systems like Buck and Bazel. Binary investigation (see attached screenshot) of these jars show byte 0xa-0xd in PkZip header is what is changes, and corresponds to file modified date/time (see https://users.cs.jmu.edu/buchhofp/forensics/formats/pkzip.html). This PR is setting these times to 0 explicilty, so that jar sha remains constant between invokation.

Screenshot 2023-12-21 at 10 35 42 AM
codecov[bot] commented 10 months ago

Codecov Report

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

Comparison is base (5fbee1f) 87.03% compared to head (855bf13) 87.09%. Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #884 +/- ## ============================================ + Coverage 87.03% 87.09% +0.05% - Complexity 1926 1940 +14 ============================================ Files 77 77 Lines 6231 6267 +36 Branches 1212 1218 +6 ============================================ + Hits 5423 5458 +35 Misses 405 405 - Partials 403 404 +1 ```

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