Top Inners Fields Constructors Methods
kotlin.reflect.jvm.internal.impl.types

public Class TypeUtils

extends Object
Class Inheritance
Imports
kotlin.collections.CollectionsKt, kotlin.jvm.functions.Function1, org.jetbrains.annotations.NotNull, .Nullable, kotlin.reflect.jvm.internal.impl.builtins.KotlinBuiltIns, kotlin.reflect.jvm.internal.impl.builtins.StandardNames, kotlin.reflect.jvm.internal.impl.descriptors.ClassDescriptor, .ClassifierDescriptor, .DeclarationDescriptor, .TypeParameterDescriptor, kotlin.reflect.jvm.internal.impl.name.FqName, kotlin.reflect.jvm.internal.impl.name.FqNameUnsafe, kotlin.reflect.jvm.internal.impl.resolve.DescriptorUtils, kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerLiteralTypeConstructor, kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerValueTypeConstructor, kotlin.reflect.jvm.internal.impl.resolve.scopes.MemberScope, kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeChecker, kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner, kotlin.reflect.jvm.internal.impl.types.checker.NewTypeVariableConstructor, kotlin.reflect.jvm.internal.impl.types.error.ErrorTypeKind, kotlin.reflect.jvm.internal.impl.types.error.ErrorUtils, kotlin.reflect.jvm.internal.impl.utils.SmartSet, java.util.*

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final kotlin.reflect.jvm.internal.impl.types.SimpleType
public static final kotlin.reflect.jvm.internal.impl.types.SimpleType
public static final @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType
public static final kotlin.reflect.jvm.internal.impl.types.SimpleType

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if `null` can be assigned to storage of this type
acceptsNullable
(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

Differs from `isNullableType` only by treating type parameters: acceptsNullable(T) <=> T has nullable lower bound Semantics should be the same as `isSubtype(Nothing?, T)`

public static boolean
canHaveSubtypes(KotlinTypeChecker typeChecker, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

private static void
collectAllSupertypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull Set<kotlin.reflect.jvm.internal.impl.types.KotlinType> result)

public static boolean
contains(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type, final @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType specialType)

public static boolean
contains(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.UnwrappedType, Boolean> isSpecialType)

private static boolean
contains(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.UnwrappedType, Boolean> isSpecialType, kotlin.reflect.jvm.internal.impl.utils.SmartSet<kotlin.reflect.jvm.internal.impl.types.KotlinType> visited)

public static @Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType
createSubstitutedSupertype(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType subType, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType superType, @NotNull TypeSubstitutor substitutor)

public static boolean
dependsOnTypeConstructors(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull Collection<TypeConstructor> typeParameterConstructors)

public static boolean
dependsOnTypeParameters(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull Collection<TypeParameterDescriptor> typeParameters)

public static boolean
equalTypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType a, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType b)

private static @Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType
findByFqName(@NotNull Collection<kotlin.reflect.jvm.internal.impl.types.KotlinType> supertypes, kotlin.reflect.jvm.internal.impl.name.FqName fqName)

