简体   繁体   中英

JVM Bridge keyword - any special purpose?

I was wondering if the "bridge" keyword on the JVM has any concrete purpose other than tagging a method as special? I'm asking this as opposed to "abstract" or "protected", which actually will directly influence the way the rest of your code is interpreted or functions.

Thanks

bridge isn't a keyword. It is used to tag synthetic methods used to implement generics and co-variant return types. It doesn't have much impact on performance and doesn't even appear in the call stack at runtime.

From 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM