Program: 17213
Project: 17213
Buggy source:
/** 
 * Determines if a candidate object's type passes a set of included/excluded filters <p/> Returns true of one of the following conditions is true <ol> <li>If included and excluded are both empty then the value passed as includeBothEmpty is returned</li> <li>If included is not empty and excluded is empty and candidate is an instanceof a member of the included array</li> <li>If included is empty and excluded is not empty and candidate is not an instanceof a member of the excluded array</li> <li>If included and excluded are not empty and candidate is an instanceof a member of the included array and candidate is not an instanceof a member of the excluded array</li> </ol>
 * @param candidate        The object to check if it is included or excluded
 * @param included         Array of included classes, may be null
 * @param excluded         Array of excluded classes, may be null
 * @param includeBothEmpty If true then if both the included and excluded arrays are null true will be returned.
 */
public static <T>boolean isIncluded(T candidate,Class<? extends T>[] included,Class<? extends T>[] excluded,boolean includeBothEmpty){
  if (candidate == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final boolean includedEmpty=included == null || included.length == 0;
  final boolean excludedEmpty=excluded == null || excluded.length == 0;
  if (includedEmpty && excludedEmpty) {
    return includeBothEmpty;
  }
  final boolean matchesInclude=matches(candidate,included);
  final boolean matchesExclude=matches(candidate,excluded);
  if (includedEmpty) {
    return !matchesExclude;
  }
  if (excludedEmpty) {
    return matchesInclude;
  }
  return matchesInclude && !matchesExclude;
}

Fixed version (ground truth):
/** 
 * Determines if a candidate object's type passes a set of included/excluded filters <p> Returns true of one of the following conditions is true </p> <ol> <li>If included and excluded are both empty then the value passed as includeBothEmpty is returned</li> <li>If included is not empty and excluded is empty and candidate is an instanceof a member of the included array</li> <li>If included is empty and excluded is not empty and candidate is not an instanceof a member of the excluded array</li> <li>If included and excluded are not empty and candidate is an instanceof a member of the included array and candidate is not an instanceof a member of the excluded array</li> </ol>
 * @param candidate        The object to check if it is included or excluded
 * @param included         Array of included classes, may be null
 * @param excluded         Array of excluded classes, may be null
 * @param includeBothEmpty If true then if both the included and excluded arrays are null true will be returned.
 */
public static <T>boolean isIncluded(T candidate,Class<? extends T>[] included,Class<? extends T>[] excluded,boolean includeBothEmpty){
  if (candidate == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final boolean includedEmpty=included == null || included.length == 0;
  final boolean excludedEmpty=excluded == null || excluded.length == 0;
  if (includedEmpty && excludedEmpty) {
    return includeBothEmpty;
  }
  final boolean matchesInclude=matches(candidate,included);
  final boolean matchesExclude=matches(candidate,excluded);
  if (includedEmpty) {
    return !matchesExclude;
  }
  if (excludedEmpty) {
    return matchesInclude;
  }
  return matchesInclude && !matchesExclude;
}