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] [Created] (GROOVY-10380) SC: IncompatibleClassChangeError when calling interface default method from non-public interface
Eric Milles created GROOVY-10380:
------------------------------------
Summary: 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
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)