Class CpsClosure2

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Closure
com.cloudbees.groovy.cps.impl.CpsClosure
org.jenkinsci.plugins.workflow.cps.CpsClosure2
All Implemented Interfaces:
groovy.lang.GroovyCallable, groovy.lang.GroovyObject, Serializable, Cloneable, Runnable, Callable

public class CpsClosure2 extends CpsClosure
CpsClosure that intercepts the sleep call so that it gets handled via SleepStep, instead of DefaultGroovyStaticMethods.sleep(Object, long) that Groovy adds to Object.

We have to do this because the sleep step (intentionally) picks the same name as a method defined on Object, which CpsScript.sleep(long) delegates. Granted, it is a method added by Groovy, not by JDK, but the end result is still the same, and the consequence is as severe as trying to override hashCode() method and use it for something completely different. (At the time a bug masked the severity of the problem.)

Author:
Kohsuke Kawaguchi
See Also:
  • Field Summary

    Fields inherited from class groovy.lang.Closure

    DELEGATE_FIRST, DELEGATE_ONLY, DONE, IDENTITY, maximumNumberOfParameters, OWNER_FIRST, OWNER_ONLY, parameterTypes, SKIP, TO_SELF
  • Constructor Summary

    Constructors
    Constructor
    Description
    CpsClosure2(Object owner, Object thisObject, List<String> parameters, Block body, Env capture)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    printf(String format, Object value)
     
    void
     
    void
     
    sleep(long arg)
     

    Methods inherited from class com.cloudbees.groovy.cps.impl.CpsClosure

    call, call, call, doCall

    Methods inherited from class groovy.lang.Closure

    asWritable, clone, curry, curry, dehydrate, getDelegate, getDirective, getMaximumNumberOfParameters, getOwner, getParameterTypes, getProperty, getResolveStrategy, getThisObject, isCase, leftShift, leftShift, memoize, memoizeAtLeast, memoizeAtMost, memoizeBetween, ncurry, ncurry, rcurry, rcurry, rehydrate, rightShift, run, setDelegate, setDirective, setProperty, setResolveStrategy, throwRuntimeException, trampoline, trampoline

    Methods inherited from class groovy.lang.GroovyObjectSupport

    getMetaClass, invokeMethod, setMetaClass

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait