You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/07/19 10:26:38 UTC

[groovy] branch GROOVY_3_0_X updated: Trivial refactoring: extract common variable

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

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 07d4cc1  Trivial refactoring: extract common variable
07d4cc1 is described below

commit 07d4cc1526fa0037d36c021874702c4a6e7d7d78
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Jul 19 18:22:58 2020 +0800

    Trivial refactoring: extract common variable
    
    (cherry picked from commit 1a4542c9645b5cf4eeeeb325f141114d6f2e4083)
---
 src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
index 51e937d..e4bf60d 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
@@ -317,14 +317,15 @@ public class Java8 implements VMPlugin {
 
     public void configureAnnotationNodeFromDefinition(AnnotationNode definition, AnnotationNode root) {
         ClassNode type = definition.getClassNode();
-        if ("java.lang.annotation.Retention".equals(type.getName())) {
+        final String typeName = type.getName();
+        if ("java.lang.annotation.Retention".equals(typeName)) {
             Expression exp = definition.getMember("value");
             if (!(exp instanceof PropertyExpression)) return;
             PropertyExpression pe = (PropertyExpression) exp;
             String name = pe.getPropertyAsString();
             RetentionPolicy policy = RetentionPolicy.valueOf(name);
             setRetentionPolicy(policy, root);
-        } else if ("java.lang.annotation.Target".equals(type.getName())) {
+        } else if ("java.lang.annotation.Target".equals(typeName)) {
             Expression exp = definition.getMember("value");
             if (!(exp instanceof ListExpression)) return;
             ListExpression le = (ListExpression) exp;