private static boolean isConstructedFromGivenClass( @NotNull KotlinType type, @NotNull FqNameUnsafe fqName) { ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor(); return descriptor != null && /* quick check to avoid creation of full FqName instance */ descriptor .getName() .equals(fqName.shortName()) && fqName.equals(getFqName(descriptor)); }
/** * @return true if this is an FQ name of a fictitious class representing the function type, e.g. * kotlin.Function1 (but NOT kotlin.reflect.KFunction1) */ public static boolean isNumberedFunctionClassFqName(@NotNull FqNameUnsafe fqName) { List<Name> segments = fqName.pathSegments(); if (segments.size() != 2) return false; if (!BUILT_INS_PACKAGE_NAME.equals(first(segments))) return false; String shortName = last(segments).asString(); return BuiltInFictitiousFunctionClassFactory.parseClassName( shortName, BUILT_INS_PACKAGE_FQ_NAME) != null; }
private static boolean isConstructedFromGivenClass( @NotNull JetType type, @NotNull FqNameUnsafe fqName) { ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor(); return descriptor != null && fqName.equals(DescriptorUtils.getFqName(descriptor)); }