Example #1
0
 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));
 }
Example #2
0
 @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;
 }