diff --git a/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java b/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java index 7ab1607c983..36e798e3e01 100644 --- a/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java +++ b/sootup.callgraph/src/main/java/sootup/callgraph/AbstractCallGraphAlgorithm.java @@ -319,7 +319,9 @@ public CallGraph addClass(@Nonnull CallGraph oldCallGraph, @Nonnull JavaClassTyp Set newMethodSignatures = clazz.getMethods().stream().map(Method::getSignature).collect(Collectors.toSet()); + if (newMethodSignatures.stream().anyMatch(oldCallGraph::containsMethod)) { + // FIXME: [ms] handle better - remove from entry point signatures in this case throw new IllegalArgumentException("CallGraph already contains methods from " + classType); } @@ -354,8 +356,10 @@ public CallGraph addClass(@Nonnull CallGraph oldCallGraph, @Nonnull JavaClassTyp MethodSignature overridingMethodSig = clazz.getMethod(overriddenMethodSig.getSubSignature()).get().getSignature(); - for (MethodSignature callingMethodSig : updated.callsTo(overriddenMethodSig)) { - updated.addCall(callingMethodSig, overridingMethodSig); + if( updated.containsMethod(overriddenMethodSig) ){ + for (MethodSignature callingMethodSig : updated.callsTo(overriddenMethodSig)) { + updated.addCall(callingMethodSig, overridingMethodSig); + } } });