提交 d694061e authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Call Method.isVarArgs() directly, it's available on all supported platforms

上级 9cd0d00d
...@@ -301,29 +301,6 @@ public class FunctionAlias extends SchemaObjectBase { ...@@ -301,29 +301,6 @@ public class FunctionAlias extends SchemaObjectBase {
return source; return source;
} }
/**
* Checks if the given method takes a variable number of arguments. For Java
* 1.4 and older, false is returned. Example:
* <pre>
* public static double mean(double... values)
* </pre>
*
* @param m the method to test
* @return true if the method takes a variable number of arguments.
*/
static boolean isVarArgs(Method m) {
if ("1.5".compareTo(SysProperties.JAVA_SPECIFICATION_VERSION) > 0) {
return false;
}
try {
Method isVarArgs = m.getClass().getMethod("isVarArgs");
Boolean result = (Boolean) isVarArgs.invoke(m);
return result.booleanValue();
} catch (Exception e) {
return false;
}
}
/** /**
* Should the return value ResultSet be buffered in a local temporary file? * Should the return value ResultSet be buffered in a local temporary file?
* *
...@@ -361,7 +338,7 @@ public class FunctionAlias extends SchemaObjectBase { ...@@ -361,7 +338,7 @@ public class FunctionAlias extends SchemaObjectBase {
} }
if (paramCount > 0) { if (paramCount > 0) {
Class<?> lastArg = paramClasses[paramClasses.length - 1]; Class<?> lastArg = paramClasses[paramClasses.length - 1];
if (lastArg.isArray() && FunctionAlias.isVarArgs(method)) { if (lastArg.isArray() && method.isVarArgs()) {
varArgs = true; varArgs = true;
varArgClass = lastArg.getComponentType(); varArgClass = lastArg.getComponentType();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论