Sergey Kachanovskiy created GROOVY-10767:
--------------------------------------------

             Summary: Cannot find matching method when trait that implements 
another trait is compiled statically
                 Key: GROOVY-10767
                 URL: https://issues.apache.org/jira/browse/GROOVY-10767
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 3.0.12
            Reporter: Sergey Kachanovskiy


I have a trait that implements another trait, and when i try to statically 
compile it with groovy 3.0.12, it throws the following error:
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
B.groovy: 12: [Static type checking] - Cannot find matching method 
<UnionType:test.T+test.B>#methodA(). Please check if the declared type is 
correct and if the method exists.
 @ line 12, column 3.
                methodA()
     ^

1 error
{code}

test case files attached. compilation:
{code}
JAVA_HOME=/groovy-test/jdk8u275-b01 /groovy-test/groovy-3.0.12/bin/groovyc 
-classpath /groovy-test/src B.groovy
{code}

all works good with 2.5.14

when I add A into SelfType in B (so that it looks like @SelfType([T,A]), all 
compiles ok with 3.0.12 too.

question: can adding A into SelfType be considered a safe workaround, provided 
that no class implementing B ever directly implements A?





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

Reply via email to