/** * Return the real argument names for a given method from the source. * * @param method method to lookup parameter names for * @return array of argument names or null if no source is available */ public synchronized String[] getArguments(JAbstractMethod method) { JClassType type = method.getEnclosingType(); JClassType topType = getTopmostType(type); CompilationUnitDeclaration cud = getCudForTopLevelType(topType); if (cud == null) { return null; } TypeDeclaration jdtType = findType(cud, type.getQualifiedBinaryName()); if (jdtType == null) { // TODO(jat): any thing else to do here? return null; } AbstractMethodDeclaration jdtMethod = findMethod(jdtType, method); if (jdtMethod == null) { // TODO(jat): any thing else to do here? return null; } int n = jdtMethod.arguments.length; String[] argNames = new String[n]; for (int i = 0; i < n; ++i) { argNames[i] = String.valueOf(jdtMethod.arguments[i].name); } return argNames; }