Product: SonarQube Community (self-hosted)
sonar-java version: sonar-java 8.28.0.43176 on SonarQube Community Build 26.4.0.121862
Java source level: 21 (javac 21, source/target 17)
Rule
java:S7476 — A single-line comment should start with exactly two slashes, no more.
(also affects java:S1123 and java:S1133, which misfire on the same construct)
Description
SonarJava does not support Java 23 Markdown documentation comments (///). It treats them as malformed single-line comments instead of Javadoc, which causes cascading false positives: S7476 flags the comment syntax, while S1123 and S1133 fail to recognize the valid @deprecated documentation inside the Markdown Javadoc. The equivalent traditional /** ... */ Javadoc does not trigger these issues.
Reproducer
package demo;
/// Legacy calculator utility.
/// Provides basic arithmetic helpers.
public class Sample {
/// Adds two integers.
///
/// @param a first operand
/// @param b second operand
/// @return the sum of a and b
/// @deprecated use {@link #addSafe(int, int)} instead
@Deprecated
public int add(int a, int b) {
return a + b;
}
public int addSafe(int a, int b) {
return a + b;
}
}
The equivalent /** ... */ form does not raise S7476, S1123, or S1133:
/**
* Adds two integers.
* @deprecated use {@link #addSafe(int, int)} instead
*/
@Deprecated
public int add(int a, int b) { return a + b; }