Skip to content

feat: migrate to SonarQube 2026.1 LTA#8

Merged
aksOps merged 16 commits into
mainfrom
feat/sonar-lta-2026.1-migration
May 24, 2026
Merged

feat: migrate to SonarQube 2026.1 LTA#8
aksOps merged 16 commits into
mainfrom
feat/sonar-lta-2026.1-migration

Conversation

@aksOps
Copy link
Copy Markdown
Contributor

@aksOps aksOps commented May 24, 2026

Summary

  • Bump sonarlint-analysis-engine 10.24.0.81415 → 11.3.0.85510 and pin the 10 analyzer plugins to their LTA 2026.1-bundled versions
  • Add a small sonar-predictor-host plugin JAR shipped alongside the analyzer JARs in the offline bundle. Registers a NoOpAnalysisWarnings bean the new sensors Spring-autowire — without it, the engine 11.x bump fails with NoSuchBeanDefinitionException
  • Add three engine-11.x compile adapters: SimpleActiveRule record, SonarLanguage.getPlugin().getKey() rename, Issue.getRuleKey().toString()
  • Document the LTA pinning + upgrade procedure inline in pom.xml so future LTA bumps are pom-only

Design

Per the design doc at docs/superpowers/specs/2026-05-24-sonar-lta-2026.1-migration-design.md (gitignored locally — lives in the worktree). Three-advisor brainstorm (codex / claude / agy) converged on this approach over patched-engine (Codex v1 C) and Byte Buddy premain agent (Agy v1 D) alternatives. Wiring code we own = ~90 LOC across 3 small files + a tiny manifest declaration. No JVM flags, no agents, no vendored modifications to any SonarSource artifact.

Critical findings (recorded for future LTA upgrades)

  1. PluginsLoader.load(config, X)'s 2nd arg is disabledPluginsForAnalysis, NOT additionalAllowedPlugins as the spec assumed. Using it as an allow-list actually excluded the host plugin from every analysis container. Reverted to Set.of().
  2. @SonarLintSide(lifespan = ...) needs SINGLE_ANALYSIS (which maps to ContainerLifespan.ANALYSIS) for the per-analysis AnalysisContainer scope, NOT INSTANCE. HtmlSensor and the other autowiring sensors live in that container.
  3. Host JAR maven phase = process-test-classes + a maven-antrun copy-host-plugin-for-tests step to seed plugins/ for surefire-time tests. The original prepare-package phase missed surefire entirely.

Test plan (all verified locally)

  • mvn clean verify green — 335/335 tests pass (323 baseline + 12 new)
  • HostJarManifestTest pins the host JAR's 6 manifest entries + exactly 2 .class files
  • HostPluginIntegrationTest confirms LoadedPlugins picks up sonarpredict-host with zero NoSuchBeanDefinitionException
  • Self-scan workflow parity — JaCoCo report 328 KB, no new LTA 2026.1 rule-pack issues against our own code
  • Marketplace bundle smoke — dist zip 188 MB, unpacked + ran bin/sonar against a Java null-deref fixture, S2201 and S1220 caught cleanly, zero missing-bean errors in stderr

aksOps added 13 commits May 24, 2026 14:50
…yzers

Build does NOT compile after this commit — engine 11.x removed
org.sonarsource.sonarlint.core.analysis.api.ActiveRule and changed
two other signatures. Phase 3 of the LTA migration plan adds the
adapter classes; Phase 4 wires them in. This commit is the version
checkpoint, intentionally pre-adapter.
Engine 11.3 ships zero references to org.sonar.api.notifications.AnalysisWarnings
but the bundled HTML/Java/Python/PHP sensors Spring-autowire it. This is the
host-side implementation that lives in the sonar-predictor-host plugin JAR
(added in Task 10).

Also adds logback-classic 1.5.13 and assertj-core 3.27.7 as test-scope deps
required by the ListAppender-based log-capture test.
- language.getPluginKey() -> language.getPlugin().getKey() (11.x rename)
- pass Set.of("sonarpredict-host") to PluginsLoader.load() as the
  additionalAllowedPlugins arg, so our host plugin is admitted into
  the analysis container's extension scan (belt-and-suspenders; the
  isNotSensor disjunct alone is also sufficient — see spec §4.1)
