fix: use private lock objects in test utilities, accept override widening#1411
Open
joaodinissf wants to merge 1 commit into
Open
fix: use private lock objects in test utilities, accept override widening#1411joaodinissf wants to merge 1 commit into
joaodinissf wants to merge 1 commit into
Conversation
…ning SpotBugs 4.10 adds the USO_UNSAFE_*_SYNCHRONIZATION and IAOM_DO_NOT_INCREASE_METHOD_ACCESSIBILITY detectors. JobMatcher instances escape via the static registerNewJob*Matcher factories and ExtensionRegistryMock's class literal is public, so both synchronized on locks that arbitrary code can contend on; synchronize on private lock objects instead. Widening an inherited method from protected to public is deliberate API design in this codebase; exclude IAOM in the SpotBugs filter accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepares the codebase for SpotBugs 4.10 (#1410), which adds two detectors that flag existing code:
USO_UNSAFE_*_SYNCHRONIZATION(4 findings, fixed for real):JobMatcherinstances escape via the staticregisterNewJob*Matcherfactories andExtensionRegistryMock's class literal is public, so both synchronized on locks that arbitrary code can contend on. Both now synchronize on private lock objects — the canonical fix, not a suppression.IAOM_DO_NOT_INCREASE_METHOD_ACCESSIBILITY(15 findings, excluded by policy): widening an inherited method fromprotectedtopublicis deliberate API design in this codebase (e.g.DelegatingScope.getAllLocalElements()); narrowing them would be a breaking change. The detector is excluded in the SpotBugs filter with a comment stating the policy.Once merged, #1410 (SpotBugs 4.9.8 → 4.10.2) goes green after a rebase, keeping the dependency bump itself a pure version change.
Verified locally with a full
mvn verifyincluding SpotBugs: clean.🤖 Generated with Claude Code