You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/11/23 17:30:00 UTC

[jira] [Assigned] (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 ]

Eric Milles reassigned GROOVY-10379:
------------------------------------

    Assignee: Eric Milles

> 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
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> 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'\r\n
> 	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:420)\r\n
> 	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:331)\r\n
> 	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:251)\r\n
> 	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)\r\n
> 	at C.test(Main.groovy:4)\r\n
> 	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)\r\n
> 	at Main.run(Main.groovy:7)\r\n
> {code}



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