home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (Groovy3770Bug.groovy)

This example Groovy source code file (Groovy3770Bug.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

groovy3770bug, groovytestcase, hello, hello, ian, ian, mme, mme, runtimeexception, the, the

The Groovy Groovy3770Bug.groovy source code

package groovy.bugs

class Groovy3770Bug extends GroovyTestCase {
    void testSetDelegateAndResolveStrategyOnACurriedClosure() {
        assertScript """
            void hello(who) {
                println ("Hello " + who)
            def c = { x ->
            def d = c.curry("Ian")
            d.delegate = null

            assert d.delegate == null

            d.resolveStrategy = Closure.DELEGATE_ONLY

            try {
                throw new RuntimeException("The curried closure call should have failed here with MME")
            } catch(MissingMethodException ex) {
                // ok if closure call returned in an exception (MME)
    void testCurriedClosuresShouldNotAffectParent() {
        // GROOVY-3875
        def orig = { tmp -> println tmp }
        def curriedOrig = orig.curry(1)
        assert orig != curriedOrig.getOwner()

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy Groovy3770Bug.groovy source code file:

new blog posts


Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.