The code below triggers the S2333 rule with the message "private" is redundant in this context
.
According to Oracle, “The constructor for an enum type must be package-private or private access”, So, in this case, private
is not redundant; if it is not used, the enum constructor be would package private, which is not what is wanted.
Versions used: SonarQube 7.9.2, scanner 4.4.0, Java plugin 6.3.2
public enum Axis {
X("X axis"),
Y("Y axis"),
Z("Z axis");
private final String text;
private Axis(String s) { this.text = s; }
public String getLabel() { return text; }
}