Verify #1519 [java] UselessParenthesis: False Positive: "Prohibits the use of useless parentheses" when more than one line
This commit is contained in:
1 parent
093a813c0f
commit
522d0ea311
1 file changed
+20
+20
@@ -304,6 +304,26 @@ public class Example {
|
||||
private int calculate() {
|
||||
return (bytes[0] & 0xff) + ((bytes[1] & 0xff) << 8);
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>Verify #1519 [java] UselessParenthesis: False Positive: "Prohibits the use of useless parentheses" when more than one line</description>
|
||||
<expected-problems>2</expected-problems>
|
||||
<expected-linenumbers>3,7</expected-linenumbers>
|
||||
<code><![CDATA[
|
||||
public class Useless {
|
||||
public void method() {
|
||||
boolean isSkipped = (pokeNick.equals(pokemon.getNickname())
|
||||
&& renameResult.getNumber() == NicknamePokemonResponse.Result.UNSET_VALUE);
|
||||
|
||||
// now the same in one line
|
||||
boolean isSkipped2 = (pokeNick.equals(pokemon.getNickname()) && renameResult.getNumber() == NicknamePokemonResponse.Result.UNSET_VALUE);
|
||||
|
||||
// now without the outer parenthesis - no additional violation.
|
||||
boolean isSkipped3 = pokeNick.equals(pokemon.getNickname()) && renameResult.getNumber() == NicknamePokemonResponse.Result.UNSET_VALUE;
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
Reference in new issue
Block a user