[
https://issues.apache.org/jira/browse/GROOVY-8007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Guillaume Laforge reassigned GROOVY-8007:
-----------------------------------------
Assignee: Daniel.Sun
> [parrot] Getting the groovydoc comment should work in scripts as well
> ---------------------------------------------------------------------
>
> Key: GROOVY-8007
> URL: https://issues.apache.org/jira/browse/GROOVY-8007
> Project: Groovy
> Issue Type: Bug
> Reporter: Guillaume Laforge
> Assignee: Daniel.Sun
>
> In a script I can't get access to the content of the groovydoc / javadoc
> comments for methods, although it works if I wrap my script in a class:
> {code}
> import org.codehaus.groovy.control.*
> import static org.apache.groovy.parser.antlr4.AstBuilder.DOC_COMMENT
> def code = '''
> /**
> * a method
> * @author glaforge
> */
> void m(int i) {}
> }
> '''
> def ast = new CompilationUnit().tap {
> addSource 'methodM.groovy', code
> compile Phases.SEMANTIC_ANALYSIS
> }.ast
> assert ast.classes[0].methods[0].nodeMetaData[DOC_COMMENT]
> {code}
> Ideally, it should work as well for scripts as it works for classes.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)