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

@SelfType in hierarchy with an interface in the middle

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.7
    • Fix Version/s: 2.4.8
    • Component/s: Compiler
    • Labels:
      None

      Description

      interface Self {
          def bar()
      }
      
      @SelfType(Self)
      trait T {
          def foo() {
              println "foo called"
              bar()
          }
      }
      
      interface Middle extends T {}
      
      class C implements Middle {}
      
      new C().foo()
      

      Above code compiles fine but fails at run time with:

      groovy.lang.MissingMethodException: No signature of method: selftype.baseinterface.C.bar() is applicable for argument types: () values: []
      

      The compilation should fail like if Middle was a trait.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                daniilo Daniil Ovchinnikov
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: