Boolean ( ClassDescriptor descriptor, DiagnosticCollector collector ) { validateTypeParameters(collector, descriptor.getDeclaredTypeParameters()); Collection<KotlinType> supertypes = descriptor.getTypeConstructor().getSupertypes(); if (supertypes.isEmpty() && descriptor.getKind() != ClassKind.INTERFACE && !KotlinBuiltIns.isSpecialClassWithNoSupertypes(descriptor)) { report(collector, descriptor, "No supertypes for non-trait"); } validateTypes(descriptor, collector, supertypes); validateType(descriptor, descriptor.getDefaultType(), collector); validateScope(descriptor, descriptor.getUnsubstitutedInnerClassesScope(), collector); List<ConstructorDescriptor> primary = Lists.newArrayList(); for (ConstructorDescriptor constructorDescriptor : descriptor.getConstructors()) { if (constructorDescriptor.isPrimary()) { primary.add(constructorDescriptor); } } if (primary.size() > 1) { report(collector, descriptor, "Many primary constructors: " + primary); } ConstructorDescriptor primaryConstructor = descriptor.getUnsubstitutedPrimaryConstructor(); if (primaryConstructor != null) { if (!descriptor.getConstructors().contains(primaryConstructor)) { report(collector, primaryConstructor, "Primary constructor not in getConstructors() result: " + descriptor.getConstructors()); } } ClassDescriptor companionObjectDescriptor = descriptor.getCompanionObjectDescriptor(); if (companionObjectDescriptor != null && !companionObjectDescriptor.isCompanionObject()) { report(collector, companionObjectDescriptor, "Companion object should be marked as such"); } return true; }