This answer has already been addressed in the question Why use the volatile method in java? But here is some more information.
When you overload methods (perhaps only general methods in a superclass), the method is marked as a "bridge method" . From java.lang.reflect.Modifier
:
static final int BRIDGE = 0x00000040;
Unfortunately, this is the same bit that is used to designate fields as volatile
:
public static final int VOLATILE = 0x00000040;
If you type modifiers for this method, you will see something like:
public volatile
This is a limitation in the Modifiers.toString(int)
method, which does not know if it is a field or a method.
public static String toString(int mod) { StringBuffer sb = new StringBuffer(); ... if ((mod & VOLATILE) != 0) sb.append("volatile ");
source share