nus-yam/ex-repair huggingface dataset:
Program: 3635
Project: 3635
Buggy source:
/** 
 * Calls the provided ClassMatchProcessor for classes on the classpath that have a field of the given type. Matches classes that have fields of the given type, array fields with an element type of the given type, and fields of parameterized type that have a type parameter of the given type. (Does not call the classloader on non-matching classes.) The field type must be declared in a package that is whitelisted (and not blacklisted).
 * @param implementedInterface The interface that classes need to implement.
 * @param classMatchProcessor the ClassMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchClassesWithFieldOfType(final Class<T> fieldType,final ClassMatchProcessor classMatchProcessor){
  classMatchers.add(new ClassMatcher(){
    @Override public void lookForMatches(){
      String fieldTypeName=className(fieldType);
      for (      final String klass : getNamesOfClassesWithFieldOfType(fieldTypeName)) {
        if (verbose) {
          Log.log("String_Node_Str" + fieldTypeName + "String_Node_Str"+ klass);
        }
        final Class<? extends T> cls=loadClass(klass);
        classMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
/** 
 * Calls the provided ClassMatchProcessor for classes on the classpath that have a field of the given type. Matches classes that have fields of the given type, array fields with an element type of the given type, and fields of parameterized type that have a type parameter of the given type. (Does not call the classloader on non-matching classes.) The field type must be declared in a package that is whitelisted (and not blacklisted).
 * @param implementedInterface The interface that classes need to implement.
 * @param classMatchProcessor the ClassMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchClassesWithFieldOfType(final Class<T> fieldType,final ClassMatchProcessor classMatchProcessor){
  classMatchers.add(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String fieldTypeName=className(fieldType);
      for (      final String klass : getNamesOfClassesWithFieldOfType(fieldTypeName)) {
        if (verbose) {
          Log.log("String_Node_Str" + fieldTypeName + "String_Node_Str"+ klass);
        }
        final Class<? extends T> cls=loadClass(klass);
        classMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}
Program: 3636
Project: 3636
Buggy source:
/** 
 * Returns the names of classes that have a field of the given type. Returns classes that have fields with the same type as the requested type, array fields with an element type that matches the requested type, and fields of parameterized type that have a type parameter of the requested type. The field type must be declared in a package that is whitelisted (and not blacklisted).
 */
public List<String> getNamesOfClassesWithFieldOfType(final Class<?> fieldType){
  String fieldTypeName=fieldType.getName();
  checkClassNameIsInWhitelistedPackage(fieldTypeName);
  return getScanResults().getNamesOfClassesWithFieldOfType(fieldTypeName);
}

Fixed version (ground truth):
/** 
 * Returns the names of classes that have a field of the given type. Returns classes that have fields with the same type as the requested type, array fields with an element type that matches the requested type, and fields of parameterized type that have a type parameter of the requested type. The field type must be declared in a package that is whitelisted (and not blacklisted).
 */
public List<String> getNamesOfClassesWithFieldOfType(final Class<?> fieldType){
  final String fieldTypeName=fieldType.getName();
  checkClassNameIsInWhitelistedPackage(fieldTypeName);
  return getScanResults().getNamesOfClassesWithFieldOfType(fieldTypeName);
}
Program: 3638
Project: 3638
Buggy source:
/** 
 * Find whitelisted (non-blacklisted) type names in the given type descriptor, and add them to the set of whitelisted field types.
 */
private static HashSet<String> findWhitelistedTypeDescriptorParts(final String typeDescriptor,final ArrayList<String> whitelistClassRefPrefix,final ArrayList<String> blacklistClassRefPrefix,HashSet<String> whitelistedFieldTypes){
  final Matcher matcher=TYPE_PARAM_PATTERN.matcher(typeDescriptor);
  while (matcher.find()) {
    final String descriptorPart=matcher.group(2);
    boolean isWhitelisted=whitelistClassRefPrefix.isEmpty();
    for (    final String whitelistPrefix : whitelistClassRefPrefix) {
      if (descriptorPart.startsWith(whitelistPrefix)) {
        isWhitelisted=true;
        break;
      }
    }
    boolean isBlacklisted=false;
    for (    final String blacklistPrefix : blacklistClassRefPrefix) {
      if (descriptorPart.startsWith(blacklistPrefix)) {
        isBlacklisted=true;
        break;
      }
    }
    if (isWhitelisted && !isBlacklisted) {
      if (whitelistedFieldTypes == null) {
        whitelistedFieldTypes=new HashSet<>();
      }
      final String fieldTypeName=descriptorPart.replace('/','.');
      whitelistedFieldTypes.add(fieldTypeName);
    }
  }
  return whitelistedFieldTypes;
}

Fixed version (ground truth):
/** 
 * Find whitelisted (non-blacklisted) type names in the given type descriptor, and add them to the set of whitelisted field types.
 */
private static HashSet<String> findWhitelistedTypeDescriptorParts(final String typeDescriptor,final ScanSpec scanSpec,HashSet<String> whitelistedFieldTypes){
  final Matcher matcher=TYPE_PARAM_PATTERN.matcher(typeDescriptor);
  while (matcher.find()) {
    final String descriptorPart=matcher.group(2);
    if (scanSpec.pathIsWhitelisted(descriptorPart)) {
      if (whitelistedFieldTypes == null) {
        whitelistedFieldTypes=new HashSet<>();
      }
      final String fieldTypeName=descriptorPart.replace('/','.');
      whitelistedFieldTypes.add(fieldTypeName);
    }
  }
  return whitelistedFieldTypes;
}
Program: 3639
Project: 3639
Buggy source:
public ImplementedInterfaceDAGNode(ClassInfo classInfo){
  super(classInfo);
}

Fixed version (ground truth):
public ImplementedInterfaceDAGNode(final ClassInfo classInfo){
  super(classInfo);
}
Program: 3640
Project: 3640
Buggy source:
public ClassGraphBuilder(final Collection<ClassInfo> relativePathToClassInfo){
  this.allClassInfo=new ArrayList<>(relativePathToClassInfo);
}

Fixed version (ground truth):
public ClassGraphBuilder(final Collection<ClassInfo> classInfoFromScan){
  this.allClassInfo=new ArrayList<>(handleScalaAuxClasses(classInfoFromScan));
}
Program: 3641
Project: 3641
Buggy source:
/** 
 * Connect this node to a different node type (for annotations, the cross-linked class is a class annotated by this annotation; for regular classes, the cross-linked class is an interface that the class implements).
 */
public void addCrossLink(final String crossLinkedClassName){
  this.crossLinkedClassNames.add(crossLinkedClassName);
}

Fixed version (ground truth):
/** 
 * Connect this node to a different node type (for annotations, the cross-linked class is a class annotated by this annotation; for regular classes, the cross-linked class is an interface that the class implements).
 */
public DAGNode addCrossLink(final String crossLinkedClassName){
  this.crossLinkedClassNames.add(crossLinkedClassName);
  return this;
}
Program: 3642
Project: 3642
Buggy source:
/** 
 * Get the named node from the map, or create a new node with this name and store it in the map if there isn't yet a node in the map with this name. Returns the found or created node, after connecting it as a super-node to the specified sub-node.
 */
public static DAGNode getOrNew(final HashMap<String,DAGNode> map,final String name,final DAGNode subNode){
  DAGNode node=map.get(name);
  if (node == null) {
    map.put(name,node=new DAGNode(name));
  }
  subNode.directSuperNodes.add(node);
  node.directSubNodes.add(subNode);
  return node;
}

Fixed version (ground truth):
/** 
 * Get the named node from the map, or create a new node with this name and store it in the map if there isn't yet a node in the map with this name. Returns the found or created node.
 */
public static DAGNode getOrNew(final HashMap<String,DAGNode> map,final String name){
  DAGNode node=map.get(name);
  if (node == null) {
    map.put(name,node=new DAGNode(name));
  }
  return node;
}
Program: 3644
Project: 3644
Buggy source:
/** 
 * Override the system classpath with a custom classpath to search. 
 */
public void overrideClasspath(final String classpath){
  clearClasspath();
  for (  final String pathElement : classpath.split(File.pathSeparator)) {
    addClasspathElement(pathElement);
  }
  initialized=true;
}

Fixed version (ground truth):
/** 
 * Override the system classpath with a custom classpath to search. 
 */
public void overrideClasspath(final String classpath){
  clearClasspath();
  addClasspathElements(classpath);
  initialized=true;
}
Program: 3646
Project: 3646
Buggy source:
/** 
 * Scans the classpath for matching files, and calls any match processors if a match is identified. This method should be called after all required match processors have been added. This method should be called before any "getNamesOf" methods (e.g. getNamesOfSubclassesOf()).
 */
public FastClasspathScanner scan(){
  recursiveScanner.scan(false);
  return this;
}

Fixed version (ground truth):
/** 
 * Scans the classpath for matching files, and calls any match processors if a match is identified. This method should be called after all required match processors have been added. This method should be called before any "getNamesOf" methods (e.g. getNamesOfSubclassesOf()).
 */
