Error while instrumenting class files (asm.ClassWriter.getCommonSuperClass)

╄→гoц情女王★ 提交于 2019-12-03 03:31:48

This error is occurring because ASM is generating stack map frames, and for some bytecodes, the stack map frames must contain the common superclass of two classes. By default, ASM implements this by loading classes via Class.forName and then implements the proper algorithm using reflection. Presumably, the ASM library is unable to load your Deposit class from its class loader.

To avoid the error, you'll need to either use SKIP_FRAMES (note: version 51.0 of class file used by Java 7 requires stack map frames, so this is a non-option if you're generating Java 7 bytecode), or you need to subclass ClassWriter and override getCommonSuperClass. Depending on what your code is doing, perhaps you can hard-code the answers using string comparisons, or perhaps you can take the ASM implementation and rewrite it to use a ClassLoader that you specify.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!