I have a this code somewhere in my Android project:
public boolean isLoadInProgress(boolean privateLoad, boolean publicLoad) {
if (privateLoad && privateLoadInProgress) {
return true;
}
if (publicLoad && publicLoadInProgress) {
return true;
}
return false;
}
I get a lint warning at the second if statement: 'if' statement could be simplified. That's obviously because I could write as well:
return publicLoad && publicLoadInProgress;
However, I would like to keep it this way for readability. I know that there is some inline comment annotation for switching off the lint warning at that place, but I can't find it in the Android Lint documentation. Can you tell me what this annotation/comment was?
The simple code comment for disabling the warning is:
//noinspection SimplifiableIfStatement
This on top of the if-statement should switch off the warning only at that place.
In the example, this would be:
public boolean isLoadInProgress(boolean privateLoad, boolean publicLoad) {
if (privateLoad && privateLoadInProgress) {
return true;
}
//noinspection SimplifiableIfStatement
if (publicLoad && publicLoadInProgress) {
return true;
}
return false;
}