use of org.jetbrains.kotlin.name.FqNameUnsafe in project kotlin by JetBrains.
the class AnnotationsUtils method isFromNonModuleFile.
public static boolean isFromNonModuleFile(@NotNull BindingContext bindingContext, @NotNull DeclarationDescriptor declaration) {
for (AnnotationDescriptor annotation : getContainingFileAnnotations(bindingContext, declaration)) {
DeclarationDescriptor annotationType = annotation.getType().getConstructor().getDeclarationDescriptor();
if (annotationType == null)
continue;
DeclarationDescriptor annotationTypeDescriptor = annotation.getType().getConstructor().getDeclarationDescriptor();
assert annotationTypeDescriptor != null : "Annotation type should have descriptor: " + annotation.getType();
FqNameUnsafe fqName = DescriptorUtils.getFqName(annotationTypeDescriptor);
if (fqName.equals(JS_NON_MODULE_ANNOTATION.toUnsafe())) {
return true;
}
}
return false;
}
use of org.jetbrains.kotlin.name.FqNameUnsafe in project kotlin by JetBrains.
the class AnnotationsUtils method getSingleStringAnnotationArgument.
@Nullable
private static String getSingleStringAnnotationArgument(@NotNull BindingContext bindingContext, @NotNull DeclarationDescriptor declaration, @NotNull FqName annotationFqName) {
for (AnnotationDescriptor annotation : getContainingFileAnnotations(bindingContext, declaration)) {
DeclarationDescriptor annotationType = annotation.getType().getConstructor().getDeclarationDescriptor();
if (annotationType == null)
continue;
FqNameUnsafe fqName = DescriptorUtils.getFqName(annotation.getType().getConstructor().getDeclarationDescriptor());
if (fqName.equals(annotationFqName.toUnsafe())) {
return extractSingleStringArgument(annotation);
}
}
return null;
}
Aggregations