False positive for java:S1128 (unused import) when used by Markdown Javadoc

  • What language is this for?
    • Java, relevant for 23
  • Which rule?
    • java:S1128 “Unnecessary imports should be removed”
  • Why do you believe it’s a false-positive/false-negative?
    • The rule description states “Imports for types mentioned in Javadocs are ignored.”, yet types mentioned in a Markdown-style Javadoc comment (cf. JEP 467) are marked as unused.
  • Are you using
    • SonarQube Community Build v25.1.0.102122
    • SonarQube for IDE in IntelliJ 2025.1.1.1, SonarQube version 10.24.0.81420
      • in connected mode with SonarQube Community Build as above
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
    • The following Java code, will raise violations on both import statements despite them being referenced from Javadoc (and two other legitimate violation).
import java.io.InputStream;
import java.io.Serializable;

/// This is a Markdown Javadoc comment.
/// It references [Serializable] and [the transferTo method of InputStream][InputStream#transferTo].
public class Scratch {
  public static void main(String[] args) {
    
  }
}

Hey @loritzm

Can you try SonarQube for IntelliJ 10.25? It should embed a new version of our Java analyzer that supports Java 23. Give it a try and see if you still get the FP.

:warning: Only the latest version of SonarQube Community Build is considered active, so you’ll need to upgrade and see if the situation is still replicable.

Your upgrade path is:

25.1 → 25.6

You may find these resources helpful: