You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/02/09 23:32:44 UTC

(commons-collections) branch master updated (34705e73c -> 25969078b)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git


    from 34705e73c Bump github/codeql-action from 3.28.8 to 3.28.9
     new 106808e20 Sort Checkstyle entries
     new 8addbd6f0 Add Checkstyle ArrayTypeStyle
     new 90852da34 Add Checkstyle CovariantEquals
     new 8e408017a Add Checkstyle DefaultComesLast
     new 2e0cd7ae3 Nomalize moduile name
     new c6305a5d6 Add Checkstyle EmptyBlock
     new e97ed2826 Add Checkstyle EqualsHashCode
     new 153bb2256 Add Checkstyle FallThrough
     new eb6561d21 Add Checkstyle FinalLocalVariable
     new 0afd0b35b Add Checkstyle IllegalInstantiation
     new 4bb493225 Add Checkstyle MultipleVariableDeclarations
     new 99ae265fb Add Checkstyle SimplifyBooleanExpression
     new bb2ebee5e Add Checkstyle SimplifyBooleanReturn
     new 0cce8df41 Add Checkstyle StringLiteralEquality
     new c446d250c Add Checkstyle SuperFinalize
     new b0f126809 Add Checkstyle SuperClone
     new 25969078b Add Checkstyle UnnecessaryParentheses

The 17 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/conf/checkstyle.xml                            | 77 +++++++++++++---------
 .../collections4/map/AbstractReferenceMap.java     |  6 +-
 .../map/ConcurrentReferenceHashMap.java            |  4 +-
 .../apache/commons/collections4/map/Flat3Map.java  |  8 +--
 .../trie/analyzer/StringKeyAnalyzer.java           |  3 +-
 .../commons/collections4/ArrayUtilsTest.java       |  6 ++
 .../commons/collections4/MapPerformance.java       |  3 +-
 .../apache/commons/collections4/MapUtilsTest.java  |  2 +-
 .../commons/collections4/bag/AbstractBagTest.java  |  8 ++-
 .../bloomfilter/LayeredBloomFilterTest.java        |  2 +-
 .../collection/CompositeCollectionTest.java        |  2 +-
 .../comparators/ComparatorChainTest.java           |  5 ++
 .../collections4/functors/EqualPredicateTest.java  |  5 ++
 .../list/NodeCachingLinkedListTest.java            |  6 +-
 .../commons/collections4/map/LRUMapTest.java       |  6 ++
 .../multiset/AbstractMultiSetTest.java             |  8 ++-
 16 files changed, 100 insertions(+), 51 deletions(-)


(commons-collections) 04/17: Add Checkstyle DefaultComesLast

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 8e408017aef3894d15d535dbd17d5f49c07e34b0
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:07:17 2025 -0500

    Add Checkstyle DefaultComesLast
---
 src/conf/checkstyle.xml                                         | 1 +
 src/main/java/org/apache/commons/collections4/map/Flat3Map.java | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 197809dc2..238381046 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -52,6 +52,7 @@ limitations under the License.
     <module name="ArrayTypeStyle" />
     <module name="AvoidStarImport"/>
     <module name="CovariantEquals" />
+    <module name="DefaultComesLast" />
     <module name="ExplicitInitializationCheck" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>
diff --git a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
index ec304b698..334682cac 100644
--- a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
+++ b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java
@@ -980,10 +980,6 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
 
         // add new mapping
         switch (size) {
-        default:
-            convertToMap();
-            delegateMap.put(key, value);
-            return null;
         case 2:
             hash3 = key == null ? 0 : key.hashCode();
             key3 = key;
@@ -999,6 +995,10 @@ public class Flat3Map<K, V> implements IterableMap<K, V>, Serializable, Cloneabl
             key1 = key;
             value1 = value;
             break;
+        default:
+            convertToMap();
+            delegateMap.put(key, value);
+            return null;
         }
         size++;
         return null;


(commons-collections) 15/17: Add Checkstyle SuperFinalize

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit c446d250c54f17fdc6b0a0fb444fa1f01e45d3ad
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:29:58 2025 -0500

    Add Checkstyle SuperFinalize
---
 src/conf/checkstyle.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 2d45782a1..1c938d028 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -87,6 +87,7 @@ limitations under the License.
     <module name="SimplifyBooleanExpression" />
     <module name="SimplifyBooleanReturn" />
     <module name="StringLiteralEquality" />
