private static PsiType convertToTypeParameter(PsiCapturedWildcardType type, PsiElement methodCall) {
    GlobalSearchScope placeResolveScope = methodCall.getResolveScope();
    PsiType upperBound = PsiClassImplUtil.correctType(type.getUpperBound(), placeResolveScope);
    while (upperBound instanceof PsiCapturedWildcardType) {
      upperBound = PsiClassImplUtil.correctType(((PsiCapturedWildcardType)upperBound).getUpperBound(), placeResolveScope);
    }

    //arrays can't participate in extends list
    if (upperBound instanceof PsiArrayType) {
      return upperBound;
    }

    if (upperBound != null) {
      return InferenceSession.createTypeParameterTypeWithUpperBound(upperBound, methodCall);
    }
    return null;
  }
private static PsiType convertToTypeParameter(PsiCapturedWildcardType type, PsiElement methodCall)