groovy git commit: Add guard checking for `getGroovydoc`

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

groovy git commit: Add guard checking for `getGroovydoc`

Daniel.Sun
Repository: groovy
Updated Branches:
  refs/heads/master da240387d -> a2fb76d73


Add guard checking for `getGroovydoc`


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

Branch: refs/heads/master
Commit: a2fb76d73b5eee61867a199e41c8c1a15757b48a
Parents: da24038
Author: sunlan <[hidden email]>
Authored: Mon Sep 11 21:53:07 2017 +0800
Committer: sunlan <[hidden email]>
Committed: Mon Sep 11 21:53:41 2017 +0800

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/a2fb76d7/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 1b8e803..f9e7bb6 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -18891,6 +18891,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * @since 2.6.0
      */
     public static groovy.lang.groovydoc.Groovydoc getGroovydoc(AnnotatedElement holder) {
-        return new groovy.lang.groovydoc.Groovydoc(holder.<Groovydoc>getAnnotation(Groovydoc.class).value(), holder);
+        Groovydoc groovydocAnnotation = holder.<Groovydoc>getAnnotation(Groovydoc.class);
+
+        return null == groovydocAnnotation
+                    ? null
+                    : new groovy.lang.groovydoc.Groovydoc(groovydocAnnotation.value(), holder);
     }
 }