JVM Bridge 关键字 - 任何特殊用途



我想知道 JVM 上的"bridge"关键字除了将方法标记为特殊之外是否有任何具体目的?我问这个不是"抽象"或"受保护",这实际上会直接影响其余代码的解释或功能方式。

谢谢

bridge不是

关键字。它用于标记用于实现泛型和协变返回类型的合成方法。它对性能没有太大影响,甚至在运行时也不会出现在调用堆栈中。

从 http://www.docjar.com/html/api/java/lang/reflect/Modifier.java.html

/**
 * The {@code int} value representing the {@code volatile}
 * modifier.
 */
public static final int VOLATILE         = 0x00000040;
// Bits not (yet) exposed in the public API either because they
// have different meanings for fields and methods and there is no
// way to distinguish between the two in this class, or because
// they are not Java programming language keywords
static final int BRIDGE    = 0x00000040;

相关内容

最新更新