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

Affects Sonarqube Version:
Sonarqube version: 8.1.0.31237
sonar-scanner version: 4.2.0.1873-windows

Rule:
S3010: Static fields should not be updated in constructors

Description:
Unable to detect static variables updated in a special case: foo++.
This rule is implemented in java-checks-6.2.0.21135-sources.jar!\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;
        CONT++;
    }
}

Expected outcome:
false-negative

Running Sonarqube through:
command line

Hello,

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?

Best,
Quentin