public class GenericsUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
checkNotInBounds(PsiType type,
PsiType bound,
boolean uncheckedConversionByDefault) |
static boolean |
checkNotInBounds(PsiType type,
PsiType bound,
PsiReferenceParameterList referenceParameterList) |
static PsiType |
eliminateWildcards(PsiType type) |
static PsiType |
eliminateWildcards(PsiType type,
boolean eliminateInTypeArguments) |
static PsiType |
eliminateWildcards(PsiType type,
boolean eliminateInTypeArguments,
boolean eliminateCapturedWildcards) |
static PsiType |
findTypeParameterBoundError(PsiTypeParameter typeParameter,
PsiType[] extendsTypes,
PsiSubstitutor substitutor,
PsiElement context,
boolean allowUncheckedConversion) |
static Pair<PsiTypeParameter,PsiType> |
findTypeParameterWithBoundError(PsiTypeParameter[] typeParams,
PsiSubstitutor substitutor,
PsiElement context,
boolean allowUncheckedConversion) |
static PsiClassType |
getExpectedGenericType(PsiElement context,
PsiClass aClass,
PsiClassType expectedType) |
static java.util.List<PsiType> |
getExpectedTypeArguments(PsiElement context,
PsiClass aClass,
java.lang.Iterable<? extends PsiTypeParameter> typeParams,
PsiClassType expectedType)
Tries to find the type parameters applied to a class which are compatible with expected supertype
|
static PsiType |
getGreatestLowerBound(PsiType type1,
PsiType type2) |
static PsiType |
getLeastUpperBound(PsiType type1,
PsiType type2,
PsiManager manager) |
static PsiClass [] |
getLeastUpperClasses(PsiClass aClass,
PsiClass bClass) |
static PsiType |
getVariableTypeByExpressionType(PsiType type) |
static PsiType |
getVariableTypeByExpressionType(PsiType type,
boolean openCaptured) |
static boolean |
isFromExternalTypeLanguage(PsiType type) |
static boolean |
isGenericReference(PsiJavaCodeReferenceElement referenceElement,
PsiJavaCodeReferenceElement qualifierElement) |
static boolean |
isTypeArgumentsApplicable(PsiTypeParameter[] typeParams,
PsiSubstitutor substitutor,
PsiElement context) |
static boolean |
isTypeArgumentsApplicable(PsiTypeParameter[] typeParams,
PsiSubstitutor substitutor,
PsiElement context,
boolean allowUncheckedConversion) |
static PsiSubstitutor |
substituteByParameterName(PsiClass psiClass,
PsiSubstitutor parentSubstitutor) |
public static PsiType getLeastUpperBound(PsiType type1, PsiType type2, PsiManager manager)
public static PsiClass [] getLeastUpperClasses(PsiClass aClass, PsiClass bClass)
public static boolean isTypeArgumentsApplicable(PsiTypeParameter[] typeParams, PsiSubstitutor substitutor, PsiElement context)
public static boolean isTypeArgumentsApplicable(PsiTypeParameter[] typeParams, PsiSubstitutor substitutor, PsiElement context, boolean allowUncheckedConversion)
public static Pair<PsiTypeParameter,PsiType> findTypeParameterWithBoundError(PsiTypeParameter[] typeParams, PsiSubstitutor substitutor, PsiElement context, boolean allowUncheckedConversion)
public static PsiType findTypeParameterBoundError(PsiTypeParameter typeParameter, PsiType[] extendsTypes, PsiSubstitutor substitutor, PsiElement context, boolean allowUncheckedConversion)
public static boolean isFromExternalTypeLanguage(PsiType type)
public static PsiType getVariableTypeByExpressionType(PsiType type, boolean openCaptured)
public static PsiSubstitutor substituteByParameterName(PsiClass psiClass, PsiSubstitutor parentSubstitutor)
public static PsiType eliminateWildcards(PsiType type, boolean eliminateInTypeArguments)
public static PsiType eliminateWildcards(PsiType type, boolean eliminateInTypeArguments, boolean eliminateCapturedWildcards)
public static boolean checkNotInBounds(PsiType type, PsiType bound, PsiReferenceParameterList referenceParameterList)
public static boolean checkNotInBounds(PsiType type, PsiType bound, boolean uncheckedConversionByDefault)
public static PsiClassType getExpectedGenericType(PsiElement context, PsiClass aClass, PsiClassType expectedType)
public static java.util.List<PsiType> getExpectedTypeArguments(PsiElement context, PsiClass aClass, java.lang.Iterable<? extends PsiTypeParameter> typeParams, PsiClassType expectedType)
context
- a context elementaClass
- a class which type parameters should be foundtypeParams
- type parameters to substitute (a subset of all type parameters of a class)expectedType
- an expected supertypepublic static boolean isGenericReference(PsiJavaCodeReferenceElement referenceElement, PsiJavaCodeReferenceElement qualifierElement)