11/*
2- * Copyright (c) 1996, 2020 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 1996, 2021 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -567,12 +567,44 @@ public Object invoke(Object obj, Object... args)
567567 }
568568
569569 /**
570- * Returns {@code true} if this method is a bridge
571- * method; returns {@code false} otherwise.
570+ * {@return {@code true} if this method is a bridge
571+ * method; returns {@code false} otherwise}
572572 *
573- * @return true if and only if this method is a bridge
574- * method as defined by the Java Language Specification.
573+ * @apiNote
574+ * A bridge method is a {@linkplain isSynthetic synthetic} method
575+ * created by a Java compiler alongside a method originating from
576+ * the source code. Bridge methods are used by Java compilers in
577+ * various circumstances to span differences in Java programming
578+ * language semantics and JVM semantics.
579+ *
580+ * <p>One example use of bridge methods is as a technique for a
581+ * Java compiler to support <i>covariant overrides</i>, where a
582+ * subclass overrides a method and gives the new method a more
583+ * specific return type than the method in the superclass. While
584+ * the Java language specification forbids a class declaring two
585+ * methods with the same parameter types but a different return
586+ * type, the virtual machine does not. A common case where
587+ * covariant overrides are used is for a {@link
588+ * java.lang.Cloneable Cloneable} class where the {@link
589+ * Object#clone() clone} method inherited from {@code
590+ * java.lang.Object} is overridden and declared to return the type
591+ * of the class. For example, {@code Object} declares
592+ * <pre>{@code protected Object clone() throws CloneNotSupportedException {...}}</pre>
593+ * and {@code EnumSet<E>} declares its language-level {@linkplain
594+ * java.util.EnumSet#clone() covariant override}
595+ * <pre>{@code public EnumSet<E> clone() {...}}</pre>
596+ * If this technique was being used, the resulting class file for
597+ * {@code EnumSet} would have two {@code clone} methods, one
598+ * returning {@code EnumSet<E>} and the second a bridge method
599+ * returning {@code Object}. The bridge method is a JVM-level
600+ * override of {@code Object.clone()}. The body of the {@code
601+ * clone} bridge method calls its non-bridge counterpart and
602+ * returns its result.
575603 * @since 1.5
604+ *
605+ * @jls 8.4.8.3 Requirements in Overriding and Hiding
606+ * @jls 15.12.4.5 Create Frame, Synchronize, Transfer Control
607+ * @jvms 4.6 Methods
576608 */
577609 public boolean isBridge () {
578610 return (getModifiers () & Modifier .BRIDGE ) != 0 ;
@@ -590,6 +622,7 @@ public boolean isVarArgs() {
590622 /**
591623 * {@inheritDoc}
592624 * @jls 13.1 The Form of a Binary
625+ * @jvms 4.6 Methods
593626 * @since 1.5
594627 */
595628 @ Override
0 commit comments