[Soot-list] verification error on accessing fields
Paris Yiapanis
yiapanip at cs.man.ac.uk
Wed Jun 23 10:35:51 EDT 2010
Hi all,
I am having a run-time verification problem. I am trying to produce
something similar to the following code in Java:
public class MyClass {
Object objRef;
public void m(){
TempClass tc = (TempClass) objRef;
tc.a[...];
.....
.....
}
The field 'objRef' holds the 'this' reference of an object that is already
instantiated and I am trying to access its instance fields (for example
array 'a') from method m().
Thus, I am casting the reference into the desired class and access the
fields.
The jimple version looks like below:
public void m()
{
myPackage.MyClass r0;
java.lang.Object r1;
int[] r2;
myPackage.TempClass r3;
r0 := @this: myPackage.MyClass;
r1 = r0.<myPackage.MyClass: java.lang.Object objRef>;
r3 = (testLoops2.TempClass) r1;
r2 = r3.<myPackage.TempClass: int[] a>;
....
....
return;
}
It compiles fine, however at run-time produces the verification error:
"Incompatible type for getting or setting field". This error happens on the
statement: r2 = r3.<myPackage.TempClass: int[] a>;
I think it doesn't like the type of 'r3'. I am not sure.
I know the code works fine because if I disable the verification in the VM,
the program runs fine with correct results.
Does anyone know any way around this problem, as I do not want to disable
verification?
Thank you in advance,
Paris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100623/b7dae20c/attachment.html
More information about the Soot-list
mailing list