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 2022/03/21 14:37:03 UTC

[commons-lang] 02/02: Bump SpotBugs to the current versions of Maven Plugin and underlying tool.

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

commit a9f9ba4fba7f009f0714331e3f7ddc47fc99254d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Mar 21 10:36:56 2022 -0400

    Bump SpotBugs to the current versions of Maven Plugin and underlying
    tool.
    
    - TODO Can any of these be done without breaking binary compatibility?
    EI_EXPOSE_REP, EI_EXPOSE_REP2, MS_EXPOSE_REP,
    REFLF_REFLECTION_MAY_INCREASE_ACCESSIBILITY_OF_FIELD.
    - Equals and hashcode do not match up.
---
 pom.xml                                                  |  4 ++--
 src/changes/changes.xml                                  |  4 ++--
 src/conf/spotbugs-exclude-filter.xml                     | 16 ++++++++++++++++
 .../java/org/apache/commons/lang3/time/GmtTimeZone.java  | 13 +++++++++----
 4 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/pom.xml b/pom.xml
index 17d789a..a28b732 100644
--- a/pom.xml
+++ b/pom.xml
@@ -638,8 +638,8 @@
     <checkstyle.version>9.3</checkstyle.version>
     <checkstyle.configdir>src/site/resources/checkstyle</checkstyle.configdir>
 
-    <spotbugs.plugin.version>4.5.0.0</spotbugs.plugin.version>
-    <spotbugs.impl.version>4.2.3</spotbugs.impl.version>
+    <spotbugs.plugin.version>4.5.3.0</spotbugs.plugin.version>
+    <spotbugs.impl.version>4.6.0</spotbugs.impl.version>
     <japicmp.skip>false</japicmp.skip>
     <clirr.skip>true</clirr.skip>
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 22bd94b..45e5cdc 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -125,11 +125,11 @@ The <action> type attribute can be add,update,fix,remove.
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add FutureTasks.</action>
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add Memoizer(Function) and Memoizer(Function, boolean).</action>
     <!-- UPDATE -->
-    <action                   type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump spotbugs-maven-plugin from 4.2.0 to 4.5.0.0 #735, #808, #822, #834.</action>
+    <action                   type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump spotbugs-maven-plugin from 4.2.0 to 4.5.3.0 #735, #808, #822, #834.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot, XenoAmess">Bump actions/cache from v2.1.4 to v2.1.7 #742, #752, #764, #833.</action>
     <action                   type="update" dev="ggregory" due-to="Gary Gregory">Bump actions/setup-java from v1.4.3 to v2.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot">Bump actions/checkout from 2 to 3 #859.</action>
-    <action                   type="update" dev="ggregory" due-to="Dependabot">Bump spotbugs from 4.2.2 to 4.2.3 #744.</action>
+    <action                   type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump spotbugs from 4.2.2 to 4.6.0 #744.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump checkstyle from 8.41 to 9.2.1 #739, #768, #787, #811, #824, #843.</action>
     <action                   type="update" dev="ggregory" due-to="Dependabot">Bump easymock from 4.2 to 4.3 #746.</action>
     <action                   type="update" dev="ggregory" due-to="Gary Gregory">Bump commons.jacoco.version 0.8.6 -> 0.8.7.</action>
diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml
index 10c8e81..7cbba7a 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -23,6 +23,22 @@
 -->
 <FindBugsFilter>
 
+  <!-- TODO Can any of these be done without breaking binary compatibility? -->
+  <Match>
+    <Class name="~.*" />
+    <Or>
+      <Bug pattern="EI_EXPOSE_REP" />
+      <Bug pattern="EI_EXPOSE_REP2" />
+      <Bug pattern="MS_EXPOSE_REP" />
+    </Or>
+  </Match>
+
+  <!-- TODO Can any of these be done without breaking binary compatibility? -->
+  <Match>
+    <Class name="org.apache.commons.lang3.reflect.FieldUtils" />
+    <Bug pattern="REFLF_REFLECTION_MAY_INCREASE_ACCESSIBILITY_OF_FIELD" />
+  </Match>
+
   <!-- https://github.com/spotbugs/spotbugs/issues/1504 -->
   <Match>
     <Class name="org.apache.commons.lang3.ArrayUtils" />
diff --git a/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java b/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
index 12045ad..63b7b19 100644
--- a/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
+++ b/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java
@@ -17,6 +17,7 @@
 package org.apache.commons.lang3.time;
 
 import java.util.Date;
+import java.util.Objects;
 import java.util.TimeZone;
 
 /**
@@ -59,11 +60,15 @@ class GmtTimeZone extends TimeZone {
     }
 
     @Override
-    public boolean equals(final Object other) {
-        if (!(other instanceof GmtTimeZone)) {
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof GmtTimeZone)) {
             return false;
         }
-        return zoneId == ((GmtTimeZone) other).zoneId;
+        GmtTimeZone other = (GmtTimeZone) obj;
+        return offset == other.offset && Objects.equals(zoneId, other.zoneId);
     }
 
     @Override
@@ -83,7 +88,7 @@ class GmtTimeZone extends TimeZone {
 
     @Override
     public int hashCode() {
-        return offset;
+        return Objects.hash(offset, zoneId);
     }
 
     @Override