public static PsiType banalize(final PsiType t) {
    if (t instanceof PsiClassType) {
      final PsiClassType.ClassResolveResult result = resolveType(t);
      final PsiClass theClass = result.getElement();

      if (theClass == null) {
        return t;
      }

      final PsiSubstitutor theSubst = result.getSubstitutor();
      final PsiManager theManager = theClass.getManager();

      PsiSubstitutor subst = PsiSubstitutor.EMPTY;

      for (final PsiTypeParameter theParm : theSubst.getSubstitutionMap().keySet()) {
        final PsiType actualType = theSubst.substitute(theParm);

        if (actualType == null /*|| actualType instanceof PsiWildcardType*/) {
          subst = subst.put(theParm, Bottom.BOTTOM);
        }
        else if (actualType instanceof PsiWildcardType wctype) {
          final PsiType bound = wctype.getBound();

          if (bound == null) {
            subst = subst.put(theParm, actualType);
          }
          else {
            final PsiType banabound = banalize(bound);

            subst = subst.put(theParm, wctype.isExtends()
                                       ? PsiWildcardType.createExtends(theManager, banabound)
                                       : PsiWildcardType.createSuper(theManager, banabound));
          }
        }
        else {
          final PsiType banType = banalize(actualType);

          if (banType == null) {
            return t;
          }

          subst = subst.put(theParm, banType);
        }
      }

      return JavaPsiFacade.getElementFactory(theManager.getProject()).createType(theClass, subst);
    }
    else if (t instanceof PsiArrayType) {
      return banalize(((PsiArrayType)t).getComponentType()).createArrayType();
    }

    return t;
  }
public static PsiType banalize(final PsiType t)