public FastClasspathScanner scan(){
  final long scanStart=System.currentTimeMillis();
  classNameToClassInfo.clear();
  recursiveScanner.scan(false);
  classGraphBuilder=new ClassGraphBuilder(classNameToClassInfo.values());
  for (  final ClassMatcher classMatcher : classMatchers) {
    classMatcher.lookForMatches();
  }
  if (FastClasspathScanner.verbose) {
    Log.log("String_Node_Str" + (System.currentTimeMillis() - scanStart) + "String_Node_Str");
  }
  return this;
}
Program: 3647
Project: 3647
Buggy source:
/** 
 * Calls the provided InterfaceMatchProcessor for classes on the classpath that implement the specified interface or a subinterface, or whose superclasses implement the specified interface or a sub-interface. Will call the class loader on each matching interface (using Class.forName()) before calling the InterfaceMatchProcessor. Does not call the classloader on non-matching classes or interfaces.
 * @param implementedInterface The interface that classes need to implement.
 * @param interfaceMatchProcessor the ClassMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchClassesImplementing(final Class<T> implementedInterface,final InterfaceMatchProcessor<T> interfaceMatchProcessor){
  recursiveScanner.addClassMatcher(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String implementedInterfaceName=interfaceName(implementedInterface);
      for (      final String implClass : getNamesOfClassesImplementing(implementedInterfaceName)) {
        if (verbose) {
          Log.log("String_Node_Str" + implementedInterfaceName + "String_Node_Str"+ implClass);
        }
        final Class<? extends T> cls=loadClass(implClass);
        interfaceMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
/** 
 * Calls the provided InterfaceMatchProcessor for classes on the classpath that implement the specified interface or a subinterface, or whose superclasses implement the specified interface or a sub-interface. Will call the class loader on each matching interface (using Class.forName()) before calling the InterfaceMatchProcessor. Does not call the classloader on non-matching classes or interfaces.
 * @param implementedInterface The interface that classes need to implement.
 * @param interfaceMatchProcessor the ClassMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchClassesImplementing(final Class<T> implementedInterface,final InterfaceMatchProcessor<T> interfaceMatchProcessor){
  classMatchers.add(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String implementedInterfaceName=interfaceName(implementedInterface);
      for (      final String implClass : getNamesOfClassesImplementing(implementedInterfaceName)) {
        if (verbose) {
          Log.log("String_Node_Str" + implementedInterfaceName + "String_Node_Str"+ implClass);
        }
        final Class<? extends T> cls=loadClass(implClass);
        interfaceMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}
Program: 3648
Project: 3648
Buggy source:
/** 
 * Calls the provided SubinterfaceMatchProcessor if an interface that extends a given superinterface is found on the classpath. Will call the class loader on each matching interface (using Class.forName()) before calling the SubinterfaceMatchProcessor. Does not call the classloader on non-matching classes or interfaces.
 * @param superinterface The superinterface to match (i.e. the interface that subinterfaces need to extend to match).
 * @param subinterfaceMatchProcessor the SubinterfaceMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchSubinterfacesOf(final Class<T> superinterface,final SubinterfaceMatchProcessor<T> subinterfaceMatchProcessor){
  recursiveScanner.addClassMatcher(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String superinterfaceName=interfaceName(superinterface);
      for (      final String subinterfaceName : getNamesOfSubinterfacesOf(superinterfaceName)) {
        if (verbose) {
          Log.log("String_Node_Str" + superinterfaceName + "String_Node_Str"+ subinterfaceName);
        }
        final Class<? extends T> cls=loadClass(subinterfaceName);
        subinterfaceMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
/** 
 * Calls the provided SubinterfaceMatchProcessor if an interface that extends a given superinterface is found on the classpath. Will call the class loader on each matching interface (using Class.forName()) before calling the SubinterfaceMatchProcessor. Does not call the classloader on non-matching classes or interfaces.
 * @param superinterface The superinterface to match (i.e. the interface that subinterfaces need to extend to match).
 * @param subinterfaceMatchProcessor the SubinterfaceMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchSubinterfacesOf(final Class<T> superinterface,final SubinterfaceMatchProcessor<T> subinterfaceMatchProcessor){
  classMatchers.add(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String superinterfaceName=interfaceName(superinterface);
      for (      final String subinterfaceName : getNamesOfSubinterfacesOf(superinterfaceName)) {
        if (verbose) {
          Log.log("String_Node_Str" + superinterfaceName + "String_Node_Str"+ subinterfaceName);
        }
        final Class<? extends T> cls=loadClass(subinterfaceName);
        subinterfaceMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}
Program: 3649
Project: 3649
Buggy source:
/** 
 * Returns the names of classes on the classpath that implement the specified interface or a subinterface, or whose superclasses implement the specified interface or a sub-interface. Should be called after scan(), and returns matching interfaces whether or not an InterfaceMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param implementedInterfaceName The name of the interface that classes need to implement.
 * @return A list of the names of matching classes, or the empty list if none.
 */
public List<String> getNamesOfClassesImplementing(final String implementedInterfaceName){
  return classGraphBuilder.getNamesOfClassesImplementing(implementedInterfaceName);
}

Fixed version (ground truth):
/** 
 * Returns the names of classes on the classpath that implement the specified interface or a subinterface, or whose superclasses implement the specified interface or a sub-interface. Should be called after scan(), and returns matching interfaces whether or not an InterfaceMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param implementedInterfaceName The name of the interface that classes need to implement.
 * @return A list of the names of matching classes, or the empty list if none.
 */
public List<String> getNamesOfClassesImplementing(final String implementedInterfaceName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfClassesImplementing(implementedInterfaceName);
}
Program: 3650
Project: 3650
Buggy source:
/** 
 * Calls the provided ClassMatchProcessor if classes are found on the classpath that have the specified annotation.
 * @param annotation The class annotation to match.
 * @param classAnnotationMatchProcessor the ClassAnnotationMatchProcessor to call when a match is found.
 */
