groovy
  1. groovy
  2. GROOVY-3493

Cannot override methods via metaclass that are part of an interface implementation

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.6.2
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The following works...

      class T {
             def doIt() { true }
      }
      
      def t = new T()
      
      assert t.doIt()
      t.metaClass.doIt = { -> false }
      assert !t.doIt()
      

      But this fails...

      interface I {
             def doIt()
      }
      
      class T implements I {
             def doIt() { true }
      }
      
      def t = new T()
      
      assert t.doIt()
      t.metaClass.doIt = { -> false }
      assert !t.doIt()
      

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Luke Daley
            • Votes:
              26 Vote for this issue
              Watchers:
              24 Start watching this issue

              Dates

              • Created:
                Updated: