groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: grammar correction
Date Sun, 19 Aug 2018 09:51:40 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X be241758d -> 20c351f6a


grammar correction


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 20c351f6ad83de6403c9266665ce20827c594818
Parents: be24175
Author: Paul King <paulk@asert.com.au>
Authored: Sun Aug 19 19:50:38 2018 +1000
Committer: Paul King <paulk@asert.com.au>
Committed: Sun Aug 19 19:51:29 2018 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/ast/decompiled/Annotations.java | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/20c351f6/src/main/java/org/codehaus/groovy/ast/decompiled/Annotations.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/ast/decompiled/Annotations.java b/src/main/java/org/codehaus/groovy/ast/decompiled/Annotations.java
index 2974d00..297dbb0 100644
--- a/src/main/java/org/codehaus/groovy/ast/decompiled/Annotations.java
+++ b/src/main/java/org/codehaus/groovy/ast/decompiled/Annotations.java
@@ -48,14 +48,22 @@ class Annotations {
 
         AnnotationNode node = new DecompiledAnnotationNode(classNode);
         for (Map.Entry<String, Object> entry : annotation.members.entrySet()) {
-            node.addMember(entry.getKey(), annotationValueToExpression(entry.getValue(),
resolver));
+            addMemberIfFound(resolver, node, entry);
         }
         return node;
     }
 
+    private static void addMemberIfFound(AsmReferenceResolver resolver, AnnotationNode node,
Map.Entry<String, Object> entry) {
+        Expression value = annotationValueToExpression(entry.getValue(), resolver);
+        if (value != null) {
+            node.addMember(entry.getKey(), value);
+        }
+    }
+
     private static Expression annotationValueToExpression(Object value, AsmReferenceResolver
resolver) {
         if (value instanceof TypeWrapper) {
-            return new ClassExpression(resolver.resolveType(Type.getType(((TypeWrapper) value).desc)));
+            ClassNode type = resolver.resolveClassNullable(Type.getType(((TypeWrapper) value).desc).getClassName());
+            return type != null ? new ClassExpression(type) : null;
         }
 
         if (value instanceof EnumConstantWrapper) {


Mime
View raw message