public FastClasspathScanner matchClassesWithAnnotation(final Class<?> annotation,final ClassAnnotationMatchProcessor classAnnotationMatchProcessor){
  recursiveScanner.addClassMatcher(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String annotationName=annotationName(annotation);
      for (      final String classWithAnnotation : getNamesOfClassesWithAnnotation(annotationName)) {
        if (verbose) {
          Log.log("String_Node_Str" + annotationName + "String_Node_Str"+ classWithAnnotation);
        }
        final Class<?> cls=loadClass(classWithAnnotation);
        classAnnotationMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
/** 
 * Calls the provided ClassMatchProcessor if classes are found on the classpath that have the specified annotation.
 * @param annotation The class annotation to match.
 * @param classAnnotationMatchProcessor the ClassAnnotationMatchProcessor to call when a match is found.
 */
public FastClasspathScanner matchClassesWithAnnotation(final Class<?> annotation,final ClassAnnotationMatchProcessor classAnnotationMatchProcessor){
  classMatchers.add(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String annotationName=annotationName(annotation);
      for (      final String classWithAnnotation : getNamesOfClassesWithAnnotation(annotationName)) {
        if (verbose) {
          Log.log("String_Node_Str" + annotationName + "String_Node_Str"+ classWithAnnotation);
        }
        final Class<?> cls=loadClass(classWithAnnotation);
        classAnnotationMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}
Program: 3651
Project: 3651
Buggy source:
/** 
 * Return the names of all annotations that are annotated with the specified meta-annotation.
 * @param metaAnnotationName The name of the specified meta-annotation.
 * @return A list of the names of annotations that are annotated with the specified meta annotation, or theempty list if none.
 */
public List<String> getNamesOfAnnotationsWithMetaAnnotation(final String metaAnnotationName){
  return classGraphBuilder.getNamesOfAnnotationsWithMetaAnnotation(metaAnnotationName);
}

Fixed version (ground truth):
/** 
 * Return the names of all annotations that are annotated with the specified meta-annotation.
 * @param metaAnnotationName The name of the specified meta-annotation.
 * @return A list of the names of annotations that are annotated with the specified meta annotation, or theempty list if none.
 */
public List<String> getNamesOfAnnotationsWithMetaAnnotation(final String metaAnnotationName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfAnnotationsWithMetaAnnotation(metaAnnotationName);
}
Program: 3652
Project: 3652
Buggy source:
/** 
 * Returns the names of classes on the classpath that are superclasses of the specified subclass. Should be called after scan(), and returns matching classes whether or not a SubclassMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param subclassName The subclass to match (i.e. the class that needs to extend a superclass for the superclass to match).
 * @return A list of the names of matching classes, or the empty list if none.
 */
public List<String> getNamesOfSuperclassesOf(final String subclassName){
  return classGraphBuilder.getNamesOfSuperclassesOf(subclassName);
}

Fixed version (ground truth):
/** 
 * Returns the names of classes on the classpath that are superclasses of the specified subclass. Should be called after scan(), and returns matching classes whether or not a SubclassMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param subclassName The subclass to match (i.e. the class that needs to extend a superclass for the superclass to match).
 * @return A list of the names of matching classes, or the empty list if none.
 */
public List<String> getNamesOfSuperclassesOf(final String subclassName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfSuperclassesOf(subclassName);
}
Program: 3653
Project: 3653
Buggy source:
/** 
 * Returns the names of interfaces on the classpath that are superinterfaces of a given subinterface. Should be called after scan(), and returns matching interfaces whether or not a SubinterfaceMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching interfaces, just returns their
 * @param subInterfaceName The name of the superinterface to match (i.e. the name of the interface that subinterfaces need to extend).
 * @return A list of the names of matching interfaces, or the empty list if none.
 */
public List<String> getNamesOfSuperinterfacesOf(final String subInterfaceName){
  return classGraphBuilder.getNamesOfSuperinterfacesOf(subInterfaceName);
}

Fixed version (ground truth):
/** 
 * Returns the names of interfaces on the classpath that are superinterfaces of a given subinterface. Should be called after scan(), and returns matching interfaces whether or not a SubinterfaceMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching interfaces, just returns their
 * @param subInterfaceName The name of the superinterface to match (i.e. the name of the interface that subinterfaces need to extend).
 * @return A list of the names of matching interfaces, or the empty list if none.
 */
public List<String> getNamesOfSuperinterfacesOf(final String subInterfaceName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfSuperinterfacesOf(subInterfaceName);
}
Program: 3654
Project: 3654
Buggy source:
/** 
 * Returns the names of all classes and interfaces processed during the scan, i.e. all classes reachable after taking into account the package whitelist and blacklist criteria.
 */
public Set<String> getNamesOfAllClasses(){
  return classGraphBuilder.getNamesOfAllClasses();
}

Fixed version (ground truth):
/** 
 * Returns the names of all classes and interfaces processed during the scan, i.e. all classes reachable after taking into account the package whitelist and blacklist criteria.
 */
public Set<String> getNamesOfAllClasses(){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfAllClasses();
}
Program: 3655
Project: 3655
Buggy source:
/** 
 * Returns the names of interfaces on the classpath that extend a given superinterface. Should be called after scan(), and returns matching interfaces whether or not a SubinterfaceMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching interfaces, just returns their names.
 * @param superInterfaceName The name of the superinterface to match (i.e. the name of the interface that subinterfaces need to extend).
 * @return A list of the names of matching interfaces, or the empty list if none.
 */
public List<String> getNamesOfSubinterfacesOf(final String superInterfaceName){
  return classGraphBuilder.getNamesOfSubinterfacesOf(superInterfaceName);
}

Fixed version (ground truth):
/** 
 * Returns the names of interfaces on the classpath that extend a given superinterface. Should be called after scan(), and returns matching interfaces whether or not a SubinterfaceMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching interfaces, just returns their names.
 * @param superInterfaceName The name of the superinterface to match (i.e. the name of the interface that subinterfaces need to extend).
 * @return A list of the names of matching interfaces, or the empty list if none.
 */
public List<String> getNamesOfSubinterfacesOf(final String superInterfaceName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfSubinterfacesOf(superInterfaceName);
}
Program: 3656
Project: 3656
Buggy source:
/** 
 * Return the names of all annotations and meta-annotations on the specified class or interface.
 * @param classOrInterfaceName The name of the class or interface.
 * @return A list of the names of annotations and meta-annotations on the class, or the empty list if none.
 */
public List<String> getNamesOfAnnotationsOnClass(final String classOrInterfaceName){
  return classGraphBuilder.getNamesOfAnnotationsOnClass(classOrInterfaceName);
}

Fixed version (ground truth):
/** 
 * Return the names of all annotations and meta-annotations on the specified class or interface.
 * @param classOrInterfaceName The name of the class or interface.
 * @return A list of the names of annotations and meta-annotations on the class, or the empty list if none.
 */
public List<String> getNamesOfAnnotationsOnClass(final String classOrInterfaceName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfAnnotationsOnClass(classOrInterfaceName);
}
Program: 3657
Project: 3657
Buggy source:
/** 
 * Returns true if the classpath contents have been changed since scan() was last called. Only considers classpath prefixes whitelisted in the call to the constructor. Returns true if scan() has not yet been run. Much faster than standard classpath scanning, because only timestamps are checked, and jarfiles don't have to be opened.
 */
public boolean classpathContentsModifiedSinceScan(){
  return recursiveScanner.classpathContentsModifiedSinceScan();
}

Fixed version (ground truth):
/** 
 * Returns true if the classpath contents have been changed since scan() was last called. Only considers classpath prefixes whitelisted in the call to the constructor. Returns true if scan() has not yet been run. Much faster than standard classpath scanning, because only timestamps are checked, and jarfiles don't have to be opened.
 */
public boolean classpathContentsModifiedSinceScan(){
  final long scanStart=System.currentTimeMillis();
  boolean modified=recursiveScanner.classpathContentsModifiedSinceScan();
  if (FastClasspathScanner.verbose) {
    Log.log("String_Node_Str" + (System.currentTimeMillis() - scanStart) + "String_Node_Str");
  }
  return modified;
}
Program: 3658
Project: 3658
Buggy source:
/** 
 * Returns the names of classes on the classpath that have the specified annotation. Should be called after scan(), and returns matching classes whether or not a ClassAnnotationMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param annotationName The name of the class annotation.
 * @return A list of the names of classes that have the named annotation, or the empty list if none.
 */
public List<String> getNamesOfClassesWithAnnotation(final String annotationName){
  return classGraphBuilder.getNamesOfClassesWithAnnotation(annotationName);
}

Fixed version (ground truth):
/** 
 * Returns the names of classes on the classpath that have the specified annotation. Should be called after scan(), and returns matching classes whether or not a ClassAnnotationMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param annotationName The name of the class annotation.
 * @return A list of the names of classes that have the named annotation, or the empty list if none.
 */
public List<String> getNamesOfClassesWithAnnotation(final String annotationName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfClassesWithAnnotation(annotationName);
}
Program: 3659
Project: 3659
Buggy source:
/** 
 * Calls the provided SubclassMatchProcessor if classes are found on the classpath that extend the specified superclass. Will call the class loader on each matching class (using Class.forName()) before calling the SubclassMatchProcessor. Does not call the classloader on non-matching classes or interfaces.
 * @param superclass The superclass to match (i.e. the class that subclasses need to extend to match).
 * @param subclassMatchProcessor the SubclassMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchSubclassesOf(final Class<T> superclass,final SubclassMatchProcessor<T> subclassMatchProcessor){
  recursiveScanner.addClassMatcher(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String superclassName=className(superclass);
      for (      final String subclassName : getNamesOfSubclassesOf(superclassName)) {
        if (verbose) {
          Log.log("String_Node_Str" + superclassName + "String_Node_Str"+ subclassName);
        }
        final Class<? extends T> cls=loadClass(subclassName);
        subclassMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
/** 
 * Calls the provided SubclassMatchProcessor if classes are found on the classpath that extend the specified superclass. Will call the class loader on each matching class (using Class.forName()) before calling the SubclassMatchProcessor. Does not call the classloader on non-matching classes or interfaces.
 * @param superclass The superclass to match (i.e. the class that subclasses need to extend to match).
 * @param subclassMatchProcessor the SubclassMatchProcessor to call when a match is found.
 */
public <T>FastClasspathScanner matchSubclassesOf(final Class<T> superclass,final SubclassMatchProcessor<T> subclassMatchProcessor){
  classMatchers.add(new ClassMatcher(){
    @Override public void lookForMatches(){
      final String superclassName=className(superclass);
      for (      final String subclassName : getNamesOfSubclassesOf(superclassName)) {
        if (verbose) {
          Log.log("String_Node_Str" + superclassName + "String_Node_Str"+ subclassName);
        }
        final Class<? extends T> cls=loadClass(subclassName);
        subclassMatchProcessor.processMatch(cls);
      }
    }
  }
);
  return this;
}
Program: 3660
Project: 3660
Buggy source:
/** 
 * Return the names of all meta-annotations on the specified annotation.
 * @param annotationName The name of the specified annotation.
 * @return A list of the names of meta-annotations on the specified annotation, or the empty list if none.
 */
public List<String> getNamesOfMetaAnnotationsOnAnnotation(final String annotationName){
  return classGraphBuilder.getNamesOfMetaAnnotationsOnAnnotation(annotationName);
}

Fixed version (ground truth):
/** 
 * Return the names of all meta-annotations on the specified annotation.
 * @param annotationName The name of the specified annotation.
 * @return A list of the names of meta-annotations on the specified annotation, or the empty list if none.
 */
public List<String> getNamesOfMetaAnnotationsOnAnnotation(final String annotationName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfMetaAnnotationsOnAnnotation(annotationName);
}
Program: 3661
Project: 3661
Buggy source:
/** 
 * Returns the names of classes on the classpath that extend the specified superclass. Should be called after scan(), and returns matching classes whether or not a SubclassMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param superclassName The name of the superclass to match (i.e. the name of the class that subclasses need to extend).
 * @return A list of the names of matching classes, or the empty list if none.
 */
public List<String> getNamesOfSubclassesOf(final String superclassName){
  return classGraphBuilder.getNamesOfSubclassesOf(superclassName);
}

Fixed version (ground truth):
/** 
 * Returns the names of classes on the classpath that extend the specified superclass. Should be called after scan(), and returns matching classes whether or not a SubclassMatchProcessor was added to the scanner before the call to scan(). Does not call the classloader on the matching classes, just returns their names.
 * @param superclassName The name of the superclass to match (i.e. the name of the class that subclasses need to extend).
 * @return A list of the names of matching classes, or the empty list if none.
 */
public List<String> getNamesOfSubclassesOf(final String superclassName){
  checkScanCompleted();
  return classGraphBuilder.getNamesOfSubclassesOf(superclassName);
}
Program: 3664
Project: 3664
Buggy source:
@Test public void varArgsAnyOfByClass(){
  assertThat(scanner.getNamesOfClassesWithMetaAnnotationsAnyOf(MetaAnnotation.class,NonMetaAnnotation.class)).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName(),NonMetaClass.class.getName());
}

Fixed version (ground truth):
@Test public void varArgsAnyOfByClass(){
  assertThat(scanner.getNamesOfClassesWithAnnotationsAnyOf(MetaAnnotation.class,NonMetaAnnotation.class)).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName(),NonMetaClass.class.getName());
}
Program: 3665
Project: 3665
Buggy source:
@Test public void metaAnnotationsByClass(){
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotatedAnnotation.class)).containsExactly(MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithMetaAnnotation(MetaAnnotation.class)).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithMetaAnnotation(MetaAnnotatedAnnotation.class)).containsOnly(MetaAnnotatedClass.class.getName(),MetaMetaAnnotatedClass.class.getName());
}

