org.sonar.l10n.java.rules.squid.S2123.html Maven / Gradle / Ivy
The newest version!
A value that is incremented or decremented and then not stored is at best wasted code and at worst a bug.
Noncompliant Code Example
public int pickNumber() {
int i = 0;
int j = 0;
i = i++; // Noncompliant; i is still zero
return j++; // Noncompliant; 0 returned
}
Compliant Solution
public int pickNumber() {
int i = 0;
int j = 0;
i++;
return ++j;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy