RFR: (jaxp) 8005473 : Warnings compiling jaxp

Remi Forax forax at univ-mlv.fr
Thu Dec 27 13:25:15 UTC 2012


On 12/27/2012 12:06 AM, Joe Wang wrote:
> Hi,
>
> This is a patch to clean up compiling warnings in jaxp.
>
> Bug: http://bugs.sun.com/view_bug.do?bug_id=8005473
> Webrev: http://cr.openjdk.java.net/~joehw/jdk8/8005473/webrev/
>
> Thanks,
> Joe

Hi Joe,
   Method method = clazz.getMethod(DOM_LEVEL3_METHOD);
is equivalent to
   Method method = clazz.getMethod(DOM_LEVEL3_METHOD, new Class<?>[0]);
so you allocate an empty array each time you call getMethod.

A better patch is to cast null to Class<?>[] (or Object[] for invoke)
    Method method = clazz.getMethod(DOM_LEVEL3_METHOD, (Class<?>[])null);

cheers,
Rémi





More information about the core-libs-dev mailing list