private void remember(IType type, ReferenceBinding typeBinding) {
    if (((CompilationUnit) type.getCompilationUnit()).isOpen()) {
      try {
        IGenericType genericType = (IGenericType) ((JavaElement) type).getElementInfo();
        remember(genericType, typeBinding);
      } catch (JavaModelException e) {
        // cannot happen since element is open
        return;
      }
    } else {
      if (typeBinding == null) return;
      boolean isAnonymous = false;
      try {
        isAnonymous = type.isAnonymous();
      } catch (JavaModelException jme) {
        // Ignore
      }
      if (typeBinding instanceof SourceTypeBinding) {
        TypeDeclaration typeDeclaration = ((SourceTypeBinding) typeBinding).scope.referenceType();

        // simple super class name
        char[] superclassName = null;
        TypeReference superclass;
        if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
          superclass = typeDeclaration.allocation.type;
        } else {
          superclass = typeDeclaration.superclass;
        }
        if (superclass != null) {
          char[][] typeName = superclass.getTypeName();
          superclassName = typeName == null ? null : typeName[typeName.length - 1];
        }

        // simple super interface names
        char[][] superInterfaceNames = null;
        TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
        if (superInterfaces != null) {
          int length = superInterfaces.length;
          superInterfaceNames = new char[length][];
          for (int i = 0; i < length; i++) {
            TypeReference superInterface = superInterfaces[i];
            char[][] typeName = superInterface.getTypeName();
            superInterfaceNames[i] = typeName[typeName.length - 1];
          }
        }

        HierarchyType hierarchyType =
            new HierarchyType(
                type,
                typeDeclaration.name,
                typeDeclaration.binding.modifiers,
                superclassName,
                superInterfaceNames,
                isAnonymous);
        remember(hierarchyType, typeDeclaration.binding);
      } else {
        HierarchyType hierarchyType =
            new HierarchyType(
                type,
                typeBinding.sourceName(),
                typeBinding.modifiers,
                typeBinding.superclass().sourceName(),
                new char[][] {typeBinding.superInterfaces()[0].sourceName()},
                isAnonymous);
        remember(hierarchyType, typeBinding);
      }
    }
  }