You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:32:00 UTC

[jira] [Closed] (GROOVY-10379) Error for super class and super interface methods of same name

     [ https://issues.apache.org/jira/browse/GROOVY-10379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-10379.
------------------------------

> Error for super class and super interface methods of same name
> --------------------------------------------------------------
>
>                 Key: GROOVY-10379
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10379
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.0-beta-2
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: default-methods
>             Fix For: 3.0.10, 4.0.0-rc-1
>
>
> Follow up to GROOVY-9737.  Another variation of static and non-static (interface default in this case) methods of the same name.  Consider the following:
> {code:groovy}
> package p
> abstract class A implements I {
>   static void m(Number n) { print 'number' }
> }
> {code}
> {code:java}
> package p;
> public interface I {
>   default void m(String s) { System.out.print("string"); }
> }
> {code}
> {code:groovy}
> @groovy.transform.CompileStatic
> class C extends p.A {
>   void test() {
>     m('') // error at run-time
>   }
> }
> new C().test()
> {code}
> {code}
> org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'class C' with class 'java.lang.Class' to class 'p.I'
> 	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:420)
> 	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:331)
> 	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:251)
> 	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
> 	at C.test(Main.groovy:4)
> 	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
> 	at Main.run(Main.groovy:7)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)