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

Peter Schmitz commented on GROOVY-8603:
---------------------------------------

I'd like to say no, but... yes, it is. :-/

> @CompileStatic: matching method check limited to 30 super classes
> -----------------------------------------------------------------
>
>                 Key: GROOVY-8603
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8603
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.3.11, 2.4.13, 2.5.0-rc-3
>            Reporter: Peter Schmitz
>            Priority: Major
>              Labels: CompileStatic, Matching, extends, method, parameters, 
> typecheck
>
> There is currently a maximum hierarchical depth for childclasses when using 
> compile static.
> The compiler only searches for method parameters that match the provided 
> class or up to 29 super classes. This in return means that the usable 
> hierarchical depth is limited 29 child classes/distance from the root.
> Without CompileStatic this limit does not exists. Changing the following code 
> to Java works too.
> This Code:
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic
> class StaticTest {
>    public static int getNummer( ZClassDepth0 instance ) {
>       return instance.depth
>    }
>    public static void main( String[] args ) {
>       println getNummer( new ZClassDepth29() ) //works
>       println getNummer( new ZClassDepth30() ) //doesn't work
>    }
> }
> {code}
> fails with the following execption:
> {code:java}
> Error:(13, 15) Groovyc: [Static type checking] - Cannot find matching method 
> StaticTest#getNummer(ZClassDepth30). Please check if the declared type is 
> right and if the method exists.
> {code}
>  
> How the "ZClassDepth" files where generated:
> {code:java}
> import java.nio.file.Paths
> class Generator {
>    public static void main( String[] args ) {
>       def template = { int nummer ->
>          return """\
> public class ZClassDepth${ nummer } ${ nummer > 0 ? "extends ZClassDepth${ 
> nummer - 1 }" : '' } {
>    ${ nummer > 0 ? '@Override' : '' }
>    public int getDepth() { 
>       return $nummer 
>    }
> }
> """
>       }
>       def path = Paths.get( '[PATH_TO_SOURCE]/src' )
>       101.times{ i ->
>          new File( path.toFile(), "ZClassDepth${i}.groovy" ).text = template( 
> i )
>       }
>    }
> }
> {code}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to