예제 #1
0
 public static boolean isDeprecated(@NotNull JetModifierListOwner owner) {
   JetModifierList modifierList = owner.getModifierList();
   if (modifierList != null) {
     List<JetAnnotationEntry> annotationEntries = modifierList.getAnnotationEntries();
     for (JetAnnotationEntry annotation : annotationEntries) {
       Name shortName = getShortName(annotation);
       if (KotlinBuiltIns.getInstance().getDeprecatedAnnotation().getName().equals(shortName)) {
         return true;
       }
     }
   }
   return false;
 }
예제 #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);
  }