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

Groovy calls wrong method if there is a static method on an interface

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.7
    • 2.4.11
    • Compiler
    • None

    Description

      If there is an interface having the static method foo and a class Impl implementing this interface also having a static method foo, then calling Impl.foo() calls the method on the interface. For an easy self contained example have a look at https://github.com/wolfs/groovy-static-interface-method-test/blob/master/src/test/groovy/StaticInterfaceTest.groovy.

      This can yield class cast exceptions on Java 8 and from Java 9 build 125 onwards this yields

      java.lang.IncompatibleClassChangeError: Method ... must be InterfaceMethodref constant
      

      This verification has been introduced here: https://bugs.openjdk.java.net/browse/JDK-8145148.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              wolfs Stefan Wolf
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: