A false positive about the rule RSPEC-2974

Hi, I found a false positive about the rule RSPEC-2974, see the code below. SonarQube should not report a warning because the annotation @Value can generate a new public constructor in the class. Hence, this is a false positive.

import lombok.Value;
@Value
public class C {
  private C() {
    // ...
  }

  public static int magic(){
    return 42;
  }
}

I find the annotation lombok.Data also leads to this false positive.

import lombok.Data;
@Data
public class C {
  private C() {
    // ...
  }

  public static int magic(){
    return 42;
  }
}

Hey there.

What version of SonarQube are you using?

Hi Colin, I use SonarQube 9.2.3.

Since SonarQube v9.2.3 is almost a year old (and has been EOL since v9.3 came out), I would suggest upgrading to v9.7 to see if the issue persists. If it does, let us know!

Hi, @Colin.
Sonarqube10.2.0 still has the same problem. So the issue persists now.

Hey there.

Somehow 3 days ago one of our developers must have seen this post and created SONARJAVA-4614 with your example! Not sure how that happened since this post wasn’t flagged for them :laughing:

In any case, thanks for the report. You can track that ticket.