Fixed version (ground truth):
@Test public void metaAnnotationsByClass(){
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotatedAnnotation.class)).containsExactly(MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotation.class)).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotatedAnnotation.class)).containsOnly(MetaAnnotatedClass.class.getName(),MetaMetaAnnotatedClass.class.getName());
}
Program: 3666
Project: 3666
Buggy source:
@Test public void varArgsAllOfByClass(){
  assertThat(scanner.getNamesOfClassesWithMetaAnnotationsAllOf(MetaAnnotation.class,NonMetaAnnotation.class)).containsExactly(MetaAndNonMetaAnnotatedClass.class.getName());
}

Fixed version (ground truth):
@Test public void varArgsAllOfByClass(){
  assertThat(scanner.getNamesOfClassesWithAnnotationsAllOf(MetaAnnotation.class,NonMetaAnnotation.class)).containsExactly(MetaAndNonMetaAnnotatedClass.class.getName());
}
Program: 3667
Project: 3667
Buggy source:
@Test public void varArgsAllOfByName(){
  assertThat(scanner.getNamesOfClassesWithMetaAnnotationsAllOf(MetaAnnotation.class.getName(),NonMetaAnnotation.class.getName())).containsExactly(MetaAndNonMetaAnnotatedClass.class.getName());
}

Fixed version (ground truth):
@Test public void varArgsAllOfByName(){
  assertThat(scanner.getNamesOfClassesWithAnnotationsAllOf(MetaAnnotation.class.getName(),NonMetaAnnotation.class.getName())).containsExactly(MetaAndNonMetaAnnotatedClass.class.getName());
}
Program: 3668
Project: 3668
Buggy source:
@Test public void nonMeta(){
  assertThat(scanner.getNamesOfClassesWithMetaAnnotation(NonMetaAnnotation.class)).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),NonMetaClass.class.getName());
}

