Пример #1
0
 private void checkEnumModifiers(JetClass aClass) {
   if (aClass.hasModifier(JetTokens.OPEN_KEYWORD)) {
     trace.report(OPEN_MODIFIER_IN_ENUM.on(aClass));
   }
   if (aClass.hasModifier(JetTokens.ABSTRACT_KEYWORD)) {
     trace.report(ABSTRACT_MODIFIER_IN_ENUM.on(aClass));
   }
   if (aClass.hasModifier(JetTokens.SEALED_KEYWORD)) {
     trace.report(SEALED_MODIFIER_IN_ENUM.on(aClass));
   }
 }
Пример #2
0
 private void checkSealedModifiers(JetClass aClass) {
   if (aClass.hasModifier(JetTokens.OPEN_KEYWORD)) {
     trace.report(OPEN_MODIFIER_IN_SEALED.on(aClass));
   }
   if (aClass.hasModifier(JetTokens.FINAL_KEYWORD)) {
     trace.report(FINAL_MODIFIER_IN_SEALED.on(aClass));
   }
   if (aClass.hasModifier(JetTokens.ABSTRACT_KEYWORD)) {
     trace.report(ABSTRACT_MODIFIER_IN_SEALED.on(aClass));
   }
 }
Пример #3
0
  private void checkClass(
      BodiesResolveContext c,
      JetClass aClass,
      ClassDescriptorWithResolutionScopes classDescriptor) {
    checkOpenMembers(classDescriptor);
    checkTypeParameters(aClass);

    if (aClass.isInterface()) {
      ASTNode traitKeyword = aClass.getNode().findChildByType(JetTokens.TRAIT_KEYWORD);
      if (traitKeyword != null) {
        trace.report(Errors.DEPRECATED_TRAIT_KEYWORD.on(traitKeyword.getPsi()));
      }

      checkTraitModifiers(aClass);
      checkConstructorInTrait(aClass);
    } else if (aClass.isAnnotation()) {
      checkAnnotationClassWithBody(aClass);
      checkValOnAnnotationParameter(aClass);
    } else if (aClass.isEnum()) {
      checkEnumModifiers(aClass);
      if (aClass.isLocal()) {
        trace.report(LOCAL_ENUM_NOT_ALLOWED.on(aClass, classDescriptor));
      }
    } else if (aClass.hasModifier(JetTokens.SEALED_KEYWORD)) {
      checkSealedModifiers(aClass);
    } else if (aClass instanceof JetEnumEntry) {
      checkEnumEntry((JetEnumEntry) aClass, classDescriptor);
    }
  }