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

Removing a metaClass method

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 1.7.2
    • None
    • groovy-jdk
    • None

    Description

      Spotted a question on stackoverflow about removing a metaclass method

      The page here

      http://groovy.codehaus.org/JN3525-MetaClasses

      Says you should be able to do it by setting it to null, but we get this:

      String.metaClass.foo = { "${delegate}foo" }
      assert 'kung'.foo() == 'kungfoo'
      String.metaClass.foo = null
      assert 'woo'.foo() == 'woofoo'
      

      That last assert should fail (according to the docs), but it passes

      Is this a documentation issue?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tim_yates Tim Yates
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: