[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
maybe a semantic mistake?
The following is from the method resolveConcreteDispatch in Hierarchy.java.
public SootMethod resolveConcreteDispatch(SootClass concreteType, SootMethod m)
{
..........
while (it.hasNext())
{
SootClass c = (SootClass)it.next();
if (c.declaresMethod(methodSig)
&& isVisible( c, m )
) {
return c.getMethod(methodSig);
}
}
......
}
I think the loop should be terminated once we find a SootClass c s.t. (c.declaresMethod(methodSig)&& ! isVisible( c, m )).
The reason is as follows: think of a Class A ,which has public method f(), Class B which extends A and has a redefined private method f(), Class C extends B and doesn't redefine method f(). Then the instance of C can't access any f(), either in A() or in B(). But in your code, A.f() will be returned.
However, the case I mentioned can't appear in normally compiled java code because B can't override f() in A with weaker access privileges. But maybe it will appear in maliciously/purposefully made bytecode.
As a conclusion, there is no problem in general cases, but there is a mistake semantically, IMHO.
Regards
-Weilei