public class Checker extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Checker.SuperConstructorWrapper |
static class |
Checker.ThisConstructorWrapper |
static interface |
Checker.Thunk
|
| Constructor and Description |
|---|
Checker() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
checkedBinaryOp(Object lhs,
int op,
Object rhs)
Intercepts the binary expression of the form
lhs op rhs like lhs+rhs, lhs>>rhs, etc. |
static Object |
checkedBitwiseNegate(Object value)
Intercepts unary expressions of the form
~value. |
static Object |
checkedCall(Object _receiver,
boolean safe,
boolean spread,
String _method,
Object[] _args) |
static Object |
checkedCast(Class<?> clazz,
Object exp,
boolean ignoreAutoboxing,
boolean coerce,
boolean strict)
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. |
static Object |
checkedComparison(Object lhs,
int op,
Object rhs)
A compare method that invokes a.equals(b) or a.compareTo(b)==0
|
static Object |
checkedConstructor(Class _type,
Object[] _args) |
static Object |
checkedCreateRange(Object from,
Object to,
boolean inclusive)
Intercepts range expressions of the form
[x..y] or [x..<y]. |
static Object |
checkedGetArray(Object _receiver,
Object _index) |
static Object |
checkedGetAttribute(Object _receiver,
boolean safe,
boolean spread,
Object _property) |
static Object |
checkedGetProperty(Object _receiver,
boolean safe,
boolean spread,
Object _property) |
static Object |
checkedPostfixArray(Object r,
Object i,
String op)
a[i]++ / a[i]--
|
static Object |
checkedPostfixAttribute(Object receiver,
Object property,
boolean safe,
boolean spread,
String op)
a.@x++ / a.@x--
|
static Object |
checkedPostfixProperty(Object receiver,
Object property,
boolean safe,
boolean spread,
String op)
a.x++ / a.x--
|
static Object |
checkedPrefixArray(Object r,
Object i,
String op)
++a[i] / --a[i]
|
static Object |
checkedPrefixAttribute(Object receiver,
Object property,
boolean safe,
boolean spread,
String op)
++a.@x / --a.@x
|
static Object |
checkedPrefixProperty(Object receiver,
Object property,
boolean safe,
boolean spread,
String op)
++a.x / --a.x
|
static Object |
checkedSetArray(Object _receiver,
Object _index,
int op,
Object _value)
Intercepts the array assignment of the form "receiver[index] = value"
|
static Object |
checkedSetAttribute(Object _receiver,
Object _property,
boolean safe,
boolean spread,
int op,
Object _value)
Intercepts the attribute assignment of the form "receiver.@property = value"
|
static Object |
checkedSetProperty(Object _receiver,
Object _property,
boolean safe,
boolean spread,
int op,
Object _value) |
static Object |
checkedStaticCall(Class _receiver,
String _method,
Object[] _args) |
static Object |
checkedSuperCall(Class _senderType,
Object _receiver,
String _method,
Object[] _args) |
static Checker.SuperConstructorWrapper |
checkedSuperConstructor(Class<?> thisClass,
Class<?> superClass,
Object[] superCallArgs,
Object[] constructorArgs,
Class<?>[] constructorParamTypes) |
static Checker.ThisConstructorWrapper |
checkedThisConstructor(Class<?> clazz,
Object[] thisCallArgs,
Object[] constructorArgs,
Class<?>[] constructorParamTypes) |
static Object |
checkedUnaryMinus(Object value)
Intercepts unary expressions of the form
-value. |
static Object |
checkedUnaryPlus(Object value)
Intercepts unary expressions of the form
+value. |
static Checker.Thunk |
preCheckedCast(Class<?> clazz,
Object exp,
boolean ignoreAutoboxing,
boolean coerce,
boolean strict) |
public static Object checkedCall(Object _receiver, boolean safe, boolean spread, String _method, Object[] _args) throws Throwable
Throwablepublic static Object checkedStaticCall(Class _receiver, String _method, Object[] _args) throws Throwable
Throwablepublic static Object checkedConstructor(Class _type, Object[] _args) throws Throwable
Throwablepublic static Object checkedSuperCall(Class _senderType, Object _receiver, String _method, Object[] _args) throws Throwable
Throwablepublic static Checker.SuperConstructorWrapper checkedSuperConstructor(Class<?> thisClass, Class<?> superClass, Object[] superCallArgs, Object[] constructorArgs, Class<?>[] constructorParamTypes) throws Throwable
Throwablepublic static Checker.ThisConstructorWrapper checkedThisConstructor(Class<?> clazz, Object[] thisCallArgs, Object[] constructorArgs, Class<?>[] constructorParamTypes) throws Throwable
Throwablepublic static Object checkedGetProperty(Object _receiver, boolean safe, boolean spread, Object _property) throws Throwable
Throwablepublic static Object checkedSetProperty(Object _receiver, Object _property, boolean safe, boolean spread, int op, Object _value) throws Throwable
Throwablepublic static Object checkedGetAttribute(Object _receiver, boolean safe, boolean spread, Object _property) throws Throwable
Throwablepublic static Object checkedSetAttribute(Object _receiver, Object _property, boolean safe, boolean spread, int op, Object _value) throws Throwable
op - One of the assignment operators of TypesThrowablepublic static Object checkedGetArray(Object _receiver, Object _index) throws Throwable
Throwablepublic static Object checkedSetArray(Object _receiver, Object _index, int op, Object _value) throws Throwable
op - One of the assignment operators of TypesThrowablepublic static Object checkedPostfixArray(Object r, Object i, String op) throws Throwable
op - "next" for ++, "previous" for --. These names are defined by Groovy.Throwablepublic static Object checkedPrefixArray(Object r, Object i, String op) throws Throwable
Throwablepublic static Object checkedPostfixProperty(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
Throwablepublic static Object checkedPrefixProperty(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
Throwablepublic static Object checkedPostfixAttribute(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
Throwablepublic static Object checkedPrefixAttribute(Object receiver, Object property, boolean safe, boolean spread, String op) throws Throwable
Throwablepublic static Object checkedBinaryOp(Object lhs, int op, Object rhs) throws Throwable
lhs op rhs like lhs+rhs, lhs>>rhs, etc.
In Groovy, binary operators are method calls.op - One of the binary operators of TypesThrowableBinaryExpressionHelper.evaluateBinaryExpressionWithAssignment(java.lang.String, org.codehaus.groovy.ast.expr.BinaryExpression)public static Object checkedBitwiseNegate(Object value) throws Throwable
~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.ThrowableUnaryExpressionHelper.writeBitwiseNegate(org.codehaus.groovy.ast.expr.BitwiseNegationExpression),
ScriptBytecodeAdapter.bitwiseNegate(java.lang.Object),
InvokerHelper.bitwiseNegate(java.lang.Object)public static Object checkedCreateRange(Object from, Object to, boolean inclusive) throws Throwable
[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.ThrowableScriptBytecodeAdapter.createRange(java.lang.Object, java.lang.Object, boolean),
ObjectRangepublic static Object checkedUnaryMinus(Object value) throws Throwable
-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.ThrowableUnaryExpressionHelper.writeUnaryMinus(org.codehaus.groovy.ast.expr.UnaryMinusExpression),
ScriptBytecodeAdapter.unaryMinus(java.lang.Object),
InvokerHelper.unaryMinus(java.lang.Object)public static Object checkedUnaryPlus(Object value) throws Throwable
+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.ThrowableUnaryExpressionHelper.writeUnaryPlus(org.codehaus.groovy.ast.expr.UnaryPlusExpression),
ScriptBytecodeAdapter.unaryPlus(java.lang.Object),
InvokerHelper.unaryPlus(java.lang.Object)public static Object checkedComparison(Object lhs, int op, Object rhs) throws Throwable
Throwablepublic static Object checkedCast(Class<?> clazz, Object exp, boolean ignoreAutoboxing, boolean coerce, boolean strict) throws Throwable
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.Throwablepublic static Checker.Thunk preCheckedCast(Class<?> clazz, Object exp, boolean ignoreAutoboxing, boolean coerce, boolean strict) throws Throwable
ThrowableCopyright © 2016–2022. All rights reserved.