jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-2635

Can't replace a setProperty method declared in an object with metaclass directives.

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.5.4
  • Fix Version/s: 3.0
  • Component/s: None
  • Labels:
    None

Description

The following script:

class Test {
    void setProperty(String name, value) {
        println "instanceSetProperty"
    }

    void myMeth() {
        println 'instanceMyMeth'
    }
}

Test.metaClass.setProperty = { String name, value ->
   println 'metaSetProperty'
}
Test.metaClass.myMeth = { ->
   println 'metaMyMeth'
}
Test test = new Test()
test.a = 'b'
test.myMeth()

yields:

instanceSetProperty
metaMyMeth

The setProperty method added via the metaclass is ignored.

Issue Links

depends upon

Task - A task that needs to be done. GROOVY-2503 MOP 2.0 design inflluencing issues

  • Major - Major loss of function.
  • Open - The issue is open and ready for the assignee to start work on it.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
blackdrag blackdrag added a comment - 28/Mar/08 7:30 AM

I changed the fix version to 2.0 because 2.0 is thought to implement a MOP redesign and as long as this does not happen it is unlikely that we will find a good work around for this. It is a limitation of the current design

Show
blackdrag blackdrag added a comment - 28/Mar/08 7:30 AM I changed the fix version to 2.0 because 2.0 is thought to implement a MOP redesign and as long as this does not happen it is unlikely that we will find a good work around for this. It is a limitation of the current design

People

  • Assignee:
    Unassigned
    Reporter:
    Hans Dockter
Vote (0)
Watch (0)

Dates

  • Created:
    27/Feb/08 12:05 AM
    Updated:
    13/Oct/08 7:44 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.