Reading static fields supported
This commit is contained in:
@@ -156,4 +156,14 @@ class TestData {
|
||||
return String.CASE_INSENSITIVE_ORDER;
|
||||
}
|
||||
|
||||
static int FIELD = 0;
|
||||
|
||||
static int testPutStaticField() {
|
||||
FIELD = 5;
|
||||
int f1 = FIELD;
|
||||
FIELD = 6;
|
||||
int f2 = FIELD;
|
||||
return f2 + f1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -143,6 +143,11 @@ object REFLECTION_EVAL : Eval {
|
||||
|
||||
override fun setStaticField(fieldDesc: FieldDescription, newValue: Value) {
|
||||
assertTrue(fieldDesc.isStatic)
|
||||
val owner = lookup.findClass(fieldDesc.ownerInternalName)
|
||||
assertNotNull("Class not found: ${fieldDesc.ownerInternalName}", owner)
|
||||
val field = owner!!.findField(fieldDesc)
|
||||
assertNotNull("Field not found: $fieldDesc", field)
|
||||
val result = field!!.set(null, newValue.obj)
|
||||
}
|
||||
|
||||
override fun invokeStaticMethod(methodDesc: MethodDescription, arguments: List<Value>): Value {
|
||||
|
||||
Reference in New Issue
Block a user