dev@glassfish.java.net

Re: Code inspection of Class.getMethods() and Class.getDeclaredMethods() usage

From: Joe Di Pol <joe.dipol_at_oracle.com>
Date: Mon, 27 Feb 2012 17:17:33 -0800

Tim Quinn just brought up a good point which is some of the other
get*s() methods on Class also have no order guarantee (like getFields()).
While we have not seen evidence of issues with these calls, you may
want to inspect any of your code that uses these calls as well.

Joe


On 02/27/12 04:09 PM, Joe Di Pol wrote:
>
> Just a heads up that I'm about to file a batch of Jira tasks requesting
> engineers to visually inspect code to find any latent bugs that may be
> triggered by the Java 7 behavior change to the Class.getMethods() and
> Class.getDeclaredMethods() calls.
>
> We found and fixed a couple of these in 3.1.2, but since the bugs can
> be intermittent I'd like us to make a proactive effort to stomp out
> any remaining bugs that we may not have hit yet. From what I can tell
> we have over 250 calls to these methods in the trunk. Likely the vast
> majority of these are fine, but we should double check.
>
> Details on the issue (including how some bugs were fixed) are described
> in Tom's excellent document:
>
> https://wikis.oracle.com/display/GlassFish/Method+Ordering+from+Class.getMethods
>
> Call to action:
>
> - If you are assigned a Jira task about this, please read the above
> wiki page and perform the code inspection. You may close the task
> once the inspection is complete and any problems are fixed (or bugs
> filed on things that need to be fixed).
>
> - If you own a component that delivers into GlassFish you won't be
> getting a Jira task since I did not search all projects. But please
> inspect your code for use of getMethods/getDeclaredMethods. See
> Tom's write-up for details.
>
> Thanks!
>
> Joe
>
>
>