Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6362451

the string returned by toString() shows the bridge methods as having the volatile modificator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 5.0
    • 5.0u6
    • core-libs
    • None
    • b06
    • 5.0
    • generic
    • generic

      The string returned by toString() shows the bridge methods as having the volatile modificator.

      Run the following code:

      import java.lang.reflect.Method;

      public class BridgeMethodTest {

          public static void main(String[] args) throws ClassNotFoundException {
              Class cl = Class.forName("java.lang.String");
              for(Method m : cl.getDeclaredMethods()) {
                  if (m.isBridge())
                      System.out.println(m);
              }
          }
      }

      The result is:
      public volatile int java.lang.String.compareTo(java.lang.Object)

            darcy Joe Darcy
            rmakarch Roman Makarchuk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: