devoured elysium
devoured elysium

Reputation: 105197

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

Upvotes: 1

Views: 618

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533720

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;

Upvotes: 4

Related Questions