Skip to content

Commit

Permalink
feat(core): improved No such method traces
Browse files Browse the repository at this point in the history
ref: #924
  • Loading branch information
nbrugger-tgm authored and mirkosertic committed Jun 15, 2023
1 parent df0608c commit 99e37aa
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;

import java.io.*;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -109,11 +110,21 @@ public void registerDirectSubclass(final ResolvedClass cl) {
public ResolvedMethod resolveMethod(final String methodName, final Type methodType, final AnalysisStack analysisStack) {
final ResolvedMethod m = resolveMethodInternal(methodName, methodType, analysisStack, false);
if (m == null) {
throw new IllegalStateException("No such method : " + classNode.name + "." + methodName + methodType);
throw new AnalysisException(
new IllegalStateException("No such method : " + classNode.name + "." + methodName + methodType),
analysisStack
);
}
return m;
}

private String printStackTrace(AnalysisStack analysisStack) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PrintStream stringStream = new PrintStream(bos);
analysisStack.dumpAnalysisStack(stringStream);
return "\n" + bos;
}

private ResolvedMethod resolveMethodInternal(final String methodName, final Type methodType, final AnalysisStack analysisStack, final boolean onlyImplementations) {
for (final ResolvedMethod m : resolvedMethods) {
final MethodNode methodNode = m.methodNode;
Expand Down

0 comments on commit 99e37aa

Please sign in to comment.