Engine 11.x removed org.sonarsource.sonarlint.core.analysis.api.ActiveRule
(the 10.x internal class). The public org.sonar.api.batch.rule.ActiveRule
is the replacement; SimpleActiveRule.of(...) builds instances of the
public interface in one call.
engine.Issue.getRuleKey() returns org.sonar.api.rule.RuleKey in 11.x
(was String in 10.x). Add .toString() at the IssueMapper call site that
feeds the protocol's String ruleKey field. This is the third and final
adapter required to make the project compile on the LTA 2026.1 toolchain.

Also fix AnalysisServiceTest: SonarLanguage.getPluginKey() removed in
11.x; replaced with getPlugin().getKey() via the new SonarPlugin type.
Second maven-jar-plugin execution scoped to the hostplugin package
produces target/sonar-predictor-<v>-host.jar in prepare-package.
Manifest declares Plugin-Class/Plugin-Key/Sonar-Version so the
sonarlint plugin loader treats it identically to a SonarSource
analyzer plugin.
… wires

Three corrections surfaced by the full 335-test gate (Task 14 of the LTA
2026.1 migration plan); none was caught by the spec's javap analysis:

1. PluginRuntime.loadFrom — second arg to PluginsLoader.load is
   disabledPluginsForAnalysis, not additionalAllowedPlugins as the spec
   assumed. Passing "sonarpredict-host" actively EXCLUDED our host plugin
   from every Spring analysis container, leaving AnalysisWarnings unwired
   and reproducing the original "wall". Reverted to Set.of().

2. NoOpAnalysisWarnings @SonarLintSide(lifespan = INSTANCE -> SINGLE_ANALYSIS).
   The per-analysis AnalysisContainer calls install(ContainerLifespan.ANALYSIS),
   which matches the SINGLE_ANALYSIS string constant — not INSTANCE.
   HtmlSensor, the sensor that triggered the original NoSuchBeanDefinitionException,
   lives in this same container.

3. host-plugin-jar maven execution moved from prepare-package to
   process-test-classes, plus a maven-antrun copy-host-plugin-for-tests
   step that seeds the dev plugins/ dir with the host JAR. Required so the
   surefire-time daemon tests (which use AnalysisService's no-arg ctor =
   plugins/) can find the host plugin without a full assembly run.

HostPluginIntegrationTest refactored to use @tempdir + hardlink-or-copy
the vendored analyzer JARs plus the host JAR, filtering out *-host.jar
from the vendored glob to avoid a duplicate FileAlreadyExistsException
when antrun has already populated plugins/.

After these three corrections, full mvn verify reports 335/335 tests
passing, JaCoCo report intact, and the unpacked dist bundle analyzes a
Java fixture cleanly with zero NoSuchBeanDefinitionException occurrences.
@aksOps aksOps force-pushed the feat/sonar-lta-2026.1-migration branch from 7ed07f2 to 3c1296e Compare May 24, 2026 14:54
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 24, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedorg.assertj/​assertj-core@​3.27.73210090100100
Addedorg.mockito/​mockito-core@​5.15.23610090100100
Updatedorg.sonarsource.sonarlint.core/​sonarlint-analysis-engine@​10.24.0.81415 ⏵ 11.3.0.8551078 -110090100100

View full report

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 24, 2026

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: maven commons-codec:commons-codec is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/commons-codec/commons-codec@1.21.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/commons-codec/commons-codec@1.21.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.mockito:mockito-core is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.mockito/mockito-core@5.15.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.mockito/mockito-core@5.15.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.mockito:mockito-core is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.mockito/mockito-core@5.15.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.mockito/mockito-core@5.15.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.sonarsource.api.plugin:sonar-plugin-api is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/org.sonarsource.api.plugin/sonar-plugin-api@13.4.2.4284

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.sonarsource.api.plugin/sonar-plugin-api@13.4.2.4284. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.springframework:spring-beans is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/org.springframework/spring-beans@6.2.16

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.springframework/spring-beans@6.2.16. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.springframework:spring-context is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/org.springframework/spring-context@6.2.16

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.springframework/spring-context@6.2.16. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.springframework:spring-context is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/org.springframework/spring-context@6.2.16

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.springframework/spring-context@6.2.16. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.springframework:spring-context is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/org.springframework/spring-context@6.2.16

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.springframework/spring-context@6.2.16. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.springframework:spring-core is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/org.springframework/spring-core@6.2.16

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.springframework/spring-core@6.2.16. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
Obfuscated code: maven org.springframework:spring-core is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pom.xmlmaven/org.sonarsource.sonarlint.core/sonarlint-analysis-engine@11.3.0.85510maven/org.springframework/spring-core@6.2.16

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore maven/org.springframework/spring-core@6.2.16. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

