Do they both return the same thing i.e Long Class. Actually i was using this within PrivilegedAccessor to pass as following
PrivilegedAccessor.invokeMethod(MyClass,
"MyMethod", new Object[] { arg1, arg2 },
new Class[] { long.class, Date.class });
Alternatively I can use
PrivilegedAccessor.invokeMethod(MyClass,
"MyMethod", new Object[] { arg1, arg2 },
new Class[] { Long.TYPE, Date.class });
Which is better to be used keeping in mind autoboxing / unboxing overheads.
** I am passing primitive long from the Test and even the tested method expects primitive long only.
System.out.println(Long.TYPE == long.class);
Producestrue
. S the two are identical. I doubt there would be any autoboxing. – SpoilerLong.TYPE
pre-dateslong.class
I prefer the later. – Loferski