RFR: (jaxp) 8005473 : Warnings compiling jaxp

Chris Hegarty chris.hegarty at oracle.com
Thu Dec 27 21:41:59 UTC 2012


>> 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);

Is this something that the compiler could do? Or is this "inefficiency" 
baked into spec, or serve another purpose?

-Chris.

>>
>> cheers,
>> Rémi
>>
>>



More information about the core-libs-dev mailing list