groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Trivial refactoring: use `getSystemPropertySafe` instead
Date Tue, 03 Jul 2018 02:52:21 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 371d8eb1e -> c7272cfa2


Trivial refactoring: use `getSystemPropertySafe` instead


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/c7272cfa
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/c7272cfa
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/c7272cfa

Branch: refs/heads/GROOVY_2_5_X
Commit: c7272cfa2571a4beb5974d044127bbafaf1e71d9
Parents: 371d8eb
Author: sunlan <sunlan@apache.org>
Authored: Tue Jul 3 10:52:06 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Tue Jul 3 10:52:06 2018 +0800

----------------------------------------------------------------------
 .../org/codehaus/groovy/ast/tools/GenericsUtils.java  | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/c7272cfa/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
index bac79fd..879d217 100644
--- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
+++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
@@ -21,6 +21,7 @@ package org.codehaus.groovy.ast.tools;
 import antlr.RecognitionException;
 import antlr.TokenStreamException;
 import groovy.transform.stc.IncorrectTypeHintException;
+import org.apache.groovy.util.SystemUtil;
 import org.codehaus.groovy.GroovyBugError;
 import org.codehaus.groovy.antlr.AntlrParserPlugin;
 import org.codehaus.groovy.antlr.parser.GroovyLexer;
@@ -665,18 +666,9 @@ public class GenericsUtils {
         return newTypes;
     }
 
-    private static final boolean PARAMETERIZED_TYPE_CACHE_ENABLED;
     private static final String TRUE_STR = "true";
-    static {
-        boolean tmp;
-        try {
-            tmp = TRUE_STR.equals(System.getProperty("groovy.enable.parameterized.type.cache",
TRUE_STR));
-        } catch (Exception e) {
-            tmp = true;
-        }
-
-        PARAMETERIZED_TYPE_CACHE_ENABLED = tmp;
-    }
+    private static final boolean PARAMETERIZED_TYPE_CACHE_ENABLED =
+            TRUE_STR.equals(SystemUtil.getSystemPropertySafe("groovy.enable.parameterized.type.cache",
TRUE_STR));
 
     /**
      * Try to get the parameterized type from the cache.


Mime
View raw message