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/26 22:05:00 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17449675#comment-17449675 ]
Eric Milles commented on GROOVY-10380:
--------------------------------------
https://github.com/apache/groovy/commit/fe8c34b45672fdbfcbfdf31ff518aedc2f35f1f7
> 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
> Assignee: Eric Milles
> Priority: Major
> Labels: default-methods
> Fix For: 4.0.0-rc-1
>
>
> Consider the following:
> {code:java}
> package p;
> interface I {
> default void m() {
> System.out.println("works");
> }
> }
> public abstract class A implements I { // or concrete or implemented in groovy
> }
> {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 java.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)