public static @NotNull Set<kotlin.reflect.jvm.internal.impl.types.KotlinType>
getAllSupertypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static @Nullable ClassDescriptor
getClassDescriptor(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
getDefaultPrimitiveNumberType(@NotNull kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerValueTypeConstructor numberValueTypeConstructor)

public static @Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType
getDefaultPrimitiveNumberType(@NotNull Collection<kotlin.reflect.jvm.internal.impl.types.KotlinType> supertypes)

public static @NotNull List<TypeProjection>
public static @NotNull List<kotlin.reflect.jvm.internal.impl.types.KotlinType>
getImmediateSupertypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
getPrimitiveNumberType(@NotNull kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerValueTypeConstructor numberValueTypeConstructor, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType expectedType)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
getPrimitiveNumberType(@NotNull kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerLiteralTypeConstructor literalTypeConstructor, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType expectedType)

public static @Nullable TypeParameterDescriptor
getTypeParameterDescriptorOrNull(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static boolean
hasNullableSuperType(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static boolean
isDontCarePlaceholder(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static boolean
isNonReifiedTypeParameter(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static boolean

Returns:

true if a value of this type can be null
isNullableType
(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

A work-around of the generic nullability problem in the type checker Semantics should be the same as `!isSubtype(T, Any)`

public static boolean
isReifiedTypeParameter(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static boolean
isTypeParameter(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

private static boolean
lowerThanBound(KotlinTypeChecker typeChecker, kotlin.reflect.jvm.internal.impl.types.KotlinType argument, TypeParameterDescriptor parameterDescriptor)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
makeNotNullable(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
makeNullable(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
makeNullableAsSpecified(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, boolean nullable)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType
makeNullableIfNeeded(@NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType type, boolean nullable)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
makeNullableIfNeeded(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, boolean nullable)

public static @NotNull TypeProjection
public static @NotNull TypeProjection
makeStarProjection(@NotNull TypeParameterDescriptor parameterDescriptor, kotlin.reflect.jvm.internal.impl.types.ErasureTypeAttributes attr)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType
makeUnsubstitutedType(ClassifierDescriptor classifierDescriptor, kotlin.reflect.jvm.internal.impl.resolve.scopes.MemberScope unsubstitutedMemberScope, kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner, kotlin.reflect.jvm.internal.impl.types.SimpleType> refinedTypeFactory)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType
makeUnsubstitutedType(@NotNull TypeConstructor typeConstructor, @NotNull kotlin.reflect.jvm.internal.impl.resolve.scopes.MemberScope unsubstitutedMemberScope, @NotNull kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner, kotlin.reflect.jvm.internal.impl.types.SimpleType> refinedTypeFactory)

public static boolean
noExpectedType(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
substituteParameters(@NotNull ClassDescriptor clazz, @NotNull List<kotlin.reflect.jvm.internal.impl.types.KotlinType> typeArguments)

public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CANNOT_INFER_FUNCTION_PARAM_TYPEback to summary
public static final kotlin.reflect.jvm.internal.impl.types.SimpleType CANNOT_INFER_FUNCTION_PARAM_TYPE
DONT_CAREback to summary
public static final kotlin.reflect.jvm.internal.impl.types.SimpleType DONT_CARE
NO_EXPECTED_TYPEback to summary
public static final @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType NO_EXPECTED_TYPE
Annotations
@NotNull
UNIT_EXPECTED_TYPEback to summary
public static final kotlin.reflect.jvm.internal.impl.types.SimpleType UNIT_EXPECTED_TYPE

Constructor Detail

TypeUtilsback to summary
public TypeUtils()

Method Detail

acceptsNullableback to summary
public static boolean acceptsNullable(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

Differs from `isNullableType` only by treating type parameters: acceptsNullable(T) <=> T has nullable lower bound Semantics should be the same as `isSubtype(Nothing?, T)`

Returns:boolean

true if `null` can be assigned to storage of this type

canHaveSubtypesback to summary
public static boolean canHaveSubtypes(KotlinTypeChecker typeChecker, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
collectAllSupertypesback to summary
private static void collectAllSupertypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull Set<kotlin.reflect.jvm.internal.impl.types.KotlinType> result)
containsback to summary
public static boolean contains(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type, final @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType specialType)
containsback to summary
public static boolean contains(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.UnwrappedType, Boolean> isSpecialType)
containsback to summary
private static boolean contains(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.UnwrappedType, Boolean> isSpecialType, kotlin.reflect.jvm.internal.impl.utils.SmartSet<kotlin.reflect.jvm.internal.impl.types.KotlinType> visited)
createSubstitutedSupertypeback to summary
public static @Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType createSubstitutedSupertype(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType subType, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType superType, @NotNull TypeSubstitutor substitutor)
Annotations
@Nullable
dependsOnTypeConstructorsback to summary
public static boolean dependsOnTypeConstructors(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull Collection<TypeConstructor> typeParameterConstructors)
dependsOnTypeParametersback to summary
public static boolean dependsOnTypeParameters(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, @NotNull Collection<TypeParameterDescriptor> typeParameters)
equalTypesback to summary
public static boolean equalTypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType a, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType b)
findByFqNameback to summary
private static @Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType findByFqName(@NotNull Collection<kotlin.reflect.jvm.internal.impl.types.KotlinType> supertypes, kotlin.reflect.jvm.internal.impl.name.FqName fqName)
Annotations
@Nullable
getAllSupertypesback to summary
public static @NotNull Set<kotlin.reflect.jvm.internal.impl.types.KotlinType> getAllSupertypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
Annotations
@NotNull
getClassDescriptorback to summary
public static @Nullable ClassDescriptor getClassDescriptor(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
Annotations
@Nullable
getDefaultPrimitiveNumberTypeback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType getDefaultPrimitiveNumberType(@NotNull kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerValueTypeConstructor numberValueTypeConstructor)
Annotations
@NotNull
getDefaultPrimitiveNumberTypeback to summary
public static @Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType getDefaultPrimitiveNumberType(@NotNull Collection<kotlin.reflect.jvm.internal.impl.types.KotlinType> supertypes)
Annotations
@Nullable
getDefaultTypeProjectionsback to summary
public static @NotNull List<TypeProjection> getDefaultTypeProjections(@NotNull List<TypeParameterDescriptor> parameters)
Annotations
@NotNull
getImmediateSupertypesback to summary
public static @NotNull List<kotlin.reflect.jvm.internal.impl.types.KotlinType> getImmediateSupertypes(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
Annotations
@NotNull
getPrimitiveNumberTypeback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType getPrimitiveNumberType(@NotNull kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerValueTypeConstructor numberValueTypeConstructor, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType expectedType)
Annotations
@NotNull
getPrimitiveNumberTypeback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType getPrimitiveNumberType(@NotNull kotlin.reflect.jvm.internal.impl.resolve.constants.IntegerLiteralTypeConstructor literalTypeConstructor, @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType expectedType)
Annotations
@NotNull
getTypeParameterDescriptorOrNullback to summary
public static @Nullable TypeParameterDescriptor getTypeParameterDescriptorOrNull(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
Annotations
@Nullable
hasNullableSuperTypeback to summary
public static boolean hasNullableSuperType(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
isDontCarePlaceholderback to summary
public static boolean isDontCarePlaceholder(@Nullable kotlin.reflect.jvm.internal.impl.types.KotlinType type)
isNonReifiedTypeParameterback to summary
public static boolean isNonReifiedTypeParameter(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
isNullableTypeback to summary
public static boolean isNullableType(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)

A work-around of the generic nullability problem in the type checker Semantics should be the same as `!isSubtype(T, Any)`

Returns:boolean

true if a value of this type can be null

isReifiedTypeParameterback to summary
public static boolean isReifiedTypeParameter(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
isTypeParameterback to summary
public static boolean isTypeParameter(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
lowerThanBoundback to summary
private static boolean lowerThanBound(KotlinTypeChecker typeChecker, kotlin.reflect.jvm.internal.impl.types.KotlinType argument, TypeParameterDescriptor parameterDescriptor)
makeNotNullableback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType makeNotNullable(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
Annotations
@NotNull
makeNullableback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType makeNullable(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
Annotations
@NotNull
makeNullableAsSpecifiedback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType makeNullableAsSpecified(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, boolean nullable)
Annotations
@NotNull
makeNullableIfNeededback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType makeNullableIfNeeded(@NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType type, boolean nullable)
Annotations
@NotNull
makeNullableIfNeededback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType makeNullableIfNeeded(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type, boolean nullable)
Annotations
@NotNull
makeStarProjectionback to summary
public static @NotNull TypeProjection makeStarProjection(@NotNull TypeParameterDescriptor parameterDescriptor)
Annotations
@NotNull
makeStarProjectionback to summary
public static @NotNull TypeProjection makeStarProjection(@NotNull TypeParameterDescriptor parameterDescriptor, kotlin.reflect.jvm.internal.impl.types.ErasureTypeAttributes attr)
Annotations
@NotNull
makeUnsubstitutedTypeback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType makeUnsubstitutedType(ClassifierDescriptor classifierDescriptor, kotlin.reflect.jvm.internal.impl.resolve.scopes.MemberScope unsubstitutedMemberScope, kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner, kotlin.reflect.jvm.internal.impl.types.SimpleType> refinedTypeFactory)
Annotations
@NotNull
makeUnsubstitutedTypeback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType makeUnsubstitutedType(@NotNull TypeConstructor typeConstructor, @NotNull kotlin.reflect.jvm.internal.impl.resolve.scopes.MemberScope unsubstitutedMemberScope, @NotNull kotlin.jvm.functions.Function1<kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner, kotlin.reflect.jvm.internal.impl.types.SimpleType> refinedTypeFactory)
Annotations
@NotNull
noExpectedTypeback to summary
public static boolean noExpectedType(@NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType type)
substituteParametersback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType substituteParameters(@NotNull ClassDescriptor clazz, @NotNull List<kotlin.reflect.jvm.internal.impl.types.KotlinType> typeArguments)
Annotations
@NotNull
substituteProjectionsForParametersback to summary
public static @NotNull kotlin.reflect.jvm.internal.impl.types.KotlinType substituteProjectionsForParameters(@NotNull ClassDescriptor clazz, @NotNull List<TypeProjection> projections)
Annotations
@NotNull
kotlin.reflect.jvm.internal.impl.types back to summary

public Class TypeUtils.SpecialType

extends kotlin.reflect.jvm.internal.impl.types.DelegatingSimpleType
Class Inheritance
  • java.lang.Object
  • ⋱
  • kotlin.reflect.jvm.internal.impl.types.DelegatingSimpleType
  • kotlin.reflect.jvm.internal.impl.types.TypeUtils.SpecialType

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType
public @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType
makeNullableAsSpecified(boolean newNullability)

public @NotNull TypeUtils.SpecialType
refine(@NotNull kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner kotlinTypeRefiner)

public @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType
replaceAttributes(@NotNull kotlin.reflect.jvm.internal.impl.types.TypeAttributes newAttributes)

public @NotNull kotlin.reflect.jvm.internal.impl.types.DelegatingSimpleType
replaceDelegate(@NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType delegate)

public @NotNull String

Field Detail

nameback to summary
private final String name

Constructor Detail

SpecialTypeback to summary
public SpecialType(String name)

Method Detail

getDelegateback to summary
protected @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType getDelegate()
Annotations
@NotNull
@Override
makeNullableAsSpecifiedback to summary
public @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType makeNullableAsSpecified(boolean newNullability)
Annotations
@NotNull
@Override
refineback to summary
public @NotNull TypeUtils.SpecialType refine(@NotNull kotlin.reflect.jvm.internal.impl.types.checker.KotlinTypeRefiner kotlinTypeRefiner)
Annotations
@NotNull
@Override
@TypeRefinement
replaceAttributesback to summary
public @NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType replaceAttributes(@NotNull kotlin.reflect.jvm.internal.impl.types.TypeAttributes newAttributes)
Annotations
@NotNull
@Override
replaceDelegateback to summary
public @NotNull kotlin.reflect.jvm.internal.impl.types.DelegatingSimpleType replaceDelegate(@NotNull kotlin.reflect.jvm.internal.impl.types.SimpleType delegate)
Annotations
@NotNull
@Override
@TypeRefinement
toStringback to summary
public @NotNull String toString()
Annotations
@NotNull
@Override