Description of the problem / feature request:
ToStringReturnsNull can not detect the case return condition ? foo : null
This rule is implemented in error_prone_core-2.3.4-sources.jar!\com\google\errorprone\bugpatterns\ToStringReturnsNull.java,
and use node.getExpression().getKind() == NULL_LITERAL; to check whether null is returned,
Therefore, it will not detect those return null statements that make logical judgments when returning.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
@Override
public String toString() {
return this.mode == 'd' ? this.writer.toString() : null;
}
What version of Error Prone are you using?
2.3.4
Have you found anything relevant by searching the web?
no
Description of the problem / feature request:
ToStringReturnsNull can not detect the case
return condition ? foo : nullThis rule is implemented in error_prone_core-2.3.4-sources.jar!\com\google\errorprone\bugpatterns\ToStringReturnsNull.java,
and use
node.getExpression().getKind() == NULL_LITERAL;to check whether null is returned,Therefore, it will not detect those return null statements that make logical judgments when returning.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What version of Error Prone are you using?
2.3.4
Have you found anything relevant by searching the web?
no