groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Theodorou (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-3341) MissingMethodException in Builder is misleading
Date Thu, 23 Jul 2015 13:49:04 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-3341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14638816#comment-14638816
] 

Jochen Theodorou commented on GROOVY-3341:
------------------------------------------

nice find, do you want to do a pull request for this? Otherwise I can apply the patch for
you

> 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)

Mime
View raw message