Class 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:
    Serialized Form
    • Field Summary

      • Fields inherited from class groovy.lang.Closure

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void print​(Object arg)  
      void printf​(String format, Object value)  
      void println()  
      void println​(Object arg)  
      Object sleep​(long arg)  
      • 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