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 18:44:00 UTC

[jira] [Updated] (GROOVY-10380) SC: IncompatibleClassChangeError when calling interface default method from non-public interface

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

Eric Milles updated GROOVY-10380:
---------------------------------
    Labels: default-methods  (was: )

> SC: IncompatibleClassChangeError when calling interface default method from non-public interface
> ------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10380
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10380
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>            Reporter: Eric Milles
>            Priority: Major
>              Labels: default-methods
>
> Consider the following:
> {code:java}
> package p;
> interface I {
>   default void m() {
>     System.out.println("works");
>   }
> }
> public abstract class A implements I { // could be concrete or implemented in groovy as well
> }
> {code}
> {code:groovy}
> // not in package p
> @groovy.transform.CompileStatic // works if CompileDynamic or TypeChecked
> class C extends p.A {
>   void test() {
>     m() // IncompatibleClassChangeError: Found class C, but interface was expected
>   }
> }
> {code}
> In the case of a non-public interface with a public default method, static compilation produces a runtime error that is not present for dynamic groovy or for static java.



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