Fixed version (ground truth):
@Test public void nonMeta(){
  assertThat(scanner.getNamesOfClassesWithAnnotation(NonMetaAnnotation.class)).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),NonMetaClass.class.getName());
}
Program: 3669
Project: 3669
Buggy source:
@Test public void varArgsAnyOfByName(){
  assertThat(scanner.getNamesOfClassesWithMetaAnnotationsAnyOf(MetaAnnotation.class.getName(),NonMetaAnnotation.class.getName())).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName(),NonMetaClass.class.getName());
}

Fixed version (ground truth):
@Test public void varArgsAnyOfByName(){
  assertThat(scanner.getNamesOfClassesWithAnnotationsAnyOf(MetaAnnotation.class.getName(),NonMetaAnnotation.class.getName())).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName(),NonMetaClass.class.getName());
}
Program: 3670
Project: 3670
Buggy source:
@Test public void metaAnnotationsByName(){
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotatedAnnotation.class.getName())).containsExactly(MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithMetaAnnotation(MetaAnnotation.class.getName())).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithMetaAnnotation(MetaAnnotatedAnnotation.class.getName())).containsOnly(MetaAnnotatedClass.class.getName(),MetaMetaAnnotatedClass.class.getName());
}

Fixed version (ground truth):
@Test public void metaAnnotationsByName(){
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotatedAnnotation.class.getName())).containsExactly(MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotation.class.getName())).containsOnly(MetaAndNonMetaAnnotatedClass.class.getName(),MetaAnnotatedClass.class.getName());
  assertThat(scanner.getNamesOfClassesWithAnnotation(MetaAnnotatedAnnotation.class.getName())).containsOnly(MetaAnnotatedClass.class.getName(),MetaMetaAnnotatedClass.class.getName());
}
Program: 3672
Project: 3672
Buggy source:
/** 
 * Scan a file.
 */
