Class Checker

java.lang.Object
org.kohsuke.groovy.sandbox.impl.Checker

public class Checker extends Object
Intercepted Groovy script calls into this class.
Author:
Kohsuke Kawaguchi
  • Constructor Details

    • Checker

      public Checker()
  • Method Details

    • checkedCall

      public static Object checkedCall(Object _receiver, boolean safe, boolean spread, String _method, Object[] _args) throws Throwable
      Throws:
      Throwable
    • checkedStaticCall

      public static Object checkedStaticCall(Class _receiver, String _method, Object[] _args) throws Throwable
      Throws:
      Throwable
    • checkedConstructor

      public static Object checkedConstructor(Class _type, Object[] _args) throws Throwable
      Throws:
      Throwable
    • checkedSuperCall

      public static Object checkedSuperCall(Class _senderType, Object _receiver, String _method, Object[] _args) throws Throwable
      Throws:
      Throwable
    • checkedSuperConstructor

      public static Checker.SuperConstructorWrapper checkedSuperConstructor(Class<?> thisClass, Class<?> superClass, Object[] superCallArgs, Object[] constructorArgs, Class<?>[] constructorParamTypes) throws Throwable
      Throws:
      Throwable
    • checkedThisConstructor

      public static Checker.ThisConstructorWrapper checkedThisConstructor(Class<?> clazz, Object[] thisCallArgs, Object[] constructorArgs, Class<?>[] constructorParamTypes) throws Throwable
      Throws:
      Throwable
    • checkedGetProperty

      public static Object checkedGetProperty(Object _receiver, boolean safe, boolean spread, Object _property) throws Throwable
      Throws:
      Throwable
    • checkedSetProperty

      public static Object checkedSetProperty(Object _receiver, Object _property, boolean safe, boolean spread, int op, Object _value) throws Throwable
      Throws:
      Throwable
    • checkedGetAttribute

      public static Object checkedGetAttribute(Object _receiver, boolean safe, boolean spread, Object _property) throws Throwable
      Throws:
      Throwable
    • checkedSetAttribute

      public static Object checkedSetAttribute(Object _receiver, Object _property, boolean safe, boolean spread, int op, Object _value) throws Throwable
      Intercepts the attribute assignment of the form "receiver.@property = value"
      Parameters:
      op - One of the assignment operators of Types
      Throws:
      Throwable
    • checkedGetArray

      public static Object checkedGetArray(Object _receiver, Object _index) throws Throwable
      Throws:
      Throwable
    • checkedSetArray

      public static Object checkedSetArray(Object _receiver, Object _index, int op, Object _value) throws Throwable
      Intercepts the array assignment of the form "receiver[index] = value"
      Parameters:
      op - One of the assignment operators of Types
      Throws:
      Throwable
    • checkedPostfixArray

      public static Object checkedPostfixArray(Object r, Object i, String op) throws Throwable
      a[i]++ / a[i]--
      Parameters:
      op - "next" for ++, "previous" for --. These names are defined by Groovy.
      Throws:
      Throwable
    • checkedPrefixArray

      public static Object checkedPrefixArray(Object r, Object i, String op) throws Throwable
      ++a[i] / --a[i]
      Throws:
      Throwable
    • checkedPostfixProperty

      public static Object checkedPostfixProperty(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
      a.x++ / a.x--
      Throws:
      Throwable
    • checkedPrefixProperty

      public static Object checkedPrefixProperty(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
      ++a.x / --a.x
      Throws:
      Throwable
    • checkedPostfixAttribute

      public static Object checkedPostfixAttribute(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
      a.@x++ / a.@x--
      Throws:
      Throwable
    • checkedPrefixAttribute

      public static Object checkedPrefixAttribute(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
      ++a.@x / --a.@x
      Throws:
      Throwable
    • checkedBinaryOp

      public static Object checkedBinaryOp(Object lhs, int op, Object rhs) throws Throwable
      Intercepts the binary expression of the form lhs op rhs like lhs+rhs, lhs>>rhs, etc. In Groovy, binary operators are method calls.
      Parameters:
      op - One of the binary operators of Types
      Throws:
      Throwable
      See Also:
      • BinaryExpressionHelper.evaluateBinaryExpressionWithAssignment(java.lang.String, org.codehaus.groovy.ast.expr.BinaryExpression)
    • checkedBitwiseNegate

      public static Object checkedBitwiseNegate(Object value) throws Throwable
      Intercepts unary expressions of the form ~value. In Groovy, this operator may result in a call to a method named bitwiseNegate on the receiver or to one of the DefaultGroovyMethods.bitwiseNegate overloads.
      Throws:
      Throwable
      See Also:
      • UnaryExpressionHelper.writeBitwiseNegate(org.codehaus.groovy.ast.expr.BitwiseNegationExpression)
      • ScriptBytecodeAdapter.bitwiseNegate(java.lang.Object)
      • InvokerHelper.bitwiseNegate(java.lang.Object)
    • checkedCreateRange

      public static Object checkedCreateRange(Object from, Object to, boolean inclusive) throws Throwable
      Intercepts range expressions of the form [x..y] or [x..<y]. If the from and to expressions are not integers, this operator constructs a ObjectRange, which involves calling various methods on the endpoints during the construction of the range and whenever the range is used. We handle this like we do interfaces in preCheckedCast(java.lang.Class<?>, java.lang.Object, boolean, boolean, boolean) and intercept all of the methods that may be called before allowing the range to be constructed rather than trying to implement our own range type that is sandbox-aware.
      Throws:
      Throwable
      See Also:
      • ScriptBytecodeAdapter.createRange(java.lang.Object, java.lang.Object, boolean)
      • ObjectRange
    • checkedUnaryMinus

      public static Object checkedUnaryMinus(Object value) throws Throwable
      Intercepts unary expressions of the form -value. In Groovy, this operator may result in a call to a method named negative on the receiver or to one of the DefaultGroovyMethods.unaryMinus overloads.
      Throws:
      Throwable
      See Also:
      • UnaryExpressionHelper.writeUnaryMinus(org.codehaus.groovy.ast.expr.UnaryMinusExpression)
      • ScriptBytecodeAdapter.unaryMinus(java.lang.Object)
      • InvokerHelper.unaryMinus(java.lang.Object)
    • checkedUnaryPlus

      public static Object checkedUnaryPlus(Object value) throws Throwable
      Intercepts unary expressions of the form +value. In Groovy, this operator may result in a call to a method named positive on the receiver or to one of the DefaultGroovyMethods.unaryMinus overloads.
      Throws:
      Throwable
      See Also:
      • UnaryExpressionHelper.writeUnaryPlus(org.codehaus.groovy.ast.expr.UnaryPlusExpression)
      • ScriptBytecodeAdapter.unaryPlus(java.lang.Object)
      • InvokerHelper.unaryPlus(java.lang.Object)
    • checkedComparison

      public static Object checkedComparison(Object lhs, int op, Object rhs) throws Throwable
      A compare method that invokes a.equals(b) or a.compareTo(b)==0
      Throws:
      Throwable
    • checkedCast

      public static Object checkedCast(Class<?> clazz, Object exp, boolean ignoreAutoboxing, boolean coerce, boolean strict) throws Throwable
      Runs ScriptBytecodeAdapter.asType(java.lang.Object, java.lang.Class) but only after giving interceptors the chance to reject any possible interface methods as applied to the receiver. For example, might run receiver.method1(null, false) and receiver.method2(0, null) if methods with matching signatures were defined in the interfaces.
      Throws:
      Throwable
    • preCheckedCast

      public static Checker.Thunk preCheckedCast(Class<?> clazz, Object exp, boolean ignoreAutoboxing, boolean coerce, boolean strict) throws Throwable
      Throws:
      Throwable