hallo,
kann mir jemand sagen, was folgende warning bedeutet?
oder was die wollen, dass man im code tut?
(hinweis: das ganze passiert bei reflection - warning wird in zeile 5 angezeigt.)
[JAVA=1]
public static Method method(Object object, String methodName) {
Method m = null;
try {
// Look for a method with the given name and no parameters
m = object.getClass().getMethod(methodName, null);
} catch (Exception e) {
System.out.println("Can't find method (" +methodName+ "). " + e);
}
return m;
}
[/code]
kann mir jemand sagen, was folgende warning bedeutet?
oder was die wollen, dass man im code tut?
(hinweis: das ganze passiert bei reflection - warning wird in zeile 5 angezeigt.)
Code:
The argument of type null should explicitly be cast to Class<?>[] for the invocation of the varargs method getMethod(String, Class<?>...) from type Class<capture#2-of ? extends Object>. It could alternatively be cast to Class<?> for a varargs invocation
[JAVA=1]
public static Method method(Object object, String methodName) {
Method m = null;
try {
// Look for a method with the given name and no parameters
m = object.getClass().getMethod(methodName, null);
} catch (Exception e) {
System.out.println("Can't find method (" +methodName+ "). " + e);
}
return m;
}
[/code]