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
C:\Users\noel\Documents\GitHub\h2database-noel\h2\src\main\org\h2\table\TableLink.java:124: error: [IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to rs.next().
if (rs.next() && rs.next()) {
^
(see http://errorprone.info/bugpattern/IdentityBinaryExpression)
1 error
I agree this is a false positive, thanks for the report.
One work-around is to refactor that to move some of the side-effects out of the binary expression, which may make it clearer to the reader that there are side-effects and checking the value twice is deliberate. E.g.:
What version of Error Prone are you using?
2.2.0
Warning message is:
C:\Users\noel\Documents\GitHub\h2database-noel\h2\src\main\org\h2\table\TableLink.java:124: error: [IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to
rs.next()
.if (rs.next() && rs.next()) {
^
(see http://errorprone.info/bugpattern/IdentityBinaryExpression)
1 error
Code looks like:
ResultSet rs = meta.getTables(null, originalSchema, originalTable, null);
if (rs.next() && rs.next()) {
throw DbException.get(ErrorCode.SCHEMA_NAME_MUST_MATCH, originalTable);
}
Probably ResultSet::next should be treated like Iterator next method
The text was updated successfully, but these errors were encountered: