[Soot-list] Bug (and fix?) in FastHierarchy

Michael Pradel michael at binaervarianz.de
Fri Feb 8 01:38:12 EST 2013


Hi,

I get a RuntimeException thrown by FastHierarchy, which (I think) should
not be thrown. The problem occurs when you have 3 classes such as
follows (note that the packages and visibilities matter):

package a;
public class A {
  void m() {}
}

package b;
abstract public class B extends A {
  abstract protected void m();
}

package c;
public class C extends B {
  protected void m() {}
}

When you now call FastHierarchy.resolveAbstractDispatch() for a call to
A.m(), then the exception is thrown. The problem is that FastHierarchy
goes down in the hierarchy to C, realizes that m() is not visible here,
goes up to B again, where it throws the exception because it assumes
that the method cannot be abstract.
(See below for code triggering the exception.)

Isn't the check in lines 453-454 of FastHierarchy too strict and should
be removed?

Best regards,
Michael


Code to trigger the exception (Scala, but you'll get the idea):

val cls = Scene.v.getSootClass("a.A")
val m = cls.getMethodByName("m")
val hierarchy = Scene.v.getOrMakeFastHierarchy
hierarchy.resolveAbstractDispatch(m.getDeclaringClass, m)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20130208/16388c76/attachment.bin 


More information about the Soot-list mailing list