Skip to content

Conversation

@msridhar
Copy link
Collaborator

@msridhar msridhar commented Nov 28, 2025

Before we were missing a space character so the Error Prone args were not getting passed properly. Do some related minor cleanup.

Summary by CodeRabbit

  • Refactor
    • Internal assembly of compiler/analyzer invocation arguments was reorganized for clearer, centralized construction; no behavior change.
  • New Feature
    • Added a new type-annotation handling option to improve JSpecify/type-annotation processing during analysis.
  • Other
    • No changes to public API or user workflows.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

Updates jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java to centralize Error Prone options in a new allErrorProneArgs string and use it in the -processorpath invocation. Replaces runtime Arrays.asList usages with List.of when assembling invocation options and classpath groups. Adds the -XDaddTypeAnnotationsToSymbol=true option (commented as benign outside JSpecify mode). No public API or control-flow semantics are changed.

Suggested reviewers

  • lazaroclapp
  • yuxincs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix arg concatenation bug in JMH' directly matches the PR's stated objective to fix an argument concatenation bug in the JMH benchmark code.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-jmh-ep-args

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d8f6a1 and 9b837a2.

📒 Files selected for processing (1)
  • jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
📚 Learning: 2025-08-14T18:50:06.159Z
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.

Applied to files:

  • jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java
📚 Learning: 2025-08-28T04:54:20.953Z
Learnt from: msridhar
Repo: uber/NullAway PR: 1248
File: nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java:847-857
Timestamp: 2025-08-28T04:54:20.953Z
Learning: In NullAway's GenericsChecks.java, NewClassTree support for explicit type argument substitution requires more extensive changes beyond just modifying the conditional in compareGenericTypeParameterNullabilityForCall. The maintainers prefer to handle NewClassTree support in a separate follow-up rather than expanding the scope of PRs focused on specific issues like super constructor calls.

Applied to files:

  • jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build and test on ubuntu-latest
  • GitHub Check: Build and test on macos-latest
  • GitHub Check: Build and test on windows-latest
  • GitHub Check: Build caffeine with snapshot
  • GitHub Check: Build spring-framework with snapshot
🔇 Additional comments (3)
jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java (3)

177-177: Good refactor to List.of.

The change from Arrays.asList to List.of is idiomatic for Java 9+ and creates a more efficient immutable list.


191-199: LGTM!

The use of the centralized allErrorProneArgs variable ensures proper spacing of Error Prone arguments, and the List.of refactor is appropriate.


202-214: Good refactor to List.of.

The change is appropriate and follows Java 9+ best practices.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.39%. Comparing base (f39e5bd) to head (8883d5c).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1357   +/-   ##
=========================================
  Coverage     88.39%   88.39%           
  Complexity     2594     2594           
=========================================
  Files            98       98           
  Lines          8705     8705           
  Branches       1732     1732           
=========================================
  Hits           7695     7695           
  Misses          505      505           
  Partials        505      505           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java (1)

182-195: Excellent! Now I have confirmed the issue and identified a flaw in the proposed fix. Let me generate the corrected review comment:


JavaCompiler options must be passed as individual array elements, not bundled with spaces

The current code bundles multiple javac flags into a single string allErrorProneArgs and adds it as one element to the options array. According to the JavaCompiler API, each flag must be a separate array element; space-separated flags in a single string will not be parsed correctly by javac.

The proposed fix in the diff is incomplete—it still bundles extraErrorProneArgs with spaces into nullawayAnnotatedPackagesArg, creating the same parsing problem. The correct approach is to add each flag individually:

-    String allErrorProneArgs =
-        String.format(
-            "-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=%s %s",
-            annotatedPackages, String.join(" ", extraErrorProneArgs));
     options.addAll(
         Arrays.asList(
             "-processorpath",
             processorPath,
             "-d",
             outputDir.toAbsolutePath().toString(),
             "-XDcompilePolicy=simple",
             "--should-stop=ifError=FLOW",
-            allErrorProneArgs));
+            "-Xplugin:ErrorProne",
+            "-XepDisableAllChecks",
+            "-Xep:NullAway:ERROR",
+            "-XepOpt:NullAway:AnnotatedPackages=" + annotatedPackages));
+    options.addAll(extraErrorProneArgs);

This keeps each option tokenized separately while fixing the missing space issue between annotatedPackages and extraErrorProneArgs.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8c32ef and 906c2ca.

📒 Files selected for processing (1)
  • jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
📚 Learning: 2025-08-14T18:50:06.159Z
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.

Applied to files:

  • jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build and test on ubuntu-latest
  • GitHub Check: Build and test on windows-latest
  • GitHub Check: Build caffeine with snapshot
  • GitHub Check: Build spring-framework with snapshot
  • GitHub Check: Build and test on macos-latest

Comment on lines 210 to 211
// for JSpecify mode
options.add("-XDaddTypeAnnotationsToSymbol=true");
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Clarify/verify JDK expectations for -XDaddTypeAnnotationsToSymbol=true

