ASM 的 Frame class 没有通用类型

ASM's Frame class has no generic type

ASM documentation (pdf) 表示,Frame class 具有泛型,提供一个用法示例:Frame<BasicValue>。 (在第 119 页,如果需要)

查看 source 时,我们可以看到它的声明类似于 Frame<V extends Value>

但是由于某些原因,当我在我的项目中指定 maven 依赖项时,

<dependency>
    <groupId>org.ow2.asm</groupId>
    <artifactId>asm</artifactId>
    <version>4.2</version>
</dependency>
<dependency>
     <groupId>org.ow2.asm</groupId>
     <artifactId>asm-analysis</artifactId>
     <version>4.2</version>
</dependency>

或者只是从存储库中手动加载相应的工件,尝试使用 Frame<...> 以错误结束:

Type org.objectweb.asm.tree.analysis.Frame doesn't have type parameters

Intellij IDEA反编译器说Frame真的没有。

同样的问题发生在 AnalyzerInterpreter classes.

我怎么能打败它?

来自ASM FAQ

14. What is the earliest JDK required to use ASM?

...

The asm.util and asm.tree packages require JDK 1.2, ...

History 的 ASM 4.0 RC1

generified the API to use generics and varargs. However, almost all jars are still small and 1.2 compatible.

基本上,当受到干扰时,ASM 优化了字节码,这(除其他外)通过将其主要版本更改为 46 使其向后兼容 1.2(参见 org.objectweb.asm.optimizer.ClassOptimizer)。

我想有两种选择:不使用泛型使用它或自己编译源代码。

补充@dejvuth的回答:

asm-debug-all 恰好是 Java 5.0 版本并且包含所有泛型类型。此外,它与没有泛型的普通 asm 库二进制兼容