Пример #1
0
 @Nullable
 public static Name getShortName(@NotNull JetAnnotationEntry annotation) {
   JetTypeReference typeReference = annotation.getTypeReference();
   assert typeReference != null : "Annotation entry hasn't typeReference " + annotation.getText();
   JetTypeElement typeElement = typeReference.getTypeElement();
   if (typeElement instanceof JetUserType) {
     JetUserType userType = (JetUserType) typeElement;
     String shortName = userType.getReferencedName();
     if (shortName != null) {
       return Name.identifier(shortName);
     }
   }
   return null;
 }
Пример #2
0
  private void checkModifiersAndAnnotationsInPackageDirective(JetFile file) {
    JetPackageDirective packageDirective = file.getPackageDirective();
    if (packageDirective == null) return;

    JetModifierList modifierList = packageDirective.getModifierList();
    if (modifierList == null) return;

    for (JetAnnotationEntry annotationEntry : modifierList.getAnnotationEntries()) {
      JetConstructorCalleeExpression calleeExpression = annotationEntry.getCalleeExpression();
      if (calleeExpression != null) {
        JetReferenceExpression reference = calleeExpression.getConstructorReferenceExpression();
        if (reference != null) {
          trace.report(UNRESOLVED_REFERENCE.on(reference, reference));
        }
      }
    }
    AnnotationTargetChecker.INSTANCE$.check(packageDirective, trace);

    ModifiersChecker.reportIllegalModifiers(
        modifierList, Arrays.asList(JetTokens.MODIFIER_KEYWORDS_ARRAY), trace);
  }