Skip to content

Commit

Permalink
unify conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Liyw979 committed Oct 10, 2023
1 parent 4705075 commit 312465c
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,21 @@ public static Optional<MethodSignature> resolveConcreteDispatch(
List<SootClass<?>> classesInHierarchyOrder = findSuperClassesInclusive(view, current);

for (SootClass<?> currentClass : classesInHierarchyOrder) {
SootMethod concreteMethod = currentClass.getMethod(m.getSubSignature()).orElse(null);
if (concreteMethod != null && !concreteMethod.isAbstract()) {
// found method is not abstract
return Optional.of(concreteMethod.getSignature());
}
if (concreteMethod != null && concreteMethod.isAbstract()) {
if (startClass.isAbstract()
&& !startClass.getType().equals(concreteMethod.getDeclaringClassType())) {
// A not implemented method of an abstract class results into an abstract method
return Optional.empty();
SootMethod method = currentClass.getMethod(m.getSubSignature()).orElse(null);
if (method != null) {
if (!method.isAbstract()) {
// found method is not abstract
return Optional.of(method.getSignature());
} else {
if (startClass.isAbstract()
&& !startClass.getType().equals(method.getDeclaringClassType())) {
// A not implemented method of an abstract class results into an abstract method
return Optional.empty();
}
// found method is abstract and the startClass is not abstract
throw new ResolveException(
"Could not find concrete method for " + m + " because the method is abstract");
}
// found method is abstract and the startClass is not abstract
throw new ResolveException(
"Could not find concrete method for " + m + " because the method is abstract");
}
}

Expand Down

0 comments on commit 312465c

Please sign in to comment.