+    <module name="SuperFinalize" />
     <module name="TypecastParenPad" />    
     <module name="UpperEll" />
     <module name="UnusedImports"/>


(commons-collections) 16/17: Add Checkstyle SuperClone

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit b0f126809969370c309e2b5f91951d4676f81bbf
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:30:22 2025 -0500

    Add Checkstyle SuperClone
---
 src/conf/checkstyle.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 1c938d028..cb6628fbd 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -87,6 +87,7 @@ limitations under the License.
     <module name="SimplifyBooleanExpression" />
     <module name="SimplifyBooleanReturn" />
     <module name="StringLiteralEquality" />
+    <module name="SuperClone" />
     <module name="SuperFinalize" />
     <module name="TypecastParenPad" />    
     <module name="UpperEll" />


(commons-collections) 01/17: Sort Checkstyle entries

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 106808e20c6d5a60e09aec0c22412131412f835f
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:05:19 2025 -0500

    Sort Checkstyle entries
---
 src/conf/checkstyle.xml | 60 ++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index f4762f33a..884ac2022 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -23,60 +23,60 @@ limitations under the License.
 <!-- Apache Commons Collections customization of default Checkstyle behavior -->
 <module name="Checker">
   <property name="localeLanguage" value="en"/>
+  <module name="FileTabCharacter">
+    <property name="fileExtensions" value="java,xml"/>
+  </module>
+  <module name="Header">
+    <property name="headerFile" value="${checkstyle.header.file}"/>
+  </module>
   <module name="JavadocPackage"/>
   <module name="NewlineAtEndOfFile">
     <property name="lineSeparator" value="lf" />
   </module>
-  <module name="FileTabCharacter">
-    <property name="fileExtensions" value="java,xml"/>
-  </module>
   <module name="RegexpSingleline">
     <!-- \s matches whitespace character, $ matches end of line. -->
     <property name="format" value="\s+$"/>
     <property name="message" value="Line has trailing spaces."/>
   </module>
+  <!-- @author tags are deprecated -->
+  <module name="RegexpSingleline">
+    <property name="format" value="^\s+\*\s+@author\s" />
+    <property name="message" value="Deprecated @author tag" />
+    <property name="fileExtensions" value="java" />
+    <property name="severity" value="warning" />
+  </module>
   <module name="SuppressionFilter">
     <property name="file" value="${checkstyle.suppressions.file}"/>
   </module>
-  <module name="Header">
-    <property name="headerFile" value="${checkstyle.header.file}"/>
-  </module>
   <module name="TreeWalker">
-    <module name="ExplicitInitializationCheck" />
     <module name="AvoidStarImport"/>
+    <module name="ExplicitInitializationCheck" />
+    <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>
-    <module name="RedundantImport"/>
-    <module name="UnusedImports"/>
-    <module name="NeedBraces"/>
+    <module name="ImportOrder">
+      <property name="option" value="top"/>
+      <property name="groups" value="java,javax,junit,org,com"/>
+      <property name="ordered" value="true"/>
+      <property name="separated" value="true"/>
+    </module>
     <module name="JavadocMethod">
       <property name="accessModifiers" value="protected" />
     </module>
+    <module name="LeftCurly"/>
     <module name="MethodParamPad"/>
     <module name="ModifierOrder"/>
-    <module name="RedundantModifier"/>
-    <module name="UpperEll" />
-    <module name="LeftCurly"/>
+    <module name="NeedBraces"/>
+    <module name="NoWhitespaceBefore"/>
+    <module name="NoWhitespaceBeforeCaseDefaultColon"/>
     <module name="NeedBraces"/>
     <module name="ParenPad"/>
+    <module name="RedundantModifier"/>
     <module name="RightCurly"/>
-    <module name="GenericWhitespace"/>
+    <module name="RedundantImport"/>
+    <module name="TypecastParenPad" />    
+    <module name="UpperEll" />
+    <module name="UnusedImports"/>
     <module name="WhitespaceAfter"/>
     <module name="WhitespaceAround"/>
