diff --git a/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java b/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java index 16fd368234..e9a204a90d 100644 --- a/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java +++ b/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java @@ -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; @@ -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;