[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it a bug in Hierarchy?




Hi, following is a piece code in Hierarchy.java resolving virtual method
calls. Can it do the right thing? I think probably it is wrong.

// Questions about method invocation.

/** Given an object of actual type C (o = new C()), returns the method which
    on an o.f() invocation.
*/

public SootMethod resolveConcreteDispatch(SootClass concreteType,
                                          SootMethod m)
{
        checkState();

        if (concreteType.isInterface())
            throw new RuntimeException("class needed!");

        Iterator it = getSuperclassesOfIncluding(concreteType).iterator();
        String methodSig = m.getSubSignature();

        while (it.hasNext())
        {
            SootClass c = (SootClass)it.next();
            if (c.declaresMethod(methodSig))
                return c.getMethod(methodSig);
        }

        throw new RuntimeException("could not resolve concrete
dispatch!\nType: "

}

====================
Feng Qian					fqian@sable.mcgill.ca