You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2015/08/06 14:12:04 UTC
[jira] [Commented] (GROOVY-3341) MissingMethodException in Builder
is misleading
[ https://issues.apache.org/jira/browse/GROOVY-3341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14659905#comment-14659905 ]
Jochen Kemnade commented on GROOVY-3341:
----------------------------------------
Do you need anything else?
> 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
> Priority: Minor
> Labels: patch-available
> 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)