[ https://issues.apache.org/jira/browse/GROOVY-3341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved GROOVY-3341. --------------------------------------- Resolution: Fixed Assignee: Pascal Schumacher Fix Version/s: 2.4.6 Applied. Thanks for the patch! > MissingMethodException in Builder is misleading > ----------------------------------------------- > > Key: GROOVY-3341 > URL: https://issues.apache.org/jira/browse/GROOVY-3341 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk > Affects Versions: 1.6-beta-1 > Reporter: Noah Sloan > Assignee: Pascal Schumacher > Priority: Minor > Labels: patch-available > Fix For: 2.4.6 > > Attachments: > 0001-GROOVY-3341-If-an-exception-is-thrown-from-a-builder.patch > > > Test Case: > {code} > class Foo extends BuilderSupport { > public void setParent(Object parent, Object child){ > parent.setFoo(child) > } > public Object createNode(Object name){ > return createNode(name,(Object)null) > } > > public Object createNode(Object name, Object value){ > return createNode(name,[:],value) > } > > public Object createNode(Object name, Map attributes){ > return createNode(name,attributes,null) > } > > public Object createNode(Object name, Map attributes, Object value){ > return "${name}" > } > } > try { > def f = new Foo() > f.foo { > bar() > } > } catch(MissingMethodException e) { > assert e.method == "setFoo", "was ${e.method}" > } > {code} > It's actually the method setFoo that is missing, but it is reported as bar > that is missing. Any MissingMethodException thrown while inside a Builder > will be misreported in this way. -- This message was sent by Atlassian JIRA (v6.3.4#6332)