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)); }
@NotNull public ClassDescriptor getAnnotationClassByName(@NotNull Name simpleName) { ClassifierDescriptor classifier = annotationPackageFragment .getMemberScope() .getContributedClassifier(simpleName, NoLookupLocation.FROM_BUILTINS); assert classifier instanceof ClassDescriptor : "Must be a class descriptor " + simpleName + ", but was " + (classifier == null ? "null" : classifier.toString()); return (ClassDescriptor) classifier; }