I was be able to solve the issue , though I do not know why it happened in the first place.
(1) I was loading the object only on PUTFIELD
or PUTSTATIC
opcodes, i.e , when the object value is being set.
(2) Just after bytecode modification the class is getting redefined , as a result of which the code snippet did not work.
(3) Next time when the class loaded due to redefinition
, the object is already being set , so it will not be called again.
(4) Now , when I checked for GETFIELD
or GETSTATIC
opcodes , i.e when the object's value is being retrieved and I loaded it , I was able to view its details.
The same approach which I mentioned above is working fine in usual transformation
(i.e running with premain
).
Any idea on this erratic behaviour of redefinition
?