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

Hai Shi commented on GROOVY-11117:
----------------------------------

Thanks for your comment.

 

> parseClass is made to return a single class, in most cases a script.

If this function is limited in parsing single class, I guess the docs should be 
updated or throw a exception when we using this function to parse the single 
class.

 

> If you want to use GroovyClassLoader for this you could extend it by 
> overriding createClassCollector to return a modified ClassCollector in which 
> onClassNode is overwritten, then you can keep a complete list.

 

Thanks for your suggestion. I will try this idea.

> return first nested interface when GroovyClassLoader.parseClass parse 
> interfaces with nested interfaces
> -------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-11117
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11117
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Hai Shi
>            Priority: Major
>
> When I have a groovy file:
> ```
> interface A {
>     interface B
> {     }
>    interface C
> {   }
> ```
> When I use classLoader to parse this file, I only get the `interface B`
> ```
> def gcl = new GroovyClassLoader()
> // this just get the interface B, Something Do I missed?
> def loadedClass = gcl.parseClass(new File("xxxx"))
> ```
>  
> my version:
>  * jdk:18.0.1
>  * groovy: 4.0.2



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

Reply via email to