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