Class FieldExpression
java.lang.Object
org.jboss.byteman.rule.RuleElement
org.jboss.byteman.rule.expression.Expression
org.jboss.byteman.rule.expression.AssignableExpression
org.jboss.byteman.rule.expression.FieldExpression
an expression which identifies an instance field reference
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Fieldprivate intindex used compiled code when reading or writing a non-public field to obtain the field descriptor from the helper's list of accessible field descriptors.private Stringprivate AssignableExpressionprivate booleanprivate booleanprivate booleantrue if this is a public field otherwise falseprivate Expressionprivate Typeprivate String[] -
Constructor Summary
ConstructorsConstructorDescriptionFieldExpression(Rule rule, Type type, ParseNode fieldTree, String fieldName, Expression owner, String[] pathList) -
Method Summary
Modifier and TypeMethodDescriptionvoidbind()verify that variables mentioned in this expression are actually available in the supplied bindings list and infer/validate the type of this expression or its subexpressions where possiblevoidtreat this as a normal bind because an update to a field reference does not update any bindingsprivate voidvoidcompile(org.objectweb.asm.MethodVisitor mv, CompileContext compileContext) voidcompileAssign(org.objectweb.asm.MethodVisitor mv, CompileContext compileContext) compile an assignment to the referenced location using the value on the top of the Java stack.getPath(int len) intgetPathCount(String name) interpret(HelperAdapter helper) evaluate the expression by interpreting the expression treeinterpretAssign(HelperAdapter helperAdapter, Object value) execute an assignment to the referenced location by interpretation of the expression, using the object passed in this callprivate FieldlookupField(Class<?> ownerClazz, boolean isAssign) ensure that all type references in the expression and its component expressions can be resolved, that the type of the expression is well-defined and that it is compatible with the type expected in the context in which it occurs.private voidtypeCheckAny(boolean isAssign) typeCheckAssign(Type expected) typecheck the expression as an lvalue of an assignment operationvoidwriteTo(StringWriter stringWriter) Methods inherited from class org.jboss.byteman.rule.expression.Expression
getPos, getTypeMethods inherited from class org.jboss.byteman.rule.RuleElement
getBindings, getTypeGroup, rebox, toString
-
Field Details
-
owner
-
pathList
-
fieldName
-
ownerType
-
field
-
indirectStatic
-
isArrayLength
private boolean isArrayLength -
isClassAccess
private boolean isClassAccess -
isPublicField
private boolean isPublicFieldtrue if this is a public field otherwise false -
fieldIndex
private int fieldIndexindex used compiled code when reading or writing a non-public field to obtain the field descriptor from the helper's list of accessible field descriptors.
-
-
Constructor Details
-
FieldExpression
-
-
Method Details
-
bind
verify that variables mentioned in this expression are actually available in the supplied bindings list and infer/validate the type of this expression or its subexpressions where possible- Specified by:
bindin classExpression- Throws:
TypeException- if any variable is missing or has the wrong type
-
bindAssign
treat this as a normal bind because an update to a field reference does not update any bindings- Specified by:
bindAssignin classAssignableExpression- Throws:
TypeException- if any variable is missing or has the wrong type
-
typeCheck
Description copied from class:Expressionensure that all type references in the expression and its component expressions can be resolved, that the type of the expression is well-defined and that it is compatible with the type expected in the context in which it occurs.- Specified by:
typeCheckin classExpression- Parameters:
expected- the type expected for the expression in the contxet in which it occurs. this may be void but should not be undefined at the point where type checking is performed.- Returns:
- the type of the expression
- Throws:
TypeException- if a type check failure occurs
-
typeCheckAssign
Description copied from class:AssignableExpressiontypecheck the expression as an lvalue of an assignment operation- Specified by:
typeCheckAssignin classAssignableExpression- Parameters:
expected- the expected type for the expression- Returns:
- the expression type
- Throws:
TypeException- if a type check error occurs
-
checkIndirectStatic
- Throws:
TypeException
-
typeCheckAny
- Throws:
TypeException
-
interpret
Description copied from class:Expressionevaluate the expression by interpreting the expression tree- Specified by:
interpretin classExpression- Parameters:
helper- an execution context associated with the rule which contains a map of current bindings for rule variables and another map of their declared types both of which are indexed by variable name. This includes entries for the helper (name "-1"), the recipient if the trigger method is not static (name "0") and the trigger method arguments (names "1", ...)- Returns:
- the result of evaluation as an Object
- Throws:
ExecuteException- if an error occurs during execution
-
compile
public void compile(org.objectweb.asm.MethodVisitor mv, CompileContext compileContext) throws CompileException - Specified by:
compilein classRuleElement- Throws:
CompileException
-
getPath
-
getPathCount
-
writeTo
- Specified by:
writeToin classExpression
-
interpretAssign
Description copied from class:AssignableExpressionexecute an assignment to the referenced location by interpretation of the expression, using the object passed in this call- Specified by:
interpretAssignin classAssignableExpression- Parameters:
helperAdapter- an execution context associated with the rule which contains a map of current bindings for rule variables and another map of their declared types both of which are indexed by variable name. This includes entries for the helper (name "-1"), the recipient if the trigger method is not static (name "0") and the trigger method arguments (names "1", ...)value- the value to be assigned to this object- Returns:
- the result of evaluation as an Object
- Throws:
ExecuteException- if an error occurs during execution
-
compileAssign
public void compileAssign(org.objectweb.asm.MethodVisitor mv, CompileContext compileContext) throws CompileException Description copied from class:AssignableExpressioncompile an assignment to the referenced location using the value on the top of the Java stack.- Specified by:
compileAssignin classAssignableExpression- Parameters:
mv- the current method visitorcompileContext- the current compile context- Throws:
CompileException- if a compile error occurs
-
lookupField
- Throws:
NoSuchFieldException
-