Program: 186073
Project: 186073
Buggy source:
/** 
 * Resolve the supertypes for the types contained in the given openables (ICompilationUnits and/or IClassFiles). Inform the requestor of the resolved supertypes for each supplied source type using: connect(ISourceType suppliedType, IGenericType superclass, IGenericType[] superinterfaces) Also inform the requestor of the supertypes of each additional requested super type which is also a source type instead of a binary type.
 * @param openables
 * @param localTypes
 * @param monitor
 */
public void resolve(Openable[] openables,HashSet localTypes,IProgressMonitor monitor){
  try {
    int openablesLength=openables.length;
    CompilationUnitDeclaration[] parsedUnits=new CompilationUnitDeclaration[openablesLength];
    boolean[] hasLocalType=new boolean[openablesLength];
    org.eclipse.jdt.core.ICompilationUnit[] cus=new org.eclipse.jdt.core.ICompilationUnit[openablesLength];
    int unitsIndex=0;
    CompilationUnitDeclaration focusUnit=null;
    ReferenceBinding focusBinaryBinding=null;
    IType focus=this.builder.getType();
    Openable focusOpenable=null;
    if (focus != null) {
      if (focus.isBinary()) {
        focusOpenable=(Openable)focus.getClassFile();
      }
 else {
        focusOpenable=(Openable)focus.getCompilationUnit();
      }
    }
    Parser parser=new Parser(this.lookupEnvironment.problemReporter,true);
    for (int i=0; i < openablesLength; i++) {
      Openable openable=openables[i];
      if (openable instanceof org.eclipse.jdt.core.ICompilationUnit) {
        org.eclipse.jdt.core.ICompilationUnit cu=(org.eclipse.jdt.core.ICompilationUnit)openable;
        boolean containsLocalType=false;
        if (localTypes == null) {
          containsLocalType=true;
        }
 else {
          IPath path=cu.getPath();
          containsLocalType=localTypes.contains(path.toString());
        }
        CompilationUnitDeclaration parsedUnit=null;
        if (cu.isOpen()) {
          CompilationResult result=new CompilationResult(((ICompilationUnit)cu).getFileName(),i,openablesLength,this.options.maxProblemsPerUnit);
          SourceTypeElementInfo[] typeInfos=null;
          try {
            IType[] topLevelTypes=cu.getTypes();
            int topLevelLength=topLevelTypes.length;
            if (topLevelLength == 0)             continue;
            typeInfos=new SourceTypeElementInfo[topLevelLength];
            for (int j=0; j < topLevelLength; j++) {
              IType topLevelType=topLevelTypes[j];
              typeInfos[j]=(SourceTypeElementInfo)((JavaElement)topLevelType).getElementInfo();
            }
          }
 catch (          JavaModelException e) {
          }
          int flags=!containsLocalType ? SourceTypeConverter.MEMBER_TYPE : SourceTypeConverter.FIELD_AND_METHOD | SourceTypeConverter.MEMBER_TYPE | SourceTypeConverter.LOCAL_TYPE;
          parsedUnit=SourceTypeConverter.buildCompilationUnit(typeInfos,flags,this.lookupEnvironment.problemReporter,result);
          if (containsLocalType)           parsedUnit.bits|=ASTNode.HasAllMethodBodies;
        }
 else {
          IFile file=(IFile)cu.getResource();
          ICompilationUnit sourceUnit=this.builder.createCompilationUnitFromPath(openable,file);
          CompilationResult unitResult=new CompilationResult(sourceUnit,i,openablesLength,this.options.maxProblemsPerUnit);
          parsedUnit=parser.dietParse(sourceUnit,unitResult);
        }
        if (parsedUnit != null) {
          hasLocalType[unitsIndex]=containsLocalType;
          cus[unitsIndex]=cu;
          parsedUnits[unitsIndex++]=parsedUnit;
          try {
            this.lookupEnvironment.buildTypeBindings(parsedUnit,null);
            if (openable.equals(focusOpenable)) {
              focusUnit=parsedUnit;
            }
          }
 catch (          AbortCompilation e) {
          }
        }
      }
 else {
        ClassFile classFile=(ClassFile)openable;
        IBinaryType binaryType=(IBinaryType)JavaModelManager.getJavaModelManager().getInfo(classFile.getType());
        if (binaryType == null) {
          if (classFile.getPackageFragmentRoot().isArchive()) {
            binaryType=this.builder.createInfoFromClassFileInJar(classFile);
          }
 else {
            IResource file=classFile.resource();
            binaryType=this.builder.createInfoFromClassFile(classFile,file);
          }
        }
        if (binaryType != null) {
          try {
            BinaryTypeBinding binaryTypeBinding=this.lookupEnvironment.cacheBinaryType(binaryType,false,null);
            remember(binaryType,binaryTypeBinding);
            if (openable.equals(focusOpenable)) {
              focusBinaryBinding=binaryTypeBinding;
            }
          }
 catch (          AbortCompilation e) {
          }
        }
      }
    }
    TypeDeclaration focusLocalType=null;
    if (focus != null && focusBinaryBinding == null && focusUnit != null && ((Member)focus).getOuterMostLocalContext() != null) {
      focusLocalType=new ASTNodeFinder(focusUnit).findType(focus);
    }
    for (int i=0; i <= this.typeIndex; i++) {
      IGenericType suppliedType=this.typeModels[i];
      if (suppliedType != null && suppliedType.isBinaryType()) {
        CompilationUnitDeclaration previousUnitBeingCompleted=this.lookupEnvironment.unitBeingCompleted;
        try {
          if (previousUnitBeingCompleted == null) {
            this.lookupEnvironment.unitBeingCompleted=FakeUnit;
          }
          ReferenceBinding typeBinding=this.typeBindings[i];
          typeBinding.superclass();
          typeBinding.superInterfaces();
        }
 catch (        AbortCompilation e) {
        }
 finally {
          this.lookupEnvironment.unitBeingCompleted=previousUnitBeingCompleted;
        }
      }
    }
    for (int i=0; i < unitsIndex; i++) {
      CompilationUnitDeclaration parsedUnit=parsedUnits[i];
      if (parsedUnit != null) {
        try {
          boolean containsLocalType=hasLocalType[i];
          if (containsLocalType) {
            parser.getMethodBodies(parsedUnit);
          }
          this.lookupEnvironment.completeTypeBindings(parsedUnit,containsLocalType);
        }
 catch (        AbortCompilation e) {
          hasLocalType[i]=false;
        }
      }
      worked(monitor,1);
    }
    for (int i=0; i < unitsIndex; i++) {
      CompilationUnitDeclaration parsedUnit=parsedUnits[i];
      if (parsedUnit != null) {
        boolean containsLocalType=hasLocalType[i];
        if (containsLocalType) {
          parsedUnit.scope.faultInTypes();
          parsedUnit.resolve();
        }
        rememberAllTypes(parsedUnit,cus[i],containsLocalType);
      }
    }
    if (focusBinaryBinding == null && focus != null && focus.isBinary()) {
      char[] fullyQualifiedName=focus.getFullyQualifiedName().toCharArray();
      focusBinaryBinding=this.lookupEnvironment.getCachedType(CharOperation.splitOn('.',fullyQualifiedName));
      if (focusBinaryBinding == null)       return;
    }
    reportHierarchy(focus,focusLocalType,focusBinaryBinding);
  }
 catch (  ClassCastException e) {
  }
catch (  AbortCompilation e) {
    if (TypeHierarchy.DEBUG)     e.printStackTrace();
  }
 finally {
    reset();
  }
}

