From 023e56614cea99c36d52a85833f20d542b813421 Mon Sep 17 00:00:00 2001 From: "M.Schmidt" Date: Thu, 21 Dec 2023 14:16:22 +0100 Subject: [PATCH] fix IAE:Node not found from vertexOf(..) via .callsTo(..) --- .../java/sootup/callgraph/AbstractCallGraphAlgorithm.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); + } } });