United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7023180 : Change in specified-to-be-unspecified ordering of getDeclaredMethods causes application problems

Details
Type:
Bug
Submit Date:
2011-02-28
Status:
Closed
Updated Date:
2012-09-11
Project Name:
JDK
Resolved Date:
2011-04-07
Component:
hotspot
OS:
linux,generic
Sub-Component:
runtime
CPU:
x86,generic
Priority:
P2
Resolution:
Not an Issue
Affected Versions:
7
Fixed Versions:
8

Related Reports
Duplicate:
Duplicate:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
Starting in build 129 of JDK 7, the order of methods returned by getDeclaredMethods changed and can vary from run to run.  This has been observed to cause issues for applications relying on the specified-to-be-unspecified ordering of methods retuned by getDeclaredMethods.

                                    

Comments
EVALUATION

The previously implementation of getDeclaredMethods did not have a firm ordering guarantee and the specification does not require one.  Merely returning a consistent order throughout the run of a VM would not be sufficient to address programs expecting a (mostly) sorted order.

Imposing a predictable ordering is not being considered at this time; closing as not a bug.
                                     
2011-04-07
PUBLIC COMMENTS

http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#incompatibilities ought to mention this change.
                                     
2011-08-22
PUBLIC COMMENTS

Filed a request for JUnit to behave predictably irrespective of VM order: https://github.com/KentBeck/junit/pull/293
                                     
2011-09-09



Hardware and Software, Engineered to Work Together