groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [groovy] branch master updated: Add docs for runtime groovydoc
Date Wed, 15 Jan 2020 01:35:44 GMT
This is an automated email from the ASF dual-hosted git repository.

sunlan 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 7d3b5be  Add docs for runtime groovydoc
7d3b5be is described below

commit 7d3b5bea85a0a4f7de17069dd31fadee43348410
Author: Daniel Sun <sunlan@apache.org>
AuthorDate: Wed Jan 15 09:34:45 2020 +0800

    Add docs for runtime groovydoc
---
 src/spec/doc/core-syntax.adoc | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/spec/doc/core-syntax.adoc b/src/spec/doc/core-syntax.adoc
index 72c0a4b..2b947ee 100644
--- a/src/spec/doc/core-syntax.adoc
+++ b/src/spec/doc/core-syntax.adoc
@@ -70,6 +70,31 @@ include::{projectdir}/src/spec/test/SyntaxTest.groovy[tags=groovydoc_comment,ind
 Groovydoc follows the same conventions as Java's own Javadoc.
 So you'll be able to use the same tags as with Javadoc.
 
+In addition, Groovy supports *Runtime Groovydoc* since 3.0.0, i.e. Groovydoc can be retained
at runtime.
+
+NOTE: Runtime Groovydoc is disabled by default. It can be enabled by adding JVM option `-Dgroovy.attach.runtime.groovydoc=true`
+
+The Runtime Groovydoc starts with `/\**@` and ends with `*/`, for example:
+
+[source,groovy]
+----
+/**@
+ * Some class groovydoc for Foo
+ */
+class Foo {
+    /**@
+     * Some method groovydoc for bar
+     */
+    void bar() {
+    }
+}
+
+assert Foo.class.groovydoc.content.contains('Some class groovydoc for Foo') // <1>
+assert Foo.class.getMethod('bar', new Class[0]).groovydoc.content.contains('Some method groovydoc
for bar') // <2>
+----
+<1> Get the runtime groovydoc for class `Foo`
+<2> Get the runtime groovydoc for method `bar`
+
 === Shebang line
 
 Beside the single-line comment, there is a special line comment, often called the _shebang_
line understood by UNIX systems


Mime
View raw message