Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10380

SC: IncompatibleClassChangeError when calling interface default method from non-public interface

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      Consider the following:

      package p;
      interface I {
        default void m() {
          System.out.println("works");
        }
      }
      public abstract class A implements I { // or concrete or implemented in 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
        }
      }
      

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment