I am using the JDI to debug a program. I am trying to change the value of a field in a certain ObjectReference. I have the Field object, as I can find it through
ObjectReference.referencetype().allFields()
However, I cannot modify that field using
ObjectReference.setValue(Field paramField, Value paramValue)
since that only works on Fields inside this class or its direct superclass -- does not included higher classes up the hierarchy.
Is it possible to change the value of a Field in a class higher than the direct super class? If so, I would appreciate any help to do so!
Thank you,
Dean
EDIT: I am getting the following Error thrown at the line where I call ObjectReference.setValue():
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.tools.jdi.MirrorImpl.validateMirror(MirrorImpl.java:49)
at com.sun.tools.jdi.ObjectReferenceImpl.setValue(ObjectReferenceImpl.java:214)