-    <module name="NoWhitespaceBefore"/>
-    <module name="NoWhitespaceBeforeCaseDefaultColon"/>
-    <module name="ImportOrder">
-      <property name="option" value="top"/>
-      <property name="groups" value="java,javax,junit,org,com"/>
-      <property name="ordered" value="true"/>
-      <property name="separated" value="true"/>
-    </module>
-    <module name="TypecastParenPad" />    
-  </module>
-  <!-- @author tags are deprecated -->
-  <module name="RegexpSingleline">
-    <property name="format" value="^\s+\*\s+@author\s" />
-    <property name="message" value="Deprecated @author tag" />
-    <property name="fileExtensions" value="java" />
-    <property name="severity" value="warning" />
   </module>
 </module>


(commons-collections) 07/17: Add Checkstyle EqualsHashCode

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit e97ed28266faf2fa632e860db27bfe32168d4f1e
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:16:07 2025 -0500

    Add Checkstyle EqualsHashCode
---
 src/conf/checkstyle.xml                                             | 1 +
 src/test/java/org/apache/commons/collections4/ArrayUtilsTest.java   | 6 ++++++
 .../commons/collections4/comparators/ComparatorChainTest.java       | 5 +++++
 .../apache/commons/collections4/functors/EqualPredicateTest.java    | 5 +++++
 src/test/java/org/apache/commons/collections4/map/LRUMapTest.java   | 6 ++++++
 5 files changed, 23 insertions(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 0a9b54113..c5c63f7ac 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -56,6 +56,7 @@ limitations under the License.
     <module name="EmptyBlock">
       <property name="option" value="text" />
     </module>
+    <module name="EqualsHashCode" />
     <module name="ExplicitInitialization" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>
diff --git a/src/test/java/org/apache/commons/collections4/ArrayUtilsTest.java b/src/test/java/org/apache/commons/collections4/ArrayUtilsTest.java
index 3d8668d9b..10f262037 100644
--- a/src/test/java/org/apache/commons/collections4/ArrayUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/ArrayUtilsTest.java
@@ -44,6 +44,12 @@ public class ArrayUtilsTest {
             public boolean equals(final Object o) {
                 return true;
             }
+
+            @Override
+            public int hashCode() {
+                // Pairs with equals()
+                return super.hashCode();
+            }
         }
         class LANG1261ChildObject extends LANG1261ParentObject {
         }
diff --git a/src/test/java/org/apache/commons/collections4/comparators/ComparatorChainTest.java b/src/test/java/org/apache/commons/collections4/comparators/ComparatorChainTest.java
index 5c700836f..bd00fcd6f 100644
--- a/src/test/java/org/apache/commons/collections4/comparators/ComparatorChainTest.java
+++ b/src/test/java/org/apache/commons/collections4/comparators/ComparatorChainTest.java
@@ -83,6 +83,11 @@ public class ComparatorChainTest extends AbstractComparatorTest<ComparatorChainT
             return getColumn(0) == row.getColumn(0) && getColumn(1) == row.getColumn(1) && getColumn(2) == row.getColumn(2);
         }
 
+        @Override
+        public int hashCode() {
+            return Arrays.hashCode(cols);
+        }
+
         public int getColumn(final int colIndex) {
             return cols[colIndex];
         }
diff --git a/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java b/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java
index bb9627bbc..9aa17fbe3 100644
--- a/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java
+++ b/src/test/java/org/apache/commons/collections4/functors/EqualPredicateTest.java
@@ -33,6 +33,11 @@ public class EqualPredicateTest extends AbstractPredicateTest {
         public boolean equals(final Object obj) {
             return b;
         }
+
+        @Override
+        public int hashCode() {
+            return Boolean.hashCode(b);
+        }
     }
 
     private static final EqualsTestObject FALSE_OBJECT = new EqualsTestObject(false);
diff --git a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
index 400ae3317..a5c1e4605 100644
--- a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java
@@ -115,6 +115,12 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> {
             this.code = code;
         }
 
+        @Override
+        public boolean equals(Object o) {
+            // Pairs with equals()
+            return super.equals(o);
+        }
+
         @Override
         public int hashCode() {
             // always return the same hash code


(commons-collections) 08/17: Add Checkstyle FallThrough

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 153bb2256c2a7b114c4cc1edc2c916e1b619a7a9
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:16:39 2025 -0500

    Add Checkstyle FallThrough
---
 src/conf/checkstyle.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index c5c63f7ac..5dd93d44d 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -58,6 +58,7 @@ limitations under the License.
     </module>
     <module name="EqualsHashCode" />
     <module name="ExplicitInitialization" />
+    <module name="FallThrough" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>
     <module name="ImportOrder">


(commons-collections) 03/17: Add Checkstyle CovariantEquals

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 90852da344c3c5f6ce13349b9d62665d631eb1a4
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:06:27 2025 -0500

    Add Checkstyle CovariantEquals
---
 src/conf/checkstyle.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index bb7262d93..197809dc2 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -51,6 +51,7 @@ limitations under the License.
   <module name="TreeWalker">
     <module name="ArrayTypeStyle" />
     <module name="AvoidStarImport"/>
+    <module name="CovariantEquals" />
     <module name="ExplicitInitializationCheck" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>


(commons-collections) 17/17: Add Checkstyle UnnecessaryParentheses

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 25969078b5f1ef2942e9c00113c46e50b7fa08a5
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:32:36 2025 -0500

    Add Checkstyle UnnecessaryParentheses
---
 src/conf/checkstyle.xml                                                 | 1 +
 src/test/java/org/apache/commons/collections4/MapUtilsTest.java         | 2 +-
 .../apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index cb6628fbd..74e94b2e2 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -91,6 +91,7 @@ limitations under the License.
     <module name="SuperFinalize" />
     <module name="TypecastParenPad" />    
     <module name="UpperEll" />
+    <module name="UnnecessaryParentheses" />
     <module name="UnusedImports"/>
     <module name="WhitespaceAfter"/>
     <module name="WhitespaceAround"/>
diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
index 5a33af9ef..edb7d8dd7 100644
--- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
+++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java
@@ -416,7 +416,7 @@ public class MapUtilsTest {
         assertEquals(val, MapUtils.getByteValue(in, "key", val), 0);
         assertEquals(val, MapUtils.getByteValue(in, "key"), 0);
         assertEquals(val, MapUtils.getByteValue(in, "noKey", val), 0);
-        assertEquals(val, MapUtils.getByteValue(in, "noKey", key -> ((byte) 100)), 0);
+        assertEquals(val, MapUtils.getByteValue(in, "noKey", key -> (byte) 100), 0);
         assertEquals(0, MapUtils.getByteValue(in, "noKey"), 0);
         assertEquals(val, MapUtils.getByte(in, "key", val), 0);
         assertEquals(val, MapUtils.getByte(in, "noKey", val), 0);
diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java
index 34eeab657..b5c5a2ee9 100644
--- a/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java
+++ b/src/test/java/org/apache/commons/collections4/bloomfilter/LayeredBloomFilterTest.java
@@ -235,7 +235,7 @@ public class LayeredBloomFilterTest extends AbstractBloomFilterTest<LayeredBloom
         final LayerManager<NumberedBloomFilter> layerManager = LayerManager.<NumberedBloomFilter>builder()
                 .setSupplier(() -> new NumberedBloomFilter(getTestShape(), 3, sequence[0]++))
                 .setExtendCheck(ExtendCheck.neverAdvance())
-                .setCleanup(ll -> ll.removeIf(f -> (f.value-- == 0))).get();
+                .setCleanup(ll -> ll.removeIf(f -> f.value-- == 0)).get();
         final LayeredBloomFilter<NumberedBloomFilter> underTest = new LayeredBloomFilter<>(getTestShape(), layerManager);
         assertEquals(1, underTest.getDepth());
         underTest.merge(TestingHashers.randomHasher());


(commons-collections) 10/17: Add Checkstyle IllegalInstantiation

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 0afd0b35bd3116a2c8d34baef7cdd01cb8727819
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:18:14 2025 -0500

    Add Checkstyle IllegalInstantiation
---
 src/conf/checkstyle.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index bae81d016..4b56aa203 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -62,6 +62,7 @@ limitations under the License.
     <module name="FinalLocalVariable" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>
+    <module name="IllegalInstantiation" />
     <module name="ImportOrder">
       <property name="option" value="top"/>
       <property name="groups" value="java,javax,junit,org,com"/>


(commons-collections) 05/17: Nomalize moduile name

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 2e0cd7ae3c2e54df210fcc6587167abc34621ef1
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:07:37 2025 -0500

    Nomalize moduile name
---
 src/conf/checkstyle.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 238381046..cc481d4f6 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -53,7 +53,7 @@ limitations under the License.
     <module name="AvoidStarImport"/>
     <module name="CovariantEquals" />
     <module name="DefaultComesLast" />
-    <module name="ExplicitInitializationCheck" />
+    <module name="ExplicitInitialization" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>
     <module name="ImportOrder">


(commons-collections) 14/17: Add Checkstyle StringLiteralEquality

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 0cce8df410b8399df6db792ad78f496648eb2e1a
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:26:55 2025 -0500

    Add Checkstyle StringLiteralEquality
---
 src/conf/checkstyle.xml                                                 | 1 +
 .../apache/commons/collections4/collection/CompositeCollectionTest.java | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 4cf6e97e6..2d45782a1 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -86,6 +86,7 @@ limitations under the License.
     <module name="RightCurly"/>
     <module name="SimplifyBooleanExpression" />
     <module name="SimplifyBooleanReturn" />
+    <module name="StringLiteralEquality" />
     <module name="TypecastParenPad" />    
     <module name="UpperEll" />
     <module name="UnusedImports"/>
diff --git a/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
index ed576d61f..4a2750d9d 100644
--- a/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
+++ b/src/test/java/org/apache/commons/collections4/collection/CompositeCollectionTest.java
@@ -380,7 +380,7 @@ public class CompositeCollectionTest<E> extends AbstractCollectionTest<E> {
         two.add((E) "2");
         two.add((E) "1");
         // need separate list to remove, as otherwise one clears itself
-        final Predicate<E> predicate = e -> e == "1";
+        final Predicate<E> predicate = e -> "1".equals(e);
         c.addComposited(one, two);
         c.removeIf(predicate);
         assertFalse(c.contains("1"));


(commons-collections) 06/17: Add Checkstyle EmptyBlock

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit c6305a5d6330d848519a9362de573365eab8d915
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:08:03 2025 -0500

    Add Checkstyle EmptyBlock
---
 src/conf/checkstyle.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index cc481d4f6..0a9b54113 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -53,6 +53,9 @@ limitations under the License.
     <module name="AvoidStarImport"/>
     <module name="CovariantEquals" />
     <module name="DefaultComesLast" />
+    <module name="EmptyBlock">
+      <property name="option" value="text" />
+    </module>
     <module name="ExplicitInitialization" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>


(commons-collections) 13/17: Add Checkstyle SimplifyBooleanReturn

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit bb2ebee5ec86c659a078fb983c4efa04435da9c3
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:24:26 2025 -0500

    Add Checkstyle SimplifyBooleanReturn
---
 src/conf/checkstyle.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 31fe1a4bf..4cf6e97e6 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -85,6 +85,7 @@ limitations under the License.
     <module name="RedundantModifier"/>
     <module name="RightCurly"/>
     <module name="SimplifyBooleanExpression" />
+    <module name="SimplifyBooleanReturn" />
     <module name="TypecastParenPad" />    
     <module name="UpperEll" />
     <module name="UnusedImports"/>


(commons-collections) 02/17: Add Checkstyle ArrayTypeStyle

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 8addbd6f0fe963c56d9f561950e516fade99f2c9
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:06:02 2025 -0500

    Add Checkstyle ArrayTypeStyle
---
 src/conf/checkstyle.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 884ac2022..bb7262d93 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -49,6 +49,7 @@ limitations under the License.
     <property name="file" value="${checkstyle.suppressions.file}"/>
   </module>
   <module name="TreeWalker">
+    <module name="ArrayTypeStyle" />
     <module name="AvoidStarImport"/>
     <module name="ExplicitInitializationCheck" />
     <module name="GenericWhitespace"/>


(commons-collections) 11/17: Add Checkstyle MultipleVariableDeclarations

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 4bb493225b409c4018696790b9beb510df15d7b0
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:23:03 2025 -0500

    Add Checkstyle MultipleVariableDeclarations
---
 src/conf/checkstyle.xml                                           | 1 +
 .../org/apache/commons/collections4/map/AbstractReferenceMap.java | 6 ++++--
 .../commons/collections4/trie/analyzer/StringKeyAnalyzer.java     | 3 ++-
 src/test/java/org/apache/commons/collections4/MapPerformance.java | 3 ++-
 .../java/org/apache/commons/collections4/bag/AbstractBagTest.java | 8 ++++++--
 .../commons/collections4/list/NodeCachingLinkedListTest.java      | 6 ++----
 .../commons/collections4/multiset/AbstractMultiSetTest.java       | 8 ++++++--
 7 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 4b56aa203..e5603d667 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -75,6 +75,7 @@ limitations under the License.
     <module name="LeftCurly"/>
     <module name="MethodParamPad"/>
     <module name="ModifierOrder"/>
+    <module name="MultipleVariableDeclarations" />
     <module name="NeedBraces"/>
     <module name="NoWhitespaceBefore"/>
     <module name="NoWhitespaceBeforeCaseDefaultColon"/>
diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
index 46f713509..913f42a75 100644
--- a/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/AbstractReferenceMap.java
@@ -105,8 +105,10 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
         // These Object fields provide hard references to the
         // current and next entry; this assures that if hasNext()
         // returns true, next() will actually return a valid element.
-        K currentKey, nextKey;
-        V currentValue, nextValue;
+        K currentKey;
+        K nextKey;
+        V currentValue;
+        V nextValue;
 
         int expectedModCount;
 
diff --git a/src/main/java/org/apache/commons/collections4/trie/analyzer/StringKeyAnalyzer.java b/src/main/java/org/apache/commons/collections4/trie/analyzer/StringKeyAnalyzer.java
index 5c5685c91..c74082c9a 100644
--- a/src/main/java/org/apache/commons/collections4/trie/analyzer/StringKeyAnalyzer.java
+++ b/src/main/java/org/apache/commons/collections4/trie/analyzer/StringKeyAnalyzer.java
@@ -75,7 +75,8 @@ public class StringKeyAnalyzer extends KeyAnalyzer<String> {
         // Look at each character, and if they're different
         // then figure out which bit makes the difference
         // and return it.
-        char k = 0, f = 0;
+        char k = 0;
+        char f = 0;
         for (int i = 0; i < length; i++) {
             final int index1 = beginIndex1 + i;
             final int index2 = beginIndex2 + i;
diff --git a/src/test/java/org/apache/commons/collections4/MapPerformance.java b/src/test/java/org/apache/commons/collections4/MapPerformance.java
index 73dd11267..33beec43d 100644
--- a/src/test/java/org/apache/commons/collections4/MapPerformance.java
+++ b/src/test/java/org/apache/commons/collections4/MapPerformance.java
@@ -88,7 +88,8 @@ public class MapPerformance {
     }
 
     private static void test(final Map<String, String> map, final String name) {
-        long startMillis = 0, endMillis = 0;
+        long startMillis = 0;
+        long endMillis = 0;
 //        int total = 0;
         startMillis = System.currentTimeMillis();
         for (int i = RUNS; i > 0; i--) {
diff --git a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
index 8b0445090..ab22afef1 100644
--- a/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
+++ b/src/test/java/org/apache/commons/collections4/bag/AbstractBagTest.java
@@ -641,7 +641,9 @@ public abstract class AbstractBagTest<T> extends AbstractCollectionTest<T> {
         bag.add((T) "B");
         bag.add((T) "C");
         final Object[] array = bag.toArray();
-        int a = 0, b = 0, c = 0;
+        int a = 0;
+        int b = 0;
+        int c = 0;
         for (final Object element : array) {
             a += element.equals("A") ? 1 : 0;
             b += element.equals("B") ? 1 : 0;
@@ -666,7 +668,9 @@ public abstract class AbstractBagTest<T> extends AbstractCollectionTest<T> {
         bag.add((T) "B");
         bag.add((T) "C");
         final String[] array = bag.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
-        int a = 0, b = 0, c = 0;
+        int a = 0;
+        int b = 0;
+        int c = 0;
         for (final String element : array) {
             a += element.equals("A") ? 1 : 0;
             b += element.equals("B") ? 1 : 0;
diff --git a/src/test/java/org/apache/commons/collections4/list/NodeCachingLinkedListTest.java b/src/test/java/org/apache/commons/collections4/list/NodeCachingLinkedListTest.java
index 5f58416a2..6e027f9ff 100644
--- a/src/test/java/org/apache/commons/collections4/list/NodeCachingLinkedListTest.java
+++ b/src/test/java/org/apache/commons/collections4/list/NodeCachingLinkedListTest.java
@@ -35,11 +35,9 @@ public class NodeCachingLinkedListTest<E> extends AbstractLinkedListTest<E> {
 
         final int loopCount = 4000000;
 
-        long startTime, endTime;
-
         System.out.println("Testing relative execution time of commonly-used methods...");
 
-        startTime = System.currentTimeMillis();
+        long startTime = System.currentTimeMillis();
         for (int x = loopCount; x > 0; x--) {
             // unrolled a few times to minimize effect of loop
             ll.addFirst(o1);
@@ -63,7 +61,7 @@ public class NodeCachingLinkedListTest<E> extends AbstractLinkedListTest<E> {
             ll.add(o1);
             ll.remove(0);
         }
-        endTime = System.currentTimeMillis();
+        long endTime = System.currentTimeMillis();
         System.out.println("Time with LinkedList: " + (endTime - startTime) + " ms");
 
         startTime = System.currentTimeMillis();
diff --git a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
index fbd897711..0f82c5924 100644
--- a/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
+++ b/src/test/java/org/apache/commons/collections4/multiset/AbstractMultiSetTest.java
@@ -675,7 +675,9 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
         multiset.add((T) "B");
         multiset.add((T) "C");
         final Object[] array = multiset.toArray();
-        int a = 0, b = 0, c = 0;
+        int a = 0;
+        int b = 0;
+        int c = 0;
         for (final Object element : array) {
             a += element.equals("A") ? 1 : 0;
             b += element.equals("B") ? 1 : 0;
@@ -700,7 +702,9 @@ public abstract class AbstractMultiSetTest<T> extends AbstractCollectionTest<T>
         multiset.add((T) "B");
         multiset.add((T) "C");
         final String[] array = multiset.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
-        int a = 0, b = 0, c = 0;
+        int a = 0;
+        int b = 0;
+        int c = 0;
         for (final String element : array) {
             a += element.equals("A") ? 1 : 0;
             b += element.equals("B") ? 1 : 0;


(commons-collections) 09/17: Add Checkstyle FinalLocalVariable

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit eb6561d2104e8cbc710585bfd920dec5a34cfc71
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:17:44 2025 -0500

    Add Checkstyle FinalLocalVariable
---
 src/conf/checkstyle.xml                                               | 1 +
 .../apache/commons/collections4/map/ConcurrentReferenceHashMap.java   | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 5dd93d44d..bae81d016 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -59,6 +59,7 @@ limitations under the License.
     <module name="EqualsHashCode" />
     <module name="ExplicitInitialization" />
     <module name="FallThrough" />
+    <module name="FinalLocalVariable" />
     <module name="GenericWhitespace"/>
     <module name="IllegalImport"/>
     <module name="ImportOrder">
diff --git a/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java b/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java
index 232c41bc0..57dcf4f1d 100644
--- a/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java
+++ b/src/main/java/org/apache/commons/collections4/map/ConcurrentReferenceHashMap.java
@@ -814,7 +814,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
                 for (int i = 0; i < len; i++) {
                     for (HashEntry<K, V> e = tab[i]; e != null; e = e.next) {
                         final Object opaque = e.valueRef;
-                        V v;
+                        final V v;
                         if (opaque == null) {
                             // recheck
                             v = readValueUnderLock(e);
@@ -901,7 +901,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
             while (e != null && (e.hash != hash || !keyEq(key, e.key()))) {
                 e = e.next;
             }
-            V resultValue;
+            final V resultValue;
             if (e != null) {
                 resultValue = e.value();
                 if (!onlyIfAbsent) {


(commons-collections) 12/17: Add Checkstyle SimplifyBooleanExpression

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 99ae265fbb247a4a005d5ab68dd5688ea4aa4986
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 18:24:05 2025 -0500

    Add Checkstyle SimplifyBooleanExpression
---
 src/conf/checkstyle.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index e5603d667..31fe1a4bf 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -81,9 +81,10 @@ limitations under the License.
     <module name="NoWhitespaceBeforeCaseDefaultColon"/>
     <module name="NeedBraces"/>
     <module name="ParenPad"/>
+    <module name="RedundantImport" />
     <module name="RedundantModifier"/>
     <module name="RightCurly"/>
-    <module name="RedundantImport"/>
+    <module name="SimplifyBooleanExpression" />
     <module name="TypecastParenPad" />    
     <module name="UpperEll" />
     <module name="UnusedImports"/>