You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/07/23 04:59:32 UTC

[groovy] branch master updated: GROOVY-9637: prefactor existing utility

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e8c19e  GROOVY-9637: prefactor existing utility
3e8c19e is described below

commit 3e8c19e0d2b693fea3caeecede9512a350cd27f3
Author: Daniel Sun <su...@apache.org>
AuthorDate: Mon Jul 13 02:40:57 2020 +0800

    GROOVY-9637: prefactor existing utility
---
 .../org/apache/groovy/ast/tools/ImmutablePropertyUtils.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java
index 4e2bde0..c89b484 100644
--- a/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java
+++ b/src/main/java/org/apache/groovy/ast/tools/ImmutablePropertyUtils.java
@@ -69,7 +69,15 @@ public class ImmutablePropertyUtils {
               This list can by extended by providing "known immutable" classes
               via Immutable.knownImmutableClasses
              */
-    private static Set<String> builtinImmutables = new HashSet<String>(Arrays.asList(
+    private static final Set<String> BUILTIN_IMMUTABLES = new HashSet<String>(Arrays.asList(
+            "boolean",
+            "byte",
+            "char",
+            "double",
+            "float",
+            "int",
+            "long",
+            "short",
             "java.lang.Class",
             "java.lang.Boolean",
             "java.lang.Byte",
@@ -196,7 +204,7 @@ public class ImmutablePropertyUtils {
     }
 
     public static boolean isBuiltinImmutable(String typeName) {
-        return builtinImmutables.contains(typeName);
+        return BUILTIN_IMMUTABLES.contains(typeName);
     }
 
     private static boolean hasImmutableAnnotation(Class clazz) {