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 2021/12/02 16:13:39 UTC

[commons-compress] 04/04: Make some private instance variables final.

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

commit f3c944811f1e48dad48ad758199797caf24920a2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 2 11:13:32 2021 -0500

    Make some private instance variables final.
---
 .../compress/harmony/pack200/PackingOptions.java     | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
index 4c38702..0a46e68 100644
--- a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
+++ b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
@@ -43,10 +43,10 @@ public class PackingOptions {
     private String modificationTime = KEEP;
     private List<String> passFiles;
     private String unknownAttributeAction = PASS;
-    private Map<String, String> classAttributeActions;
-    private Map<String, String> fieldAttributeActions;
-    private Map<String, String> methodAttributeActions;
-    private Map<String, String> codeAttributeActions;
+    private final Map<String, String> classAttributeActions= new HashMap<>();
+    private final Map<String, String> fieldAttributeActions= new HashMap<>();
+    private final Map<String, String> methodAttributeActions= new HashMap<>();
+    private final Map<String, String> codeAttributeActions= new HashMap<>();
     private boolean verbose = false;
     private String logFile;
 
@@ -199,30 +199,18 @@ public class PackingOptions {
     }
 
     public void addClassAttributeAction(final String attributeName, final String action) {
-        if (classAttributeActions == null) {
-            classAttributeActions = new HashMap<>();
-        }
         classAttributeActions.put(attributeName, action);
     }
 
     public void addFieldAttributeAction(final String attributeName, final String action) {
-        if (fieldAttributeActions == null) {
-            fieldAttributeActions = new HashMap<>();
-        }
         fieldAttributeActions.put(attributeName, action);
     }
 
     public void addMethodAttributeAction(final String attributeName, final String action) {
-        if (methodAttributeActions == null) {
-            methodAttributeActions = new HashMap<>();
-        }
         methodAttributeActions.put(attributeName, action);
     }
 
     public void addCodeAttributeAction(final String attributeName, final String action) {
-        if (codeAttributeActions == null) {
-            codeAttributeActions = new HashMap<>();
-        }
         codeAttributeActions.put(attributeName, action);
     }