Java 1.6 getDeclaredMethods() on String class return value changed
In a test we have for our software, we draw information from theString class and build up an array of methods that the class has. We then compare this array against the one that is returned by a call togetDeclaredMethods.
In Java 1.4, there was a method defined by:
int compareTo(Object o)
The corresponding entry in the array of methods thatgetDeclaredMethods returns was:
publicint java.lang.String.compareTo(java.lang.Object)
This method was removed in 1.5, and the array entry changed to:
publicvolatileint java.lang.String.compareTo(java.lang.Object)
This is ok, since the associated access flags value was set to account for this. So, when we determine which modifiers are associated with this call, we realize thatvolatile is one.
Now in Java 1.6, the access flags value is the same as it was in 1.5, so we determine thatvolatile is there. But, the call togetDeclareMethodsonce again returns the entry:
publicint java.lang.String.compareTo(java.lang.Object)
So, the method array we build from the class information does not match the array that is returned from the API call.
The same thing happens for theCharacter class as well (alsoint compareTo(Object o)) .
Is there any reason why this is happening? Is this a bug?

