Groovy
  1. Groovy
  2. GROOVY-3493

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

    Details

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

      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

          Luke Daley created issue -
          Roshan Dawrani made changes -
          Field Original Value New Value
          Link This issue is duplicated by GROOVY-4210 [ GROOVY-4210 ]
          Graeme Rocher made changes -
          Fix Version/s 1.8.x [ 15750 ]
          Pascal Schumacher made changes -
          Fix Version/s 1.8.x [ 15750 ]
          Jochen Theodorou made changes -
          Component/s groovy-runtime [ 16250 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
          Mark Thomas made changes -
          Workflow jira [ 12732487 ] Default workflow, editable Closed status [ 12744345 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
          Mark Thomas made changes -
          Workflow jira [ 12967328 ] Default workflow, editable Closed status [ 12975062 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Luke Daley
            • Votes:
              20 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

              • Created:
                Updated:

                Development