Apply suggestions from code review
Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
This commit is contained in:
@ -3127,13 +3127,14 @@ public boolean test(String s) {
|
||||
<rule name="UselessOperationOnImmutable"
|
||||
language="java"
|
||||
since="3.5"
|
||||
message="An operation on an Immutable object (String, BigDecimal, BigInteger or java.time.*) won't change the object itself"
|
||||
message="The result of an operation on an immutable object is ignored"
|
||||
class="net.sourceforge.pmd.lang.java.rule.errorprone.UselessOperationOnImmutableRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#uselessoperationonimmutable">
|
||||
<description>
|
||||
An operation on an Immutable object (`String`, `BigDecimal`, `BigInteger` or any type from `java.time.*`)
|
||||
won't change the object itself since the result of the operation is a new object.
|
||||
Therefore, ignoring the operation result is an error.
|
||||
An operation on an immutable object will not change the object itself since the result of the operation is a new object.
|
||||
Therefore, ignoring the result of such an operation is likely a mistake. The operation can probably be removed.
|
||||
|
||||
This rule recognizes the types `String`, `BigDecimal`, `BigInteger` or any type from `java.time.*` as immutable.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<example>
|
||||
|
Reference in New Issue
Block a user