Fixed version (ground truth):
/** 
 * Resolve the supertypes for the types contained in the given openables (ICompilationUnits and/or IClassFiles). Inform the requestor of the resolved supertypes for each supplied source type using: connect(ISourceType suppliedType, IGenericType superclass, IGenericType[] superinterfaces) Also inform the requestor of the supertypes of each additional requested super type which is also a source type instead of a binary type.
 * @param openables
 * @param localTypes
 * @param monitor
 */
public void resolve(Openable[] openables,HashSet localTypes,IProgressMonitor monitor){
  try {
    int openablesLength=openables.length;
    CompilationUnitDeclaration[] parsedUnits=new CompilationUnitDeclaration[openablesLength];
    boolean[] hasLocalType=new boolean[openablesLength];
    org.eclipse.jdt.core.ICompilationUnit[] cus=new org.eclipse.jdt.core.ICompilationUnit[openablesLength];
    int unitsIndex=0;
    CompilationUnitDeclaration focusUnit=null;
    ReferenceBinding focusBinaryBinding=null;
    IType focus=this.builder.getType();
    Openable focusOpenable=null;
    if (focus != null) {
      if (focus.isBinary()) {
        focusOpenable=(Openable)focus.getClassFile();
      }
 else {
        focusOpenable=(Openable)focus.getCompilationUnit();
      }
    }
    Parser parser=LanguageSupportFactory.getParser(this.lookupEnvironment.globalOptions,this.lookupEnvironment.problemReporter,true,1);
    for (int i=0; i < openablesLength; i++) {
      Openable openable=openables[i];
      if (openable instanceof org.eclipse.jdt.core.ICompilationUnit) {
        org.eclipse.jdt.core.ICompilationUnit cu=(org.eclipse.jdt.core.ICompilationUnit)openable;
        boolean containsLocalType=false;
        if (localTypes == null) {
          containsLocalType=true;
        }
 else {
          IPath path=cu.getPath();
          containsLocalType=localTypes.contains(path.toString());
        }
        CompilationUnitDeclaration parsedUnit=null;
        if (cu.isOpen()) {
          CompilationResult result=new CompilationResult(((ICompilationUnit)cu).getFileName(),i,openablesLength,this.options.maxProblemsPerUnit);
          SourceTypeElementInfo[] typeInfos=null;
          try {
            IType[] topLevelTypes=cu.getTypes();
            int topLevelLength=topLevelTypes.length;
            if (topLevelLength == 0)             continue;
            typeInfos=new SourceTypeElementInfo[topLevelLength];
            for (int j=0; j < topLevelLength; j++) {
              IType topLevelType=topLevelTypes[j];
              typeInfos[j]=(SourceTypeElementInfo)((JavaElement)topLevelType).getElementInfo();
            }
          }
 catch (          JavaModelException e) {
          }
          int flags=!containsLocalType ? SourceTypeConverter.MEMBER_TYPE : SourceTypeConverter.FIELD_AND_METHOD | SourceTypeConverter.MEMBER_TYPE | SourceTypeConverter.LOCAL_TYPE;
          parsedUnit=SourceTypeConverter.buildCompilationUnit(typeInfos,flags,this.lookupEnvironment.problemReporter,result);
          if (containsLocalType)           parsedUnit.bits|=ASTNode.HasAllMethodBodies;
        }
 else {
          IFile file=(IFile)cu.getResource();
          ICompilationUnit sourceUnit=this.builder.createCompilationUnitFromPath(openable,file);
          CompilationResult unitResult=new CompilationResult(sourceUnit,i,openablesLength,this.options.maxProblemsPerUnit);
          parsedUnit=parser.dietParse(sourceUnit,unitResult);
        }
        if (parsedUnit != null) {
          hasLocalType[unitsIndex]=containsLocalType;
          cus[unitsIndex]=cu;
          parsedUnits[unitsIndex++]=parsedUnit;
          try {
            this.lookupEnvironment.buildTypeBindings(parsedUnit,null);
            if (openable.equals(focusOpenable)) {
              focusUnit=parsedUnit;
            }
          }
 catch (          AbortCompilation e) {
          }
        }
      }
 else {
        ClassFile classFile=(ClassFile)openable;
        IBinaryType binaryType=(IBinaryType)JavaModelManager.getJavaModelManager().getInfo(classFile.getType());
        if (binaryType == null) {
          if (classFile.getPackageFragmentRoot().isArchive()) {
            binaryType=this.builder.createInfoFromClassFileInJar(classFile);
          }
 else {
            IResource file=classFile.resource();
            binaryType=this.builder.createInfoFromClassFile(classFile,file);
          }
        }
        if (binaryType != null) {
          try {
            BinaryTypeBinding binaryTypeBinding=this.lookupEnvironment.cacheBinaryType(binaryType,false,null);
            remember(binaryType,binaryTypeBinding);
            if (openable.equals(focusOpenable)) {
              focusBinaryBinding=binaryTypeBinding;
            }
          }
 catch (          AbortCompilation e) {
          }
        }
      }
    }
    TypeDeclaration focusLocalType=null;
    if (focus != null && focusBinaryBinding == null && focusUnit != null && ((Member)focus).getOuterMostLocalContext() != null) {
      focusLocalType=new ASTNodeFinder(focusUnit).findType(focus);
    }
    for (int i=0; i <= this.typeIndex; i++) {
      IGenericType suppliedType=this.typeModels[i];
      if (suppliedType != null && suppliedType.isBinaryType()) {
        CompilationUnitDeclaration previousUnitBeingCompleted=this.lookupEnvironment.unitBeingCompleted;
        try {
          if (previousUnitBeingCompleted == null) {
            this.lookupEnvironment.unitBeingCompleted=FakeUnit;
          }
          ReferenceBinding typeBinding=this.typeBindings[i];
          typeBinding.superclass();
          typeBinding.superInterfaces();
        }
 catch (        AbortCompilation e) {
        }
 finally {
          this.lookupEnvironment.unitBeingCompleted=previousUnitBeingCompleted;
        }
      }
    }
    for (int i=0; i < unitsIndex; i++) {
      CompilationUnitDeclaration parsedUnit=parsedUnits[i];
      if (parsedUnit != null) {
        try {
          boolean containsLocalType=hasLocalType[i];
          if (containsLocalType) {
            parser.getMethodBodies(parsedUnit);
          }
          this.lookupEnvironment.completeTypeBindings(parsedUnit,containsLocalType);
        }
 catch (        AbortCompilation e) {
          hasLocalType[i]=false;
        }
      }
      worked(monitor,1);
    }
    for (int i=0; i < unitsIndex; i++) {
      CompilationUnitDeclaration parsedUnit=parsedUnits[i];
      if (parsedUnit != null) {
        boolean containsLocalType=hasLocalType[i];
        if (containsLocalType) {
          parsedUnit.scope.faultInTypes();
          parsedUnit.resolve();
        }
        rememberAllTypes(parsedUnit,cus[i],containsLocalType);
      }
    }
    if (focusBinaryBinding == null && focus != null && focus.isBinary()) {
      char[] fullyQualifiedName=focus.getFullyQualifiedName().toCharArray();
      focusBinaryBinding=this.lookupEnvironment.getCachedType(CharOperation.splitOn('.',fullyQualifiedName));
      if (focusBinaryBinding == null)       return;
    }
    reportHierarchy(focus,focusLocalType,focusBinaryBinding);
  }
 catch (  ClassCastException e) {
  }
catch (  AbortCompilation e) {
    if (TypeHierarchy.DEBUG)     e.printStackTrace();
  }
 finally {
    reset();
  }
}