aksOps added 3 commits May 24, 2026 15:34
… class files)

LTA 2026.1's sonarlint-analysis-engine is compiled for Java 21. A javac
on JDK 17 cannot read its class files and bails out with:

  cannot access org.sonarsource.sonarlint.core.analysis.AnalysisScheduler
    bad class file: .../sonarlint-analysis-engine-11.3.0.85510.jar(...)
    class file has wrong version 65.0, should be 61.0

The local 335-test gate masked this because the dev machine was on JDK
25. CI on JDK 17 surfaced it on the first push.

Changes:
- pom.xml: maven.compiler.release/source/target 17 -> 21, with comment
  documenting the LTA-imposed minimum.
- .github/workflows/{ci,parity,publish,sonar}.yml: setup-java java-version
  '17' -> '21' (all four pipelines).
- src/main/staging/bin/sonar: MIN_MAJOR 17 -> 21, renamed is_java_17_plus
  -> is_java_min_plus, updated user-facing messages.
- src/main/staging/bin/sonar.bat: matched changes (GEQ 17 -> GEQ 21,
  messages).
- README.md: prerequisites table 'Java 17+' -> 'Java 21+'.
…le (3 HIGH)

Socket Security raised three HIGH-severity obfuscatedFile alerts against
ch.qos.logback:{logback-classic,logback-core}:1.5.13 on PR #8. Logback's
optimized class files trip Socket's static-analysis pattern detector;
it's almost certainly a false positive against a widely-trusted library,
but the right answer is to not depend on it from a project that has no
need for a concrete SLF4J binding.

The dep was added by Task 5 (NoOpAnalysisWarnings TDD) solely so the
unit test could capture log output via logback's ListAppender. Two test
sites used logback APIs; both refactored to stay on slf4j-api only:

- NoOpAnalysisWarnings gains a package-private mutable `log` field that
  defaults to the static slf4j Logger but can be replaced by tests with
  a Mockito-mocked org.slf4j.Logger. The production class still uses
  slf4j-api exclusively. NoOpAnalysisWarningsTest now verifies via
  verify(logger).warn(...) calls (5 tests, +1 for null-message behavior).

- EngineLog gains a static current() accessor that returns the most
  recently installed instance. HostPluginIntegrationTest now reads
  EngineLog.current().messages() directly to assert no
  NoSuchBeanDefinitionException, instead of capturing via logback's
  ROOT logger ListAppender.

pom.xml: ch.qos.logback:logback-classic:1.5.13 dep removed entirely;
mvn dependency:tree confirms logback no longer reaches the test
classpath via any transitive route.

Verified: mvn test = 336/336 pass on the host JDK 21 (was 335; the
refactored NoOpAnalysisWarningsTest gained one additional test for
null-message behavior).
…ld (S3077)

SonarCloud's quality gate flagged the volatile EngineLog reference
added in the previous commit:

  java:S3077 — Use a thread-safe type; adding 'volatile' is not enough
  to make this field thread-safe.

Switched to AtomicReference<EngineLog>. The rule's intent is that
mutable-state shared between threads should use the j.u.c.atomic types
even when each individual read/write is atomic; volatile only handles
visibility, not compound operations a future caller might add.

Tests unchanged (336/336).
@sonarqubecloud
Copy link
Copy Markdown

@aksOps aksOps merged commit 976a8c4 into main May 24, 2026
12 checks passed
@aksOps aksOps deleted the feat/sonar-lta-2026.1-migration branch May 24, 2026 16:37
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