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); } }
@NotNull private static ClassKind getClassKind(@NotNull JetClass jetClass) { if (jetClass.isTrait()) return ClassKind.TRAIT; if (jetClass.isAnnotation()) return ClassKind.ANNOTATION_CLASS; if (jetClass.isEnum()) return ClassKind.ENUM_CLASS; return ClassKind.CLASS; }
private void checkNestedClassAllowed( @NotNull JetModifierListOwner modifierListOwner, @NotNull DeclarationDescriptor descriptor) { if (modifierListOwner.hasModifier(INNER_KEYWORD)) return; if (modifierListOwner instanceof JetClass && !(modifierListOwner instanceof JetEnumEntry)) { JetClass aClass = (JetClass) modifierListOwner; boolean localEnumError = aClass.isLocal() && aClass.isEnum(); if (!localEnumError && isIllegalNestedClass(descriptor)) { trace.report(NESTED_CLASS_NOT_ALLOWED.on(aClass)); } } }