private void scanFile(final File file,final String absolutePath,final String relativePath,final boolean scanTimestampsOnly) throws IOException {
  lastModified=Math.max(lastModified,file.lastModified());
  if (!scanTimestampsOnly) {
    if (relativePath.endsWith("String_Node_Str")) {
      try (final InputStream inputStream=new FileInputStream(file)){
        readClassInfoFromClassfileHeader(inputStream);
      }
       if (classNameToClassfileHash != null) {
        try (final InputStream inputStream=new FileInputStream(file)){
          hashInputStream(relativePath.substring(0,relativePath.length() - 6).replace('/','.'),inputStream);
        }
       }
    }
 else {
      for (      final FilePathMatcher fileMatcher : filePathMatchers) {
        if (fileMatcher.pattern.matcher(relativePath).matches()) {
          try (final InputStream inputStream=new FileInputStream(file)){
            fileMatcher.fileMatchProcessor.processMatch(absolutePath,relativePath,inputStream);
          }
         }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Scan a file.
 */
private void scanFile(final File file,final String absolutePath,final String relativePath,final boolean scanTimestampsOnly) throws IOException {
  lastModified=Math.max(lastModified,file.lastModified());
  if (!scanTimestampsOnly) {
    if (relativePath.endsWith("String_Node_Str")) {
      try (final InputStream inputStream=new FileInputStream(file)){
        readClassInfoFromClassfileHeader(inputStream);
      }
       if (classNameToClassfileHash != null) {
        try (final InputStream inputStream=new FileInputStream(file)){
          hashInputStream(relativePath.substring(0,relativePath.length() - 6).replace('/','.'),inputStream);
        }
       }
    }
    for (    final FilePathMatcher fileMatcher : filePathMatchers) {
      if (fileMatcher.pattern.matcher(relativePath).matches()) {
        try (final InputStream inputStream=new FileInputStream(file)){
          fileMatcher.fileMatchProcessor.processMatch(absolutePath,relativePath,inputStream);
        }
       }
    }
  }
}
Program: 3674
Project: 3674
Buggy source:
public ArrayList<String> getClassesWithAnnotation(String annotationName){
  return annotationNameToClassName.get(annotationName);
}

Fixed version (ground truth):
public List<String> getClassesWithAnnotation(String annotationName){
  ArrayList<String> classes=annotationNameToClassName.get(annotationName);
  if (classes == null) {
    return Collections.emptyList();
  }
  return classes;
}
Program: 3675
Project: 3675
Buggy source:
public ArrayList<String> getClassesImplementing(String interfaceName){
  return interfaceNameToClassNames.get(interfaceName);
}

Fixed version (ground truth):
public List<String> getClassesImplementing(String interfaceName){
  ArrayList<String> classes=interfaceNameToClassNames.get(interfaceName);
  if (classes == null) {
    return Collections.emptyList();
  }
  return classes;
}
Program: 3676
Project: 3676
Buggy source:
/** 
 * Constructor taking MAX THREAD POOL SIZE  Allows maximum of 4 threads. Any number higher than four or less than one wont be respected. Deprecated use Default Constructor. As the thread pool size will not respected anymore through this constructor. Thread pool size is determined with the number of available processors on the device.
 */
public ThinDownloadManager(int threadPoolSize){
  mRequestQueue=new DownloadRequestQueue(threadPoolSize);
  mRequestQueue.start();
}

Fixed version (ground truth):
/** 
 * Constructor taking MAX THREAD POOL SIZE  Allows maximum of 4 threads. Any number higher than four or less than one wont be respected. Deprecated use Default Constructor. As the thread pool size will not respected anymore through this constructor. Thread pool size is determined with the number of available processors on the device.
 */
public ThinDownloadManager(int threadPoolSize){
  mRequestQueue=new DownloadRequestQueue(threadPoolSize);
  mRequestQueue.start();
  setLoggingEnabled(true);
}
Program: 3677
Project: 3677
Buggy source:
private void transferData(InputStream in,OutputStream out){
  final byte data[]=new byte[BUFFER_SIZE];
  mCurrentBytes=0;
  mRequest.setDownloadState(DownloadManager.STATUS_RUNNING);
  Log.v(TAG,"String_Node_Str" + mContentLength + "String_Node_Str"+ mRequest.getDownloadId());
  for (; ; ) {
    if (mRequest.isCancelled()) {
      Log.v(TAG,"String_Node_Str" + mRequest.getDownloadId());
      mRequest.finish();
      updateDownloadFailed(DownloadManager.ERROR_DOWNLOAD_CANCELLED,"String_Node_Str");
      return;
    }
    int bytesRead=readFromResponse(data,in);
    if (mContentLength != -1 && mContentLength > 0) {
      int progress=(int)((mCurrentBytes * 100) / mContentLength);
      updateDownloadProgress(progress,mCurrentBytes);
    }
    if (bytesRead == -1) {
      updateDownloadComplete();
      return;
    }
 else     if (bytesRead == Integer.MIN_VALUE) {
      return;
    }
    if (writeDataToDestination(data,bytesRead,out)) {
      mCurrentBytes+=bytesRead;
    }
  }
}

Fixed version (ground truth):
private void transferData(InputStream in,OutputStream out){
  final byte data[]=new byte[BUFFER_SIZE];
  mCurrentBytes=0;
  mRequest.setDownloadState(DownloadManager.STATUS_RUNNING);
  Log.v(TAG,"String_Node_Str" + mContentLength + "String_Node_Str"+ mRequest.getDownloadId());
  for (; ; ) {
    if (mRequest.isCancelled()) {
      Log.v(TAG,"String_Node_Str" + mRequest.getDownloadId());
      mRequest.finish();
      updateDownloadFailed(DownloadManager.ERROR_DOWNLOAD_CANCELLED,"String_Node_Str");
      return;
    }
    int bytesRead=readFromResponse(data,in);
    if (mContentLength != -1 && mContentLength > 0) {
      int progress=(int)((mCurrentBytes * 100) / mContentLength);
      updateDownloadProgress(progress,mCurrentBytes);
    }
    if (bytesRead == -1) {
      updateDownloadComplete();
      return;
    }
 else     if (bytesRead == Integer.MIN_VALUE) {
      return;
    }
    if (writeDataToDestination(data,bytesRead,out)) {
      mCurrentBytes+=bytesRead;
    }
 else {
      mRequest.finish();
      updateDownloadFailed(DownloadManager.ERROR_FILE_ERROR,"String_Node_Str");
      return;
    }
  }
}
Program: 3678
Project: 3678
Buggy source:
private void transferData(InputStream in,OutputStream out){
  final byte data[]=new byte[BUFFER_SIZE];
  mCurrentBytes=0;
  mRequest.setDownloadState(DownloadManager.STATUS_RUNNING);
  Log.v(TAG,"String_Node_Str" + mContentLength + "String_Node_Str"+ mRequest.getDownloadId());
  for (; ; ) {
    if (mRequest.isCanceled()) {
      Log.v(TAG,"String_Node_Str" + mRequest.getDownloadId());
      mRequest.finish();
      updateDownloadFailed(DownloadManager.ERROR_DOWNLOAD_CANCELLED,"String_Node_Str");
      return;
    }
    int bytesRead=readFromResponse(data,in);
    if (mContentLength != -1) {
      int progress=(int)((mCurrentBytes * 100) / mContentLength);
      updateDownloadProgress(progress);
    }
    if (bytesRead == -1) {
      updateDownloadComplete();
      return;
    }
 else     if (bytesRead == Integer.MIN_VALUE) {
      return;
    }
    writeDataToDestination(data,bytesRead,out);
    mCurrentBytes+=bytesRead;
  }
}

Fixed version (ground truth):
private void transferData(InputStream in,OutputStream out){
  final byte data[]=new byte[BUFFER_SIZE];
  mCurrentBytes=0;
  mRequest.setDownloadState(DownloadManager.STATUS_RUNNING);
  Log.v(TAG,"String_Node_Str" + mContentLength + "String_Node_Str"+ mRequest.getDownloadId());
  for (; ; ) {
    if (mRequest.isCanceled()) {
      Log.v(TAG,"String_Node_Str" + mRequest.getDownloadId());
      mRequest.finish();
      updateDownloadFailed(DownloadManager.ERROR_DOWNLOAD_CANCELLED,"String_Node_Str");
      return;
    }
    int bytesRead=readFromResponse(data,in);
    if (mContentLength != -1) {
      int progress=(int)((mCurrentBytes * 100) / mContentLength);
      updateDownloadProgress(progress,mCurrentBytes);
    }
    if (bytesRead == -1) {
      updateDownloadComplete();
      return;
    }
 else     if (bytesRead == Integer.MIN_VALUE) {
      return;
    }
    writeDataToDestination(data,bytesRead,out);
    mCurrentBytes+=bytesRead;
  }
}
Program: 3679
Project: 3679
Buggy source:
public void updateDownloadProgress(int progress){
  if (mRequest.getDownloadListener() != null) {
    mDelivery.postProgressUpdate(mRequest,mContentLength,progress);
  }
}

Fixed version (ground truth):
public void updateDownloadProgress(int progress,long downloadedBytes){
  if (mRequest.getDownloadListener() != null) {
    mDelivery.postProgressUpdate(mRequest,mContentLength,downloadedBytes,progress);
  }
}
Program: 3680
Project: 3680
Buggy source:
/** 
 * Cancels all the pending & running requests and releases all the dispatchers.
 */
void release(){
  if (mCurrentRequests != null) {
synchronized (mCurrentRequests) {
      mCurrentRequests.clear();
      mCurrentRequests=null;
    }
  }
  if (mDownloadQueue != null) {
    mDownloadQueue=null;
  }
  stop();
  if (mDownloadDispatchers != null) {
    for (int i=0; i < mDownloadDispatchers.length; i++) {
      mDownloadDispatchers[i]=null;
    }
    mDownloadDispatchers=null;
  }
}

Fixed version (ground truth):
/** 
 * Cancels all the pending & running requests and releases all the dispatchers.
 */
void release(){
  if (mCurrentRequests != null) {
synchronized (mCurrentRequests) {
      mCurrentRequests.clear();
      mCurrentRequests=null;
    }
  }
  if (mDownloadQueue != null) {
    mDownloadQueue=null;
  }
  if (mDownloadDispatchers != null) {
    stop();
    for (int i=0; i < mDownloadDispatchers.length; i++) {
      mDownloadDispatchers[i]=null;
    }
    mDownloadDispatchers=null;
  }
}