private void setPropertiesToBasePojoMarkerImpl(Object obj, Method[] methods) {
for (Method method : methods) {
if (method.getName().contains("get")
&& !method.isAnnotationPresent(Worker.class)
&& !method.getName().contains("getClass")
&& isPojoMarkerMethod(method)
&& method.getParameters().length == 0) {
// in the above condition it says the method getParameters() is undefined for type Method
try {
Serializable result = (Serializable) method.invoke(obj, new Object[0]);
if (result != null) {
if (staticRegistry.isReferencePresent(result) != null)
result = staticRegistry.isReferencePresent(result);
}
String propname = method.getName().toString().substring(3).toLowerCase();
beanEnhancer.getServerBasePojoMarkerImpl().setProperty(propname, result);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
logger.log(Level.WARNING, "unable to invoke method with name" + method.getName() + " " + e);
}
}
}
}
所以這裏的問題是它的一個JDK 7源配置的maven項目。它完美地構建在Linux和Windows機器上。在我的MacBook Pro中,它始終如一地表示該方法對類型Method不可用。getParameters()應該返回一個數組,這個代碼應該在jdk 7 maven項目中成功
我敢肯定這個方法應該適用於所有構建JDK 7
任何線索嗎?
請發佈確切的編譯錯誤。 –