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

commit 441a5902f49df2039fd4613afc2f4716cd488bee
Author: Gary David Gregory (Code signing key) <ggreg...@apache.org>
AuthorDate: Sat Oct 29 07:12:36 2022 -0400

    Use Java 8 Map API
---
 .../java/org/apache/bcel/generic/ConstantPoolGen.java     | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java 
b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
index 1ed3a324..1e888be3 100644
--- a/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
+++ b/src/main/java/org/apache/bcel/generic/ConstantPoolGen.java
@@ -65,12 +65,15 @@ public class ConstantPoolGen {
     private static final String IMETHODREF_DELIM = "#";
 
     private static final String FIELDREF_DELIM = "&";
+
     private static final String NAT_DELIM = "%"; // Name and Type
+
     /**
      * @deprecated (since 6.0) will be made private; do not access directly, 
use getter/setter
      */
     @Deprecated
     protected int size;
+
     /**
      * @deprecated (since 6.0) will be made private; do not access directly, 
use getter/setter
      */
@@ -256,17 +259,15 @@ public class ConstantPoolGen {
     }
 
     private int addClass_(final String clazz) {
-        int ret;
-        if ((ret = lookupClass(clazz)) != -1) {
-            return ret; // Already in CP
+        final int cpRet;
+        if ((cpRet = lookupClass(clazz)) != -1) {
+            return cpRet; // Already in CP
         }
         adjustSize();
         final ConstantClass c = new ConstantClass(addUtf8(clazz));
-        ret = index;
+        final int ret = index;
         constants[index++] = c;
-        if (!classTable.containsKey(clazz)) {
-            classTable.put(clazz, new Index(ret));
-        }
+        classTable.computeIfAbsent(clazz, k -> new Index(ret));
         return ret;
     }
 

Reply via email to