我正在使用Java asm操纵器操纵一个项目,并在下面获取IndexOutOfBounds错误。因为它在库中,并且损坏的字节码可能在这个大项目中的任何地方,所以我想 a),以便有人对此合并方法错误(一般是什么原因)和< strong> b)建议一种调试技术,因为我真的不知道在哪里查看
private static boolean merge(
final SymbolTable symbolTable,
final int sourceType,
final int[] dstTypes,
final int dstIndex) {
int dstType = dstTypes[dstIndex]; <----- is -1
if (dstType == sourceType) {
// If the types are equal, merge(sourceType, dstType) = dstType, so there is no change.
return false;
}
......
该跟踪几乎无济于事,因为大多数方法都是库方法,而我的方法(visitMaxs)被COMPUTE_FRAMES忽略。
Exception in thread "Thread-0" java.lang.ArrayIndexOutOfBoundsException: -1
at org.objectweb.asm.Frame.merge(Frame.java:1263)
at org.objectweb.asm.Frame.merge(Frame.java:1239)
at org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1617)
at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1553)
at optimiser.visitors.CallSiteOptimiser.visitMaxs(CallSiteOptimiser.java:379)
at org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:768)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2426)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:679)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
at optimiser.JarOptimiser.optimiseAclass(JarOptimiser.java:251)
at optimiser.JarOptimiser.access$1(JarOptimiser.java:220)
at optimiser.JarOptimiser$paralellOpt.run(JarOptimiser.java:300)