# \#java21

**URL:** https://community.sonarsource.com/tag/java21/405.md

[Latest](https://community.sonarsource.com/latest.md) · [Categories](https://community.sonarsource.com/categories.md) · [Tags](https://community.sonarsource.com/tags.md)

---

## [Reminder: Upgrade to Java 21 for SonarQube Cloud analysis by July 20, 2026](https://community.sonarsource.com/t/reminder-upgrade-to-java-21-for-sonarqube-cloud-analysis-by-july-20-2026/185820)

<div class="topic-metadata">

**Author:** [@andres](https://community.sonarsource.com/u/andres)\
**Replies:** 0\
**Last updated:** [July 13, 2026, 3:43pm UTC](https://community.sonarsource.com/t/reminder-upgrade-to-java-21-for-sonarqube-cloud-analysis-by-july-20-2026/185820 "2026-07-13T15:43:31Z")

</div>

Hi, We’re sharing a reminder about an upcoming change to SonarQube Cloud that may mean changes are needed on your side. Starting July 20, analyses running on SonarQube Cloud with a Java runtime lower than 21 will no lo…

---

## [Brownout Notice: Phasing out Java \< 21 as a Scanner Runtime on SonarQube Cloud](https://community.sonarsource.com/t/brownout-notice-phasing-out-java-21-as-a-scanner-runtime-on-sonarqube-cloud/185016)

<div class="topic-metadata">

**Author:** [@Julien\_HENRY](https://community.sonarsource.com/u/Julien_HENRY)\
**Replies:** 2\
**Last updated:** [July 9, 2026, 2:13pm UTC](https://community.sonarsource.com/t/brownout-notice-phasing-out-java-21-as-a-scanner-runtime-on-sonarqube-cloud/185016 "2026-07-09T14:13:11Z")

</div>

Hi, As previously communicated in Phasing out Java 17 as a Scanner Runtime we are going to stop supporting Java runtime lower than 21 to run Sonar analysis. Despite the warning in logs and in the SonarQube UI, we are s…

---

## [Phasing out Java 17 as a Scanner Runtime](https://community.sonarsource.com/t/phasing-out-java-17-as-a-scanner-runtime/153678)

<div class="topic-metadata">

**Author:** [@jibiel](https://community.sonarsource.com/u/jibiel)\
**Replies:** 1\
**Last updated:** [December 11, 2025, 7:41am UTC](https://community.sonarsource.com/t/phasing-out-java-17-as-a-scanner-runtime/153678 "2025-12-11T07:41:09Z")

</div>

We are deprecating Java 17 as a supported scanner runtime environment. This change is necessary because Java 17 is approaching its end-of-support from key vendors, and we are transitioning to support Java 21 and 25. Key…

---

## [FP java:S2259 reports possible NPE for switch case after null case](https://community.sonarsource.com/t/fp-java-s2259-reports-possible-npe-for-switch-case-after-null-case/152170)

<div class="topic-metadata">

**Author:** [@ahubold](https://community.sonarsource.com/u/ahubold)\
**Replies:** 1\
**Last updated:** [November 11, 2025, 8:42am UTC](https://community.sonarsource.com/t/fp-java-s2259-reports-possible-npe-for-switch-case-after-null-case/152170 "2025-11-11T08:42:43Z")

</div>

SonarQube Community Build 25.11.0.114957 Java Code Rule S2259 Null pointers should not be dereferenced S2259 reports an issue for the the following Java code: package org.example; import org.jspecify.annotations.NullM…

---

## [kotlin:S1874 False positives on some List methods with Java 21](https://community.sonarsource.com/t/kotlin-s1874-false-positives-on-some-list-methods-with-java-21/105367)

<div class="topic-metadata">

**Author:** [@GeorgEchterling](https://community.sonarsource.com/u/GeorgEchterling)\
**Replies:** 11\
**Last updated:** [August 13, 2025, 9:38am UTC](https://community.sonarsource.com/t/kotlin-s1874-false-positives-on-some-list-methods-with-java-21/105367 "2025-08-13T09:38:29Z")

</div>

SonarQube sometimes reports deprecation warnings (kotlin:S1874) for List methods that aren’t deprecated. Kotlin’s List\<T\>.first() extension method. Java’s List.removeLast() method. This happened immediately after I up…

---

## [False Positive w/ javaarchitecture:S7027 when using sealed interfaces](https://community.sonarsource.com/t/false-positive-w-javaarchitecture-s7027-when-using-sealed-interfaces/134732)

<div class="topic-metadata">

**Author:** [@efenderbosch](https://community.sonarsource.com/u/efenderbosch)\
**Replies:** 4\
**Last updated:** [March 11, 2025, 12:58pm UTC](https://community.sonarsource.com/t/false-positive-w-javaarchitecture-s7027-when-using-sealed-interfaces/134732 "2025-03-11T12:58:49Z")

</div>

rule javaarchitecture:S7027 is detecting false circular dependencies with sealed interfaces and their concrete implementations reproduction: create a sealed interface create multiple concrete implementations (java rec…

---

## [Unable to run check class org.sonar.java.ast.visitors.SyntaxHighlighterVisitor](https://community.sonarsource.com/t/unable-to-run-check-class-org-sonar-java-ast-visitors-syntaxhighlightervisitor/113936)

<div class="topic-metadata">

**Author:** [@hd42](https://community.sonarsource.com/u/hd42)\
**Replies:** 1\
**Last updated:** [April 29, 2024, 12:46pm UTC](https://community.sonarsource.com/t/unable-to-run-check-class-org-sonar-java-ast-visitors-syntaxhighlightervisitor/113936 "2024-04-29T12:46:58Z")

</div>

We updated to SonarQube 10.5 to finally get Java 21 support. Mostly works fine, but one file seems to make trouble for the SyntaxHighlighterVisitor. The file in question is this: /\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*…

---

## [SonarCloud supports Java 21 code scanning!](https://community.sonarsource.com/t/sonarcloud-supports-java-21-code-scanning/109681)

<div class="topic-metadata">

**Author:** [@Alexandre\_Gigleux](https://community.sonarsource.com/u/Alexandre_Gigleux)\
**Replies:** 14\
**Last updated:** [November 28, 2024, 2:26pm UTC](https://community.sonarsource.com/t/sonarcloud-supports-java-21-code-scanning/109681 "2024-11-28T14:26:57Z")

</div>

Hello Java Developers, Thanks for your patience, I know some of you expected it to come earlier but that was not as easy as planned. Anyway, it’s there, SonarCloud supports Java 21 code scanning! As usual, nothing spe…

---

## [Try-with-resources should be used - Rule ID:java:S2093 - Potential False Negative - Java](https://community.sonarsource.com/t/try-with-resources-should-be-used-rule-ids2093-potential-false-negative-java/125062)

<div class="topic-metadata">

**Author:** [@Matt\_Casperson](https://community.sonarsource.com/u/Matt_Casperson)\
**Replies:** 3\
**Last updated:** [October 8, 2024, 8:43am UTC](https://community.sonarsource.com/t/try-with-resources-should-be-used-rule-ids2093-potential-false-negative-java/125062 "2024-10-08T08:43:03Z")

</div>

Make sure to read this post before raising a thread here: Then tell us: What language is this for? \> Java Which rule? \> Try-with-resources should be used - Rule ID:java:S2093 Why do you believe it’s a false-positive/…

---

## [When do you plan to support the Java 21 LTS for the sonar-maven-plugin?](https://community.sonarsource.com/t/when-do-you-plan-to-support-the-java-21-lts-for-the-sonar-maven-plugin/102106)

<div class="topic-metadata">

**Author:** [@thom1](https://community.sonarsource.com/u/thom1)\
**Replies:** 32\
**Last updated:** [September 6, 2024, 10:26am UTC](https://community.sonarsource.com/t/when-do-you-plan-to-support-the-java-21-lts-for-the-sonar-maven-plugin/102106 "2024-09-06T10:26:45Z")

</div>

Hi :smiley:, When do you plan to support the Java 21 LTS for the sonar-maven-plugin? Cheers, Thom1

---

## [jakarta.inject.Inject is not excluded in - java:S107 too many parameters](https://community.sonarsource.com/t/jakarta-inject-inject-is-not-excluded-in-java-s107-too-many-parameters/117493)

<div class="topic-metadata">

**Author:** [@gatti\_naresh\_babu](https://community.sonarsource.com/u/gatti_naresh_babu)\
**Replies:** 7\
**Last updated:** [June 20, 2024, 1:21pm UTC](https://community.sonarsource.com/t/jakarta-inject-inject-is-not-excluded-in-java-s107-too-many-parameters/117493 "2024-06-20T13:21:54Z")

</div>

What language is this for? - Java Which rule? - Methods should not have too many parameters (java:S107) Why do you believe it’s a false-positive/false-negative? Because Inject annotation should exclude in this r…
