You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, DLS_OVERWRITTEN_INCREMENT mentioned "increment/decrement", other three bug patterns just indicated "increment" without "decrement". So are in their examples of ++ not including --.
And I wrote tests for checking whether all of them support both increment and decrement.
//DLS_DEAD_LOCAL_INCREMENT_IN_RETURN for ++inttestDLS_DEAD_LOCAL_INCREMENT_IN_RETURN(){
inti = 0;
returni++; // Warning
}
//DLS_DEAD_LOCAL_INCREMENT_IN_RETURN for --inttestDLS_DEAD_LOCAL_INCREMENT_IN_RETURN1(){
inti = 0;
returni--; // Warning
}
//DLS_OVERWRITTEN_INCREMENT for ++voidtestDLS_OVERWRITTEN_INCREMENT(){
inti = 0;
i = i++; // Warning
}
//DLS_OVERWRITTEN_INCREMENT for --voidtestDLS_OVERWRITTEN_INCREMENT1(){
inti = 0;
i = i--; // Warning
}
//VO_VOLATILE_INCREMENT for ++privatevolatileintx = 0;
voidtestVO_VOLATILE_INCREMENT() {
try {
x++; // Warning
} finally {
}
}
//VO_VOLATILE_INCREMENT for --voidtestVO_VOLATILE_INCREMENT1() {
try {
x--; // Warning
} finally {
}
}
//QF_QUESTIONABLE_FOR_LOOP for ++voidtestQF_QUESTIONABLE_FOR_LOOP(){
inti = 0;
for(intj = 0; j < 10; i++){ // WarningSystem.out.println("Hi");
j++;
}
}
//QF_QUESTIONABLE_FOR_LOOP for --voidtestQF_QUESTIONABLE_FOR_LOOP1(){
inti = 0;
for(intj = 0; j < 10; i--){ // WarningSystem.out.println("Hi");
j--;
}
}
As can be seen from results, both increment and decrement are supported in all four bug patterns mentioned above.
Therefore, it would be better to add decrement in their bug description so that it is not confusing when users reading.
The text was updated successfully, but these errors were encountered:
I found an inconsistency when reading the SpotBugs Bug Description.
All four bug patterns - DLS_DEAD_LOCAL_INCREMENT_IN_RETURN, DLS_OVERWRITTEN_INCREMENT, VO_VOLATILE_INCREMENT, and QF_QUESTIONABLE_FOR_LOOP are related to "increment" of a variable.
However, DLS_OVERWRITTEN_INCREMENT mentioned "increment/decrement", other three bug patterns just indicated "increment" without "decrement". So are in their examples of
++
not including--
.And I wrote tests for checking whether all of them support both increment and decrement.
As can be seen from results, both increment and decrement are supported in all four bug patterns mentioned above.
Therefore, it would be better to add decrement in their bug description so that it is not confusing when users reading.
The text was updated successfully, but these errors were encountered: