Skip to content

Commit

Permalink
fix IAE:Node not found from vertexOf(..) via .callsTo(..)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissiety committed Dec 21, 2023
1 parent 129eeb7 commit 023e566
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ public CallGraph addClass(@Nonnull CallGraph oldCallGraph, @Nonnull JavaClassTyp
Set<MethodSignature> 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);
}

Expand Down Expand Up @@ -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);
}
}
});

Expand Down

0 comments on commit 023e566

Please sign in to comment.