Skip to content

Bump SpotBugs to 4.10.3 - #40

Merged
stefanvacareanu7 merged 1 commit into
masterfrom
chore/automated-tool-update
Jul 30, 2026
Merged

Bump SpotBugs to 4.10.3#40
stefanvacareanu7 merged 1 commit into
masterfrom
chore/automated-tool-update

Conversation

@stefanvacareanu7

Copy link
Copy Markdown
Contributor

Summary

  • Bumps the wrapped SpotBugs version from 4.8.4 to 4.10.3 (latest release) in build.sbt, and regenerates docs/patterns.json and docs/description/* via DocumentationGenerator (24 patterns added, 4 removed/renamed by upstream SpotBugs).
  • Bumps dockerBaseImage from amazoncorretto:8-alpine3.18-jre to amazoncorretto:11-alpine3.18, since SpotBugs 4.9.0+ raises its minimum runtime requirement to Java 11. Note: Corretto no longer publishes a slim JRE-only Alpine variant for Java 11+ (only -jdk/-full/plain, all identical in size), so the resulting image is larger than before — this is unavoidable given the runtime requirement.
  • Bumps scalaVersion from 2.12.15 to 2.12.21 to work around scala/bug#12783: the Scala 2.12 classfile parser crashes (FatalError: bad constant pool index: 0) reading MethodParameters attributes with unnamed parameters, which are present in SpotBugs classes from 4.8.5 onward (compiled with a newer javac). This isn't an incidental/opportunistic bump — the build cannot compile against any SpotBugs version newer than 4.8.4 without it. Confirmed via bisection (4.8.4 compiles, 4.8.5+ all fail with the identical stack trace regardless of the JDK running sbt) and confirmed the fix by testing 2.12.21 against 4.10.3.
  • findsecbugsVersion and sbContribVersion were left untouched, per the playbook (only bump when the task specifically targets those plugins).
  • CircleCI orbs (codacy/base, codacy/plugins-test) were left untouched — out of scope and previously reverted after breaking CI when bumped opportunistically.

Validation performed locally

  • sbt compile — passes (JDK 8 for the Scala compiler bug fix verification; JDK 11 for anything touching SpotBugs classes at runtime)
  • sbt "runMain com.codacy.tools.spotbugs.DocumentationGenerator" — regenerated docs, diff reviewed
  • sbt scalafmtCheckAll scalafmtSbtCheck test — 18/18 tests pass
  • sbt "set version := \"latest\"; docker:publishLocal" — image builds and runs
  • codacy-plugins-test against the local image:
    • runMain codacy.plugins.DockerTest json codacy-spotbugs:latest — pass
    • runMain codacy.plugins.DockerTest pattern codacy-spotbugs:latest — pass
    • runMain codacy.plugins.DockerTest multiple codacy-spotbugs:latest — pass (4/4 fixture cases)

Test plan

  • CI checks green on this PR (will poll and report)

Updates the wrapped SpotBugs version from 4.8.4 to 4.10.3 (latest release)
and regenerates docs/patterns.json and docs/description/* accordingly.

SpotBugs 4.9.0+ raises its minimum runtime requirement to Java 11, so
dockerBaseImage is bumped from amazoncorretto:8-alpine3.18-jre to
amazoncorretto:11-alpine3.18 (no JRE-only alpine variant is published for
Corretto 11+, only jdk/full/plain, which are all identical in size).

Also bumps scalaVersion from 2.12.15 to 2.12.21 to work around a Scala 2.12
compiler bug (scala/bug#12783) where the classfile parser crashes reading
MethodParameters attributes with unnamed parameters, present in SpotBugs
classes starting at 4.8.5 (compiled with a newer javac). Without this the
build fails with "bad constant pool index: 0" for any SpotBugs version
above 4.8.4.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@stefanvacareanu7
stefanvacareanu7 requested a review from lolgab as a code owner July 29, 2026 18:03
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades SpotBugs to 4.10.3 and transitions the runtime to Java 11 via Amazon Corretto, which is a necessary step for maintaining compatibility with modern bytecode. The Codacy analysis indicates the changes are generally up to standards. However, the documentation regeneration process has introduced several formatting and syntax issues. Specifically, Java annotations in the documentation are incorrectly prefixed with '&' instead of '@', and there are multiple typos in specification references and descriptions. These documentation issues should be addressed to ensure clarity for end-users, though they do not block the core functional upgrade.

About this PR

  • Several regenerated documentation files exhibit systemic issues: Java annotations are incorrectly prefixed with '&' instead of '@', likely due to HTML escaping, and several JSON description strings contain trailing whitespace and newlines. The regeneration process should be reviewed to ensure correct character encoding and formatting.

Test suggestions

  • Verify that the project compiles successfully using the new Scala and SpotBugs versions.\n- [ ] Verify the integrity of the regenerated documentation files (patterns.json and markdown descriptions).\n- [ ] Ensure the Docker container initializes and executes basic analysis successfully under Java 11.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that the project compiles successfully using the new Scala and SpotBugs versions.\n- [ ] Verify the integrity of the regenerated documentation files (patterns.json and markdown descriptions).\n- [ ] Ensure the Docker container initializes and executes basic analysis successfully under Java 11.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment on lines +3 to +5
Suppressing annotations `&SuppressFBWarnings` should be removed from the source code as soon as they are no more needed.
Leaving them may result in accidental warnings suppression.
The unnecessary annotation is not reported when the class is annotated with an `&Generated` annotation with retention CLASS or RUNTIME. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Annotations in Java are prefixed with @, not &. This appears to be a typo from an HTML-escaped source or copy-paste error. Using standard Java notation ensures the documentation is clear for users.\n\nsuggestion\n Suppressing annotations `@SuppressFBWarnings` should be removed from the source code as soon as they are no more needed.\n Leaving them may result in accidental warnings suppression.\n The unnecessary annotation is not reported when the class is annotated with an `@Generated` annotation with retention CLASS or RUNTIME.\n

an indication of some misunderstanding or some other logic error.
If you really want to test the value for being null, perhaps it would be clearer to do
better to do a null test rather than an instanceof test. No newline at end of file
better to do a null test rather than an instanceof test.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ LOW RISK

Nitpick: The sentence structure here is repetitive. It can be simplified to improve clarity.\n\nsuggestion\na null-check rather than an instanceof test.\n

}, {
"patternId" : "UNS_UNSAFE_CALL",
"title" : "Call to Unsafe.",
"description" : "Do not use {4}. As the class name indicates, its methods are not safe to use.\n ",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ LOW RISK

Nitpick: Remove the trailing newline and extra spaces from the end of the description string to ensure consistent UI rendering.\n\nsuggestion\n "description" : "Do not use {4}. As the class name indicates, its methods are not safe to use.",\n

# [This write of this 64-bit primitive variable may not be atomic](https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html#AT_NONATOMIC_64BIT_PRIMITIVE)

The long and the double are 64-bit primitive types, and depending on the Java Virtual Machine implementation assigning a value to them can be treated as two separate 32-bit writes, and as such it's not atomic.
See [JSL 17.7\. Non-Atomic Treatment of double and long](https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.7).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ LOW RISK

Nitpick: The standard acronym for the Java Language Specification is JLS.\n\nsuggestion\n See [JLS 17.7\\. Non-Atomic Treatment of double and long](https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html#jls-17.7).\n

@stefanvacareanu7
stefanvacareanu7 merged commit 4c6536d into master Jul 30, 2026
5 checks passed
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