Skip to content

fix: use private lock objects in test utilities, accept override widening#1411

Open
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:chore/prepare-spotbugs-4-10
Open

fix: use private lock objects in test utilities, accept override widening#1411
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:chore/prepare-spotbugs-4-10

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

Prepares the codebase for SpotBugs 4.10 (#1410), which adds two detectors that flag existing code:

  • USO_UNSAFE_*_SYNCHRONIZATION (4 findings, fixed for real): 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. 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 from protected to public is 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 verify including SpotBugs: clean.

🤖 Generated with Claude Code

…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>
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.

1 participant