Program: 71304
Project: 71304
Buggy source:
/** 
 * Returns a   {@code Method} object that reflects the specifieddeclared method of the class or interface represented by this {@code Class} object. The {@code name} parameter is a{@code String} that specifies the simple name of the desiredmethod, and the  {@code parameterTypes} parameter is an array of{@code Class} objects that identify the method's formal parametertypes, in declared order.  If more than one method with the same parameter types is declared in a class, and one of these methods has a return type that is more specific than any of the others, that method is returned; otherwise one of the methods is chosen arbitrarily.  If the name is "&lt;init&gt;"or "&lt;clinit&gt;" a  {@code NoSuchMethodException}is raised. <p> If this   {@code Class} object represents an array type, then thismethod does not find the  {@code clone()} method.
 * @param name the name of the method
 * @param parameterTypes the parameter array
 * @return  the {@code Method} object for the method of this classmatching the specified name and parameters
 * @throws NoSuchMethodException if a matching method is not found.
 * @throws NullPointerException if {@code name} is {@code null}
 * @throws SecurityException If a security manager, <i>s</i>, is present and any of the following conditions is met: <ul> <li> the caller's class loader is not the same as the class loader of this class and invocation of {@link SecurityManager#checkPermission s.checkPermission} method with{@code RuntimePermission("accessDeclaredMembers")}denies access to the declared method <li> the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of   {@link SecurityManager#checkPackageAccess s.checkPackageAccess()} denies access to the packageof this class </ul>
 * @jls 8.2 Class Members
 * @jls 8.4 Method Declarations
 * @since 1.1
 */
@CallerSensitive public Method getDeclaredMethod(String name,Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException {
  checkMemberAccess(Member.DECLARED,Reflection.getCallerClass(),true);
  Method method=searchMethods(privateGetDeclaredMethods(false),name,parameterTypes);
  if (method == null) {
    throw new NoSuchMethodException(getName() + "String_Node_Str" + name+ argumentTypesToString(parameterTypes));
  }
  return method;
}

Fixed version (ground truth):
/** 
 * Returns a   {@code Method} object that reflects the specifieddeclared method of the class or interface represented by this {@code Class} object. The {@code name} parameter is a{@code String} that specifies the simple name of the desiredmethod, and the  {@code parameterTypes} parameter is an array of{@code Class} objects that identify the method's formal parametertypes, in declared order.  If more than one method with the same parameter types is declared in a class, and one of these methods has a return type that is more specific than any of the others, that method is returned; otherwise one of the methods is chosen arbitrarily.  If the name is "&lt;init&gt;"or "&lt;clinit&gt;" a  {@code NoSuchMethodException}is raised. <p> If this   {@code Class} object represents an array type, then thismethod does not find the  {@code clone()} method.
 * @param name the name of the method
 * @param parameterTypes the parameter array
 * @return  the {@code Method} object for the method of this classmatching the specified name and parameters
 * @throws NoSuchMethodException if a matching method is not found.
 * @throws NullPointerException if {@code name} is {@code null}
 * @throws SecurityException If a security manager, <i>s</i>, is present and any of the following conditions is met: <ul> <li> the caller's class loader is not the same as the class loader of this class and invocation of {@link SecurityManager#checkPermission s.checkPermission} method with{@code RuntimePermission("accessDeclaredMembers")}denies access to the declared method <li> the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of   {@link SecurityManager#checkPackageAccess s.checkPackageAccess()} denies access to the packageof this class </ul>
 * @jls 8.2 Class Members
 * @jls 8.4 Method Declarations
 * @since 1.1
 */
@CallerSensitive public Method getDeclaredMethod(String name,Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException {
  Objects.requireNonNull(name);
  checkMemberAccess(Member.DECLARED,Reflection.getCallerClass(),true);
  Method method=searchMethods(privateGetDeclaredMethods(false),name,parameterTypes);
  if (method == null) {
    throw new NoSuchMethodException(getName() + "String_Node_Str" + name+ argumentTypesToString(parameterTypes));
  }
  return getReflectionFactory().copyMethod(method);
}