You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Dmitry (Jira)" <ji...@apache.org> on 2024/01/06 13:57:00 UTC

[jira] [Commented] (GROOVY-11269) GroovyClassDoc has empty 'enumConstants' when call method GroovyDocParser.getClassDocsFromSingleSource(...)

    [ https://issues.apache.org/jira/browse/GROOVY-11269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17803815#comment-17803815 ] 

Dmitry commented on GROOVY-11269:
---------------------------------

And one more question.
[~paulk] wrote in https://issues.apache.org/jira/browse/GROOVY-11130 comment:
??GroovyRootDocBuilder calls getClassDocsFromSingleSource() for all Groovy versions. It uses the legacy parser underneath for Groovy versions prior to 3. It uses the new parser only for versions 4 and above. In Groovy 3, it defaults to the new parser but can be configured to use the old parser.??

 

How can I use old parser for groovy 3.0.17? How can I configure GroovyRootDocBuilder?

> GroovyClassDoc has empty 'enumConstants' when call method GroovyDocParser.getClassDocsFromSingleSource(...)
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11269
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11269
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 2.5.12, 3.0.17
>            Reporter: Dmitry
>            Priority: Major
>         Attachments: image-2024-01-05-20-21-01-570.png, image-2024-01-05-20-21-42-826.png, image-2024-01-05-20-28-41-678.png, image-2024-01-05-20-30-29-173.png, image-2024-01-05-20-32-52-646.png, image-2024-01-05-20-32-58-921.png
>
>
> https://issues.apache.org/jira/browse/GROOVY-10886
> https://issues.apache.org/jira/browse/GROOVY-11130
> In our project we try to update gradle from 6.8.2 to 8.2.1.
> And gradle 6.8.2 -> use groovy 2.5.12
> But gradle 8.2.1 -> use groovy 3.0.17
> How we parse java/groovy files now ->
> 59 line 
> {code:java}
> private Map<String, GroovyClassDoc> parseGroovy(String src, String packagePath, String file){code}
> [https://github.com/ishgroup/oncourse/blob/main/buildSrc/apidoc/src/main/groovy/au/com/ish/docs/DslGroovyRootDocBuilder.groovy]
>  
> But it doesn't work for gradle 8.2.1 (groovy 3.0.17).
> After discussion this issue in these tasks:
> https://issues.apache.org/jira/browse/GROOVY-10886
> https://issues.apache.org/jira/browse/GROOVY-11130
> I try to use GroovyDocParser from org.codehaus.groovy.tools.groovydoc.antlr4
> {code:java}
> private Map<String, GroovyClassDoc> parseGroovy(String src, String packagePath, String file)
>       throws RecognitionException, TokenStreamException {
>    GroovyDocParser groovyDocParser = new GroovyDocParser(links, properties)
>    def GroovyClassDocMap = groovyDocParser.getClassDocsFromSingleSource(packagePath, file, src)
>    return GroovyClassDocMap
> }{code}
>  
> And It seems to work. But I found this problem:
> When I parse groovy enums, GroovyClassDoc has empty 'enumConstants' and all enum values are in 'fields'.
> !image-2024-01-05-20-21-42-826.png!!image-2024-01-05-20-21-01-570.png!
> But our old implementation has:
> !image-2024-01-05-20-30-29-173.png!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)