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

ASF GitHub Bot commented on GROOVY-7074:
----------------------------------------

GitHub user PascalSchumacher opened a pull request:

    https://github.com/apache/incubator-groovy/pull/131

    GROOVY-7074: fix for using a Builder as delegate in a DelegatingScript

    created out of patch https://issues.apache.org/jira/browse/GROOVY-7074 
submitted by Jochen Kemnade

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/PascalSchumacher/incubator-groovy GROOVY-7074

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-groovy/pull/131.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #131
    
----
commit 646e6584642b225dfff5e19450961848326f24f3
Author: Jochen Kemnade <jochen.kemn...@eddyson.de>
Date:   2015-07-23T11:25:57Z

    GROOVY-7074: fix for using a Builder as delegate in a DelegatingScript

----


> DelegatingScript does not work with Builder as delegate
> -------------------------------------------------------
>
>                 Key: GROOVY-7074
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7074
>             Project: Groovy
>          Issue Type: Bug
>          Components: GroovyScriptEngine
>    Affects Versions: 2.4.0-beta-3
>         Environment: Windows 7, Linux Mint 16 Petra
>            Reporter: Tobias Schulte
>              Labels: patch-available
>         Attachments: 
> 0001-GROOVY-7074-fix-for-using-a-Builder-as-delegate-in-a.patch
>
>
> DelegatingScript does not work, if the delegate is e.g. a MarkupBuilder 
> instance.
>     import org.codehaus.groovy.control.CompilerConfiguration
>     import groovy.xml.MarkupBuilder
>     def cc = new CompilerConfiguration()
>     cc.scriptBaseClass = DelegatingScript.class.name
>     def sh = new GroovyShell(new Binding(), cc)
>     def script = sh.parse('''
>     foo {
>         bar()
>     }
>     ''')
>     def markupBuilder = new MarkupBuilder()
>     script.setDelegate(markupBuilder)
>     script.run()
> does throw a groovy.lang.MissingMethodException. If I change the script to
>     delegate.foo {
>         bar()
>     }
> it works.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to