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

commit a06a0b48ecd0776e54b228aa27119e2f50147eed
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Apr 21 18:54:18 2022 -0400

    Fix SpotBugs error.
    
    [ERROR] Medium:
    org.apache.commons.beanutils2.BasicDynaClass.constructorTypes should be
    both final and package protected
    [org.apache.commons.beanutils2.BasicDynaClass] At
    BasicDynaClass.java:[line 95] MS_FINAL_PKGPROTECT
---
 src/changes/changes.xml                                         | 3 +++
 src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 9cebec22..c374f3f9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,6 +77,9 @@
       <action dev="ggregory" type="fix" due-to="SethFalco">
         Start migration to JUnit 5 #93.
       </action>
+      <action dev="ggregory" type="fix" due-to="Gary Gregory">
+        Fix SpotBugs [ERROR] Medium: 
org.apache.commons.beanutils2.BasicDynaClass.constructorTypes should be both 
final and package protected [org.apache.commons.beanutils2.BasicDynaClass] At 
BasicDynaClass.java:[line 95] MS_FINAL_PKGPROTECT.
+      </action>
       <!--  UPDATES -->
       <action dev="ggregory" type="update" due-to="Dependabot, Gary Gregory">
         Bump actions/cache from 2 to 3.0.2 #77, #89, #103, #111.
diff --git a/src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java 
b/src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java
index c145accc..e748620f 100644
--- a/src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java
+++ b/src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java
@@ -92,7 +92,7 @@ public class BasicDynaClass implements DynaClass, 
Serializable {
      * The method signature of the constructor we will use to create
      * new DynaBean instances.
      */
-    protected static Class<?>[] constructorTypes = { DynaClass.class };
+    private static final Class<?>[] CONSTRUCTOR_TYPES = { DynaClass.class };
 
     /**
      * The argument values to be passed to the constructor we will use
@@ -251,7 +251,7 @@ public class BasicDynaClass implements DynaClass, 
Serializable {
 
         // Identify the Constructor we will use in newInstance()
         try {
-            this.constructor = dynaBeanClass.getConstructor(constructorTypes);
+            this.constructor = dynaBeanClass.getConstructor(CONSTRUCTOR_TYPES);
         } catch (final NoSuchMethodException e) {
             throw new IllegalArgumentException
                     ("Class " + dynaBeanClass.getName() +

Reply via email to