Always adding -XDaddTypeAnnotationsToSymbol=true aligns with the goal of supporting JSpecify mode and, per prior learnings, failing fast on unsupported JDKs rather than silently skipping behavior. Based on learnings, this is desirable for catching regressions in CI, but it does assume all JMH runs for this harness use a javac that understands this -XD flag.

Consider either:

  • Documenting that the JMH benchmarks require a JDK where this flag is supported, or
  • If this helper is also used in non-JSpecify benchmarks, making the comment more explicit (e.g., that the option is benign outside JSpecify but required for JSpecify runs).

Functionality is likely correct; this is mainly about explicitness and version expectations.

🤖 Prompt for AI Agents
In jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java around lines
210-211, clarify the JDK expectations for adding
"-XDaddTypeAnnotationsToSymbol=true": update the inline comment to explicitly
state that this option is required for JSpecify-mode benchmarks and must be
supported by the javac used for JMH runs (or that running on an older javac will
fail fast), or alternatively gate adding the option behind a boolean
parameter/flag used only for JSpecify runs and add Javadoc/README guidance that
JMH benchmarks requiring JSpecify need a JDK whose javac accepts this -XD flag.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java (1)

210-211: Acknowledge the existing review comment about JDK expectations.

The addition of -XDaddTypeAnnotationsToSymbol=true for JSpecify mode has been previously reviewed. As noted in the past review comment, consider documenting the JDK version requirements for this flag or making the inline comment more explicit about when this option is required and supported.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 906c2ca and 2d8f6a1.

📒 Files selected for processing (1)
  • jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
📚 Learning: 2025-08-14T18:50:06.159Z
Learnt from: msridhar
Repo: uber/NullAway PR: 1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.159Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.

Applied to files:

  • jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: benchmarking
  • GitHub Check: Build and test on macos-latest
  • GitHub Check: Build spring-framework with snapshot
  • GitHub Check: Build and test on windows-latest
  • GitHub Check: Build and test on ubuntu-latest
  • GitHub Check: Build caffeine with snapshot
🔇 Additional comments (1)
jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java (1)

194-194: LGTM: Consolidated Error Prone arguments passed correctly.

Using the single allErrorProneArgs string ensures all Error Prone plugin arguments are passed together as required by the -Xplugin:ErrorProne mechanism.

Comment on lines 182 to 185
String allErrorProneArgs =
String.format(
"-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=%s %s",
annotatedPackages, String.join(" ", extraErrorProneArgs));
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

The concatenation fix correctly addresses the missing space bug.

The use of String.format with space-separated %s placeholders ensures Error Prone arguments are properly spaced, resolving the issue described in the PR.

One minor edge case: when extraErrorProneArgs is empty, the format produces a trailing space (e.g., "...AnnotatedPackages=com.uber "). While benign for command-line parsing, you could avoid it with:

-    String allErrorProneArgs =
-        String.format(
-            "-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=%s %s",
-            annotatedPackages, String.join(" ", extraErrorProneArgs));
+    String allErrorProneArgs =
+        String.format(
+            "-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=%s%s",
+            annotatedPackages, 
+            extraErrorProneArgs.isEmpty() ? "" : " " + String.join(" ", extraErrorProneArgs));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
String allErrorProneArgs =
String.format(
"-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=%s %s",
annotatedPackages, String.join(" ", extraErrorProneArgs));
String allErrorProneArgs =
String.format(
"-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=%s%s",
annotatedPackages,
extraErrorProneArgs.isEmpty() ? "" : " " + String.join(" ", extraErrorProneArgs));
🤖 Prompt for AI Agents
In jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java around lines 182
to 185, the formatted string can produce a trailing space when
extraErrorProneArgs is empty; change the construction so you only append a
leading space plus joined extraErrorProneArgs when extraErrorProneArgs is
non-empty (or trim the final string) so the resulting Error Prone argument
string never has an unnecessary trailing space.

@github-actions
Copy link

Main Branch:

Benchmark                          Mode  Cnt   Score   Error  Units
AutodisposeBenchmark.compile      thrpt   25   9.953 ± 0.218  ops/s
CaffeineBenchmark.compile         thrpt   25   2.077 ± 0.015  ops/s
DFlowMicroBenchmark.compile       thrpt   25  35.413 ± 0.508  ops/s
NullawayReleaseBenchmark.compile  thrpt   25   1.584 ± 0.027  ops/s

With This PR:

Benchmark                          Mode  Cnt   Score   Error  Units
AutodisposeBenchmark.compile      thrpt   25  10.054 ± 0.078  ops/s
CaffeineBenchmark.compile         thrpt   25   1.916 ± 0.009  ops/s
DFlowMicroBenchmark.compile       thrpt   25  35.022 ± 0.395  ops/s
NullawayReleaseBenchmark.compile  thrpt   25   1.583 ± 0.029  ops/s

@msridhar msridhar requested a review from yuxincs December 2, 2025 20:56
@msridhar msridhar merged commit 2294177 into master Dec 2, 2025
11 checks passed
@msridhar msridhar deleted the fix-jmh-ep-args branch December 2, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants