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-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new aa405f987 Don't initialize an instance or static variable to its 
default value
aa405f987 is described below

commit aa405f9877098cb483dd99a557a56c6330920087
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Oct 27 10:56:01 2023 -0400

    Don't initialize an instance or static variable to its default value
---
 src/site/resources/checkstyle/checkstyle.xml                        | 1 +
 src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java | 2 +-
 .../java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java  | 6 +++---
 .../apache/commons/lang3/concurrent/BackgroundInitializerTest.java  | 2 +-
 .../commons/lang3/concurrent/MultiBackgroundInitializerTest.java    | 2 +-
 src/test/java/org/apache/commons/lang3/reflect/testbed/Parent.java  | 4 ++--
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/site/resources/checkstyle/checkstyle.xml 
b/src/site/resources/checkstyle/checkstyle.xml
index fe6e5eb99..3527cfa0d 100644
--- a/src/site/resources/checkstyle/checkstyle.xml
+++ b/src/site/resources/checkstyle/checkstyle.xml
@@ -36,6 +36,7 @@ limitations under the License.
     <property name="file" 
value="src/site/resources/checkstyle/checkstyle-suppressions.xml"/>
   </module>
   <module name="TreeWalker">
+    <module name="ExplicitInitializationCheck" />
     <module name="AvoidStarImport"/>
     <module name="IllegalImport"/>
     <module name="RedundantImport"/>
diff --git 
a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java 
b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
index 17531ad83..edbaaa845 100644
--- a/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/DiffBuilderTest.java
@@ -54,7 +54,7 @@ public class DiffBuilderTest extends AbstractLangTest {
         private long[] longArrayField = {1L};
         private short shortField = 1;
         private short[] shortArrayField = {1};
-        private Object objectField = null;
+        private Object objectField;
         private Object[] objectArrayField = {null};
 
         @Override
diff --git 
a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java 
b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
index cf045e946..f13e7cc21 100644
--- a/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
+++ b/src/test/java/org/apache/commons/lang3/builder/HashCodeBuilderTest.java
@@ -128,13 +128,13 @@ public class HashCodeBuilderTest extends AbstractLangTest 
{
 
     static class TestObjectWithMultipleFields {
         @SuppressWarnings("unused")
-        private int one = 0;
+        private int one;
 
         @SuppressWarnings("unused")
-        private int two = 0;
+        private int two;
 
         @SuppressWarnings("unused")
-        private int three = 0;
+        private int three;
 
         TestObjectWithMultipleFields(final int one, final int two, final int 
three) {
             this.one = one;
diff --git 
a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
 
b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
index 8714beaaf..f1a09da0a 100644
--- 
a/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
+++ 
b/src/test/java/org/apache/commons/lang3/concurrent/BackgroundInitializerTest.java
@@ -306,7 +306,7 @@ public class BackgroundInitializerTest extends 
AbstractLangTest {
 
         /** A latch tests can use to control when initialize completes. */
         final CountDownLatch latch = new CountDownLatch(1);
-        boolean waitForLatch = false;
+        boolean waitForLatch;
 
         /** An object containing the state we are testing */
         CloseableCounter counter = new CloseableCounter();
diff --git 
a/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java
 
b/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java
index 4260f9b61..38e3c9532 100644
--- 
a/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java
+++ 
b/src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java
@@ -439,7 +439,7 @@ public class MultiBackgroundInitializerTest extends 
AbstractLangTest {
 
         /** A latch tests can use to control when initialize completes. */
         final CountDownLatch latch = new CountDownLatch(1);
-        boolean waitForLatch = false;
+        boolean waitForLatch;
 
         public void enableLatch() {
             waitForLatch = true;
diff --git a/src/test/java/org/apache/commons/lang3/reflect/testbed/Parent.java 
b/src/test/java/org/apache/commons/lang3/reflect/testbed/Parent.java
index eeee5e398..54543474f 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/testbed/Parent.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/testbed/Parent.java
@@ -20,8 +20,8 @@ package org.apache.commons.lang3.reflect.testbed;
  */
 class Parent implements Foo {
     public String s = "s";
-    protected boolean b = false;
-    int i = 0;
+    protected boolean b;
+    int i;
     @SuppressWarnings("unused")
     private final double d = 0.0;
 

Reply via email to