You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by 杨波 <bo...@telecwin.com> on 2020/07/23 05:30:35 UTC

回复:How to extract comments (especially the fields comments) from groovy or java (compiled in groovy) code?

Jiaxin,

Thanks, I will check it out.

And I also found this related post, https://stackoverflow.com/questions/14354165/how-to-parse-groovy-code.



------------------------------------------------------------------
发件人:余佳昕 <yj...@foxmail.com>
发送时间:2020年7月23日(星期四) 11:57
收件人:杨波 <bo...@telecwin.com>; users-groovy <us...@groovy.apache.org>
主 题:回复: How to extract comments (especially the fields comments) from groovy or java (compiled in groovy) code?

I have written similar software for the company I work for. Java provides an extensible javadoc API. I have not used it on groovy, but I think it should apply. You can check this class to get started: `com.sun.tools.javadoc.Main`

Jiaxin


------------------ 原始邮件 ------------------
发件人: "users@groovy.apache.org 杨波"<bo...@telecwin.com>; 
发送时间: 2020年7月23日(星期四) 中午11:29
收件人: "users-groovy"<us...@groovy.apache.org>; 
主题: How to extract comments (especially the fields comments) from groovy or java (compiled in groovy) code?

Hello,

    I am writing a grails swagger plugin that needs to extract comments of class fields, such as below code:

class UserCommand {
    /**
     * The name of user in comments
     */
    String username

    String password

    String avatarUrl
}

    Then I need to extract the comment content "The name of user in comments" from the code.
I searched the Groovy2.5 AST, but can not find comments related nodes in the node tree.

How can I do this in Groovy 2.5 ? Because grails needs groovy v2.5.

Thanks!



Best Regards,

Bob Yang