@ SuppressWarnings ( "unchecked" ) public static Closure ensureClosure ( Object o ) { if ( o == null ) throw new UnsupportedOperationException ( ) ; if ( o instanceof Closure ) return ( Closure ) o ; return new ReturnValueWrappingClosure ( o ) ; }
Ensures that the provided object is wrapped into a closure if it s not a closure . Do not trust IDEs this method is used in bytecode .