private Method funcA; funcA = TheClassA.class.getDeclaredMethod("funcA", null); funcA.setAccessible(true);Here is the warning message being shown on Eclipse IDE.
The argument of type null should explicitly be cast to Class<?>[] for the invocation of the varargs method getDeclaredMethod(String, Class<?>...) from type Class<TheTargetClass>. It could alternatively be cast to Class<?> for a varargs invocation
Method java.lang.Class.getDeclaredMethod(String name, Class... parameterTypes)
The second argument is accepting a class type rather than an object. On top of that, it is a variable number of argument lists. Thus it is still acceptable if I do this.
funcA = TheClassA.class.getDeclaredMethod("funA");
No comments:
Post a Comment