Repository navigation
Improve Gradle configuration - #557
Conversation
|
Warning Review limit reached
Next review available in: 48 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR modernizes Gradle toolchain and publication configuration around Java 21 compilation with Java 17 release targeting. It adds formatter-version management and Spotless caching in CI and local hooks. It expands Javadoc, analysis, coverage, and task configuration. Utility behavior now reports explicit errors and caller-relative stack traces. New fixtures and JUnit tests cover BCEL utilities, stack verification, stack maps, stack types, and logging. Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/gradle.yml:
- Around line 30-35: Update the “Cache Spotless P2 artifacts” step to cache the
Spotless-configured directory ~/.gradle/spotless-p2 instead of
~/.m2/repository/dev/equo/p2-data, while preserving the existing cache key and
restore-key configuration.
In `@src/test/java/org/plumelib/bcelutil/BcelUtilTest.java`:
- Around line 277-307: Serialize the process-wide state tests to prevent
parallel interference: in
src/test/java/org/plumelib/bcelutil/BcelUtilTest.java:277-307, annotate
skipChecksIsFalseByDefault and skipChecksSuppressesChecking with
`@ResourceLock`("BcelUtil.skipChecks"); in
src/test/java/org/plumelib/bcelutil/SimpleLogTest.java:158-185, annotate
dashFilenameMeansStandardOutput and nullFilenameMeansStandardOutput with
`@ResourceLock`(Resources.SYSTEM_OUT), adding the required JUnit resource-lock
imports.
- Around line 396-405: Update
src/test/java/org/plumelib/bcelutil/BcelUtilTest.java:396-405 and
src/test/java/org/plumelib/bcelutil/StackMapUtilsTest.java:193-200 to use a new
generic fixture method in
src/test/java/org/plumelib/bcelutil/BcelUtilTestFixture.java, such as size, that
produces a LocalVariableTypeTable. In both tests, assert the attribute exists
before removal, invoke the existing removal method, and verify the
LocalVariableTypeTable is absent afterward while all other code attributes
remain; in BcelUtilTest also assert the count decreases by exactly one.
- Around line 268-273: Update getConstantStringRejectsAnUnsuitableConstant to
expect the specific exception type thrown by BcelUtil.getConstantString for a
null constant-pool entry, replacing the broad Throwable.class assertion while
preserving the existing constant-pool index 0 setup.
In `@src/test/java/org/plumelib/bcelutil/Fixtures.java`:
- Around line 55-62: Update Fixtures.method(String) to detect multiple matching
methods and throw an assertion instead of returning the first match. Add a
signature-aware method(String, String) lookup that selects by method name and
JVM descriptor, then update constructor callers to use "()V" or "(I)V" and have
everyFixtureMethodVerifies resolve each method with its descriptor.
In `@src/test/java/org/plumelib/bcelutil/StackTypesTest.java`:
- Around line 83-98: Extend setStoresACopyOfTheFrame to assert the recorded
locals through StackTypes’ provided local-variable accessor and formatting,
verifying that local 0 remains Type.STRING after the original frame is mutated.
Keep the existing stack snapshot assertion unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4881e804-61e8-4535-9b8b-d21dd8bbf611
📒 Files selected for processing (19)
.github/workflows/gradle.yml.github/workflows/prek.yaml.gitignore.travis.ymlREADME-developers.mdbuild.gradlegradle.propertiesgradle/libs.versions.tomlgradle/wrapper/gradle-wrapper.propertiessettings.gradlesrc/main/java/org/plumelib/bcelutil/BcelUtil.javasrc/main/java/org/plumelib/bcelutil/SimpleLog.javasrc/test/java/org/plumelib/bcelutil/BcelUtilTest.javasrc/test/java/org/plumelib/bcelutil/BcelUtilTestFixture.javasrc/test/java/org/plumelib/bcelutil/Fixtures.javasrc/test/java/org/plumelib/bcelutil/SimpleLogTest.javasrc/test/java/org/plumelib/bcelutil/StackMapUtilsTest.javasrc/test/java/org/plumelib/bcelutil/StackTypesTest.javasrc/test/java/org/plumelib/bcelutil/StackVerTest.java
💤 Files with no reviewable changes (1)
- .travis.yml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/gradle.yml (1)
41-41: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftPass
org.gradle.java.installations.fromEnvwith-D, not-P.
org.gradle.java.installations.fromEnvis a Gradle configuration setting, not a custom project property. Gradle reads this value from the command line with-Dorg.gradle.java.installations.fromEnv=...;-Porg.gradle.java.installations.fromEnv=...leaves Gradle without the configured install paths and can force toolchain resolution from another source.Proposed fix
- run: ./gradlew build -PtestJavaVersion=${{ matrix.java }} -Porg.gradle.java.installations.fromEnv=JAVA_HOME_${{ matrix.java }}_${{ runner.arch }},JAVA_HOME_21_${{ runner.arch }} + run: ./gradlew build -PtestJavaVersion=${{ matrix.java }} -Dorg.gradle.java.installations.fromEnv=JAVA_HOME_${{ matrix.java }}_${{ runner.arch }},JAVA_HOME_21_${{ runner.arch }}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/gradle.yml at line 41, Update the Gradle invocation in the workflow step to pass org.gradle.java.installations.fromEnv as a system property using -D instead of -P, while preserving its existing JAVA_HOME values and the testJavaVersion project property.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/gradle.yml:
- Line 41: Update the Gradle invocation in the workflow step to pass
org.gradle.java.installations.fromEnv as a system property using -D instead of
-P, while preserving its existing JAVA_HOME values and the testJavaVersion
project property.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c81813ca-5b44-4110-8bd4-8a6ab73a682f
📒 Files selected for processing (6)
.github/workflows/gradle.ymlREADME-developers.mdgradle.propertiesgradle/libs.versions.tomlsrc/main/java/org/plumelib/bcelutil/BcelUtil.javasrc/main/java/org/plumelib/bcelutil/SimpleLog.java
💤 Files with no reviewable changes (1)
- src/main/java/org/plumelib/bcelutil/SimpleLog.java
There was a problem hiding this comment.
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)
src/test/java/org/plumelib/bcelutil/BcelUtilTest.java (1)
282-303: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winLock
checkMgenRejectsADanglingExceptionHandlerwithBcelUtil.skipChecks.
skipChecksSuppressesCheckingsets the process-wideBcelUtil.skipChecksflag, butcheckMgenRejectsADanglingExceptionHandleris not guarded by@ResourceLock("BcelUtil.skipChecks"). If the two tests run concurrently,checkMgenRejectsADanglingExceptionHandlercan observeskipChecks == trueand not throw the expectedError.Add
@ResourceLock("BcelUtil.skipChecks")to that test, or apply the lock at the test class level.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/org/plumelib/bcelutil/BcelUtilTest.java` around lines 282 - 303, Add `@ResourceLock`("BcelUtil.skipChecks") to checkMgenRejectsADanglingExceptionHandler, or apply the same lock at the enclosing test class level, so it cannot run concurrently with skipChecksSuppressesChecking while the process-wide flag is modified.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@build.gradle`:
- Around line 169-198: Serialize the complete inspect-and-delete sequence in
deleteStaleLockFile with a separate OS-level cleanup lock shared by all
deleteStaleSpotlessP2Lock tasks, acquiring it before checking .lock and
releasing it afterward. Recheck the lock file while holding that cleanup lock,
and return when getText() indicates the file was removed by another process;
only perform stale-lock deletion while the cleanup lock is held.
---
Outside diff comments:
In `@src/test/java/org/plumelib/bcelutil/BcelUtilTest.java`:
- Around line 282-303: Add `@ResourceLock`("BcelUtil.skipChecks") to
checkMgenRejectsADanglingExceptionHandler, or apply the same lock at the
enclosing test class level, so it cannot run concurrently with
skipChecksSuppressesChecking while the process-wide flag is modified.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 12127e61-b54a-4e25-b1b6-a80c7761bc6f
📒 Files selected for processing (10)
.github/workflows/gradle.yml.github/workflows/prek.yamlbuild.gradlegradle.propertiesprek.tomlsrc/main/java/org/plumelib/bcelutil/BcelUtil.javasrc/test/java/org/plumelib/bcelutil/BcelUtilTest.javasrc/test/java/org/plumelib/bcelutil/Fixtures.javasrc/test/java/org/plumelib/bcelutil/SimpleLogTest.javasrc/test/java/org/plumelib/bcelutil/StackVerTest.java
| static void deleteStaleLockFile(File cacheDirectory, Logger logger) { | ||
| File lockFile = new File(new File(cacheDirectory, "metadata"), ".lock") | ||
| if (!lockFile.isFile()) { | ||
| return | ||
| } | ||
| long pid | ||
| try { | ||
| pid = Long.parseLong(lockFile.getText("UTF-8").trim()) | ||
| } catch (NumberFormatException e) { | ||
| // Solstice creates the lock file and then writes its PID into it, so a lock file that holds | ||
| // no PID usually belongs to a live process that is between those two steps. A process that | ||
| // is killed between them leaves the file empty forever, and Solstice parses the file outside | ||
| // the "try" block that handles a lock it cannot take, so every later build then dies with a | ||
| // NumberFormatException. Wait out the race before assuming that this is the latter case. | ||
| if (System.currentTimeMillis() - lockFile.lastModified() > EMPTY_LOCK_FILE_GRACE_MILLIS | ||
| && lockFile.delete()) { | ||
| logger.lifecycle("Deleted abandoned Spotless P2 lock file that holds no PID: ${lockFile}") | ||
| } | ||
| return | ||
| } | ||
| // A PID that the operating system has recycled looks like the original owner, which leaves the | ||
| // lock file in place. That is the behavior that this method is avoiding, but erring in this | ||
| // direction merely fails to improve on Solstice, whereas deleting a live process's lock file | ||
| // would let two processes write the cache at once. | ||
| if (ProcessHandle.of(pid).isPresent()) { | ||
| return | ||
| } | ||
| if (lockFile.delete()) { | ||
| logger.lifecycle("Deleted stale Spotless P2 lock file of dead process ${pid}: ${lockFile}") | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Serialize stale-lock cleanup across Gradle processes.
Lines 169-198 inspect and delete .lock without cross-process exclusion. One task can read a dead lock, another can delete it, and a third process can create a live lock before the first task calls lockFile.delete().
The first task can then remove the live lock. Solstice can provision the same P2 cache concurrently and corrupt or fail it. Guard the complete inspect-and-delete sequence with a separate OS-level cleanup lock shared by every deleteStaleSpotlessP2Lock task. If getText() reports that the file is gone, return because another process already recovered it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@build.gradle` around lines 169 - 198, Serialize the complete
inspect-and-delete sequence in deleteStaleLockFile with a separate OS-level
cleanup lock shared by all deleteStaleSpotlessP2Lock tasks, acquiring it before
checking .lock and releasing it afterward. Recheck the lock file while holding
that cleanup lock, and return when getText() indicates the file was removed by
another process; only perform stale-lock deletion while the cleanup lock is
held.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/gradle.yml (1)
47-53: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winPin the
actions/cacheworkflow references to immutable commit SHAs.Use a full Git commit SHA instead of the mutable
v6tag foractions/cache/restore@v6andactions/cache/save@v6, because tags can move upstream without a repository change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/gradle.yml around lines 47 - 53, Replace every mutable actions/cache tag with its corresponding full immutable commit SHA: update actions/cache/restore at .github/workflows/gradle.yml lines 47-53 and 101-106, and actions/cache/save at .github/workflows/gradle.yml lines 119-124 and .github/workflows/prek.yaml lines 24-29. Preserve the existing cache steps and configuration.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.github/workflows/gradle.yml:
- Around line 47-53: Replace every mutable actions/cache tag with its
corresponding full immutable commit SHA: update actions/cache/restore at
.github/workflows/gradle.yml lines 47-53 and 101-106, and actions/cache/save at
.github/workflows/gradle.yml lines 119-124 and .github/workflows/prek.yaml lines
24-29. Preserve the existing cache steps and configuration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: bd3eb0bc-c3c1-41e3-b035-3a61e170bf28
📒 Files selected for processing (10)
.github/workflows/gradle.yml.github/workflows/prek.yamlREADME-developers.mdbuild.gradlegithooks/pre-commitgradle.propertiessrc/main/java/org/plumelib/bcelutil/BcelUtil.javasrc/main/java/org/plumelib/bcelutil/SimpleLog.javasrc/test/java/org/plumelib/bcelutil/BcelUtilTest.javasrc/test/java/org/plumelib/bcelutil/SimpleLogTest.java
💤 Files with no reviewable changes (1)
- githooks/pre-commit
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/gradle.yml:
- Line 64: Pin the actions/cache/restore usage in .github/workflows/gradle.yml
lines 64-64 and .github/workflows/prek.yaml lines 36-36, plus actions/cache/save
in .github/workflows/gradle.yml lines 80-80, to their approved immutable commit
SHAs instead of mutable tags.
In @.github/workflows/prek.yaml:
- Around line 41-44: Update the “Delete any restored Spotless P2 lock file”
workflow step to remove `.lock` from the computed directory exposed by
`steps.spotless-p2-dir.outputs.dir`, rather than hard-coding `~/.gradle`, so the
restored cache is cleaned when `GRADLE_USER_HOME` is set.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: aca2aff1-e7a1-4a75-8429-e264bf53408c
📒 Files selected for processing (5)
.github/workflows/gradle.yml.github/workflows/prek.yamlbuild.gradleprek.tomlproselint.json
💤 Files with no reviewable changes (1)
- proselint.json
| # the formatter version does. | ||
| - name: Restore Spotless P2 cache | ||
| id: restore-spotless-p2 | ||
| uses: actions/cache/restore@v6 |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Pin GitHub Actions to immutable commit SHAs.
Mutable action tags can resolve to different code after this workflow is reviewed.
.github/workflows/gradle.yml#L64-L64: Pinactions/cache/restoreto its approved commit SHA..github/workflows/gradle.yml#L80-L80: Pinactions/cache/saveto its approved commit SHA..github/workflows/prek.yaml#L36-L36: Pinactions/cache/restoreto its approved commit SHA.
🧰 Tools
🪛 zizmor (1.29.0)
[error] 64-64: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
📍 Affects 2 files
.github/workflows/gradle.yml#L64-L64(this comment).github/workflows/gradle.yml#L80-L80.github/workflows/prek.yaml#L36-L36
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/gradle.yml at line 64, Pin the actions/cache/restore usage
in .github/workflows/gradle.yml lines 64-64 and .github/workflows/prek.yaml
lines 36-36, plus actions/cache/save in .github/workflows/gradle.yml lines
80-80, to their approved immutable commit SHAs instead of mutable tags.
Source: Linters/SAST tools
| # A restored entry can carry a lock file that Solstice left behind; see the step of the same | ||
| # name in gradle.yml. | ||
| - name: Delete any restored Spotless P2 lock file | ||
| run: rm -f ~/.gradle/caches/p2-data/metadata/.lock |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Remove the lock from the computed cache directory.
If GRADLE_USER_HOME is set, Line 38 restores ${{ steps.spotless-p2-dir.outputs.dir }}, but Line 44 removes a lock only from ~/.gradle. The restored lock remains and can cause the Prek formatter run to time out.
Proposed fix
- name: Delete any restored Spotless P2 lock file
- run: rm -f ~/.gradle/caches/p2-data/metadata/.lock
+ env:
+ SPOTLESS_P2_DIR: ${{ steps.spotless-p2-dir.outputs.dir }}
+ run: rm -f "$SPOTLESS_P2_DIR/metadata/.lock"📝 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.
| # A restored entry can carry a lock file that Solstice left behind; see the step of the same | |
| # name in gradle.yml. | |
| - name: Delete any restored Spotless P2 lock file | |
| run: rm -f ~/.gradle/caches/p2-data/metadata/.lock | |
| # A restored entry can carry a lock file that Solstice left behind; see the step of the same | |
| # name in gradle.yml. | |
| - name: Delete any restored Spotless P2 lock file | |
| env: | |
| SPOTLESS_P2_DIR: ${{ steps.spotless-p2-dir.outputs.dir }} | |
| run: rm -f "$SPOTLESS_P2_DIR/metadata/.lock" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/prek.yaml around lines 41 - 44, Update the “Delete any
restored Spotless P2 lock file” workflow step to remove `.lock` from the
computed directory exposed by `steps.spotless-p2-dir.outputs.dir`, rather than
hard-coding `~/.gradle`, so the restored cache is cleaned when
`GRADLE_USER_HOME` is set.
No description provided.