[false-negative]S3010 can not detect static variables updated by "++"

Affects Sonarqube Version:
Sonarqube version:
sonar-scanner version:

S3010: Static fields should not be updated in constructors

Unable to detect static variables updated in a special case: foo++.
This rule is implemented in java-checks-!\org\sonar\java\checks\StaticFieldUpdateInConstructorCheck.java,
This rule first finds the static variable, and then finds the assignment by public void visitAssignmentExpression(AssignmentExpressionTree tree) {, maybe the ++ operation is not in the assignment statement

Code Sample demonstrating the issue:

public class Marciano {
    public String nombre;
    public static int CONT = 0;
    public Marciano(String n){
        nombre = n;

Expected outcome:

Running Sonarqube through:
command line


By looking at this test, it seems on purpose that increments/decrements were excluded since it seemed like a common pattern. My understanding is that the harmful behavior:

cause unreliable behavior at runtime since it will change the value for all instances of the class

is not that unreliable, and might be something expected, when you want to keep a counter or increase the value at each initialization. An example can be found in jdk6 Random.java (Okay, it’s old, but it’s just to show an example).

That being said, we are eager to discuss it further if you think this exception is not justified. Do you see any case where it could really be harmful?