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

Remove unused or unneeded JarInfer flags #1050

Merged

Conversation

msridhar
Copy link
Collaborator

@msridhar msridhar commented Oct 4, 2024

The JarInferRegexStripModelJar and JarInferRegexStripCodeJar options seem completely unused in our code base; so removing them is just a cleanup. (We should still document in the release notes.)

We remove JarInferUseReturnAnnotations as well. Recall that JarInfer infers a @Nullable return annotation if it sees the statement return null in the body of the method. We remove this flag for a number of reasons:

  • I would argue this kind of thing is better controlled when generating astubx files rather than while reading them. I would expect that methods which have return null in them should usually have a @Nullable return. In cases where this is not desired, the configuration really should be on the generation side I think, excluding a few methods.
  • This flag doesn't even work when instrumenting bytecodes; there the injected @Nullable annotations will be used independent of the flag setting. It only works for models read from astubx. So the most common internal use of JarInfer doesn't make use of this flag anyway.
  • The presence of this flag complicates merging our JarInfer handling code with our other library model handling code, a very desirable cleanup we want to do.
  • I confirmed that internally at Uber, not setting this flag has no impact on the build (no new errors pop up).

@msridhar msridhar requested a review from lazaroclapp October 4, 2024 23:04
Copy link

codecov bot commented Oct 4, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.62%. Comparing base (4eaf484) to head (b81796d).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...er/nullaway/handlers/InferredJARModelsHandler.java 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1050   +/-   ##
=========================================
  Coverage     87.61%   87.62%           
+ Complexity     2165     2160    -5     
=========================================
  Files            85       85           
  Lines          7114     7103   -11     
  Branches       1386     1386           
=========================================
- Hits           6233     6224    -9     
+ Misses          452      450    -2     
  Partials        429      429           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@lazaroclapp lazaroclapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@msridhar msridhar enabled auto-merge (squash) October 7, 2024 20:30
@msridhar msridhar merged commit 9eea2be into uber:master Oct 7, 2024
11 checks passed
@msridhar msridhar deleted the remove-jarinfer-return-annotations-flag branch October 7, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants