From 09b0864eff98404d38a82a6888dd52ea1b391c22 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Tue, 22 Oct 2024 20:50:10 +0200 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Fournier --- pmd-java/src/main/resources/category/java/errorprone.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pmd-java/src/main/resources/category/java/errorprone.xml b/pmd-java/src/main/resources/category/java/errorprone.xml index 8aa8961a6f..2d7cacb281 100644 --- a/pmd-java/src/main/resources/category/java/errorprone.xml +++ b/pmd-java/src/main/resources/category/java/errorprone.xml @@ -3127,13 +3127,14 @@ public boolean test(String s) { -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. 3