我该如何重写:
<T> T callMethod(String methodName,Object[] parameters) throws ... { ... return (T) SomeClass.class.getDeclaredMethod(methodName,parameterTypes).invoke(binding,parameters); }
所以它不会产生警告
warning: [unchecked] unchecked cast return (T) SomeClass.class.getDeclaredMethod(methodName,parameters); required: T found: Object where T is a type-variable: T extends Object declared in method <T>callMethod(String,Object[])
我的意思是无SupressWarnings解决方案.