Program: 3593
Project: 3593
Buggy source:
/** 
 * Add a class that has just been scanned (as opposed to just referenced by a scanned class). Not threadsafe, should be run in single threaded context.
 */
static ClassInfo addScannedClass(final String className,final int classModifiers,final boolean isInterface,final boolean isAnnotation,final Map<String,ClassInfo> classNameToClassInfo,final ClasspathElement classpathElement,final ScanSpec scanSpec,final LogNode log){
  boolean classEncounteredMultipleTimes=false;
  ClassInfo classInfo=classNameToClassInfo.get(className);
  if (classInfo == null) {
    classNameToClassInfo.put(className,classInfo=new ClassInfo(className,classModifiers,false));
  }
 else {
    if (!classInfo.isExternalClass) {
      classEncounteredMultipleTimes=true;
    }
  }
  final ModuleRef modRef=classpathElement.getClasspathElementModuleRef();
  final File file=modRef != null ? null : classpathElement.getClasspathElementFile(log);
  if ((classInfo.moduleRef != null && modRef != null && !classInfo.moduleRef.equals(modRef)) || (classInfo.classpathElementFile != null && file != null && !classInfo.classpathElementFile.equals(file))) {
    classEncounteredMultipleTimes=true;
  }
  if (classEncounteredMultipleTimes) {
    if (log != null) {
      log.log("String_Node_Str" + className + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
  }
  if (classInfo.classpathElementFile == null) {
    classInfo.classpathElementFile=file;
    classInfo.jarfilePackageRoot=classpathElement.getJarfilePackageRoot();
  }
  if (classInfo.moduleRef == null) {
    classInfo.moduleRef=modRef;
  }
  final ClassLoader[] classLoaders=classpathElement.getClassLoaders();
  if (classInfo.classLoaders == null) {
    classInfo.classLoaders=classLoaders;
  }
 else   if (classLoaders != null && !classInfo.classLoaders.equals(classLoaders)) {
    final LinkedHashSet<ClassLoader> allClassLoaders=new LinkedHashSet<>(Arrays.asList(classInfo.classLoaders));
    for (    final ClassLoader classLoader : classLoaders) {
      allClassLoaders.add(classLoader);
    }
    final List<ClassLoader> classLoaderOrder=new ArrayList<>(allClassLoaders);
    classInfo.classLoaders=classLoaderOrder.toArray(new ClassLoader[classLoaderOrder.size()]);
  }
  classInfo.isExternalClass=false;
  classInfo.modifiers|=classModifiers;
  classInfo.isInterface|=isInterface;
  classInfo.isAnnotation|=isAnnotation;
  return classInfo;
}

Fixed version (ground truth):
/** 
 * Add a class that has just been scanned (as opposed to just referenced by a scanned class). Not threadsafe, should be run in single threaded context.
 */
static ClassInfo addScannedClass(final String className,final int classModifiers,final boolean isInterface,final boolean isAnnotation,final Map<String,ClassInfo> classNameToClassInfo,final ClasspathElement classpathElement,final ScanSpec scanSpec,final LogNode log){
  boolean classEncounteredMultipleTimes=false;
  ClassInfo classInfo=classNameToClassInfo.get(className);
  if (classInfo == null) {
    classNameToClassInfo.put(className,classInfo=new ClassInfo(className,classModifiers,false));
  }
 else {
    if (!classInfo.isExternalClass) {
      classEncounteredMultipleTimes=true;
    }
  }
  final ModuleRef modRef=classpathElement.getClasspathElementModuleRef();
  final File file=modRef != null ? null : classpathElement.getClasspathElementFile(log);
  if ((classInfo.moduleRef != null && modRef != null && !classInfo.moduleRef.equals(modRef)) || (classInfo.classpathElementFile != null && file != null && !classInfo.classpathElementFile.equals(file))) {
    classEncounteredMultipleTimes=true;
  }
  if (classEncounteredMultipleTimes) {
    if (log != null) {
      log.log("String_Node_Str" + className + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
  }
  if (classInfo.classpathElementFile == null) {
    classInfo.classpathElementFile=file;
    classInfo.jarfilePackageRoot=classpathElement.getJarfilePackageRoot();
  }
  if (classInfo.moduleRef == null) {
    classInfo.moduleRef=modRef;
  }
  final ClassLoader[] classLoaders=classpathElement.getClassLoaders();
  if (classInfo.classLoaders == null) {
    classInfo.classLoaders=classLoaders;
  }
 else   if (classLoaders != null && !Arrays.equals(classInfo.classLoaders,classLoaders)) {
    final LinkedHashSet<ClassLoader> allClassLoaders=new LinkedHashSet<>(Arrays.asList(classInfo.classLoaders));
    for (    final ClassLoader classLoader : classLoaders) {
      allClassLoaders.add(classLoader);
    }
    final List<ClassLoader> classLoaderOrder=new ArrayList<>(allClassLoaders);
    classInfo.classLoaders=classLoaderOrder.toArray(new ClassLoader[classLoaderOrder.size()]);
  }
  classInfo.isExternalClass=false;
  classInfo.modifiers|=classModifiers;
  classInfo.isInterface|=isInterface;
  classInfo.isAnnotation|=isAnnotation;
  return classInfo;
}