All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlin.diagnostics.Errors Maven / Gradle / Ivy

There is a newer version: 2.1.0-Beta1
Show newest version
/*
 * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
 * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
 */

package org.jetbrains.kotlin.diagnostics;

import com.google.common.collect.ImmutableSet;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.LeafPsiElement;
import kotlin.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.config.LanguageVersion;
import org.jetbrains.kotlin.config.LanguageVersionSettings;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.diagnostics.rendering.DeclarationWithDiagnosticComponents;
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages;
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticFactoryToRendererMap;
import org.jetbrains.kotlin.diagnostics.rendering.DiagnosticRenderer;
import org.jetbrains.kotlin.lexer.KtKeywordToken;
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken;
import org.jetbrains.kotlin.lexer.KtTokens;
import org.jetbrains.kotlin.metadata.deserialization.VersionRequirement;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.psi.*;
import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData;
import org.jetbrains.kotlin.resolve.calls.inference.InferenceErrorData;
import org.jetbrains.kotlin.resolve.calls.inference.model.TypeVariableTypeConstructor;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.tower.WrongResolutionToClassifier;
import org.jetbrains.kotlin.resolve.calls.util.BuilderLambdaLabelingInfo;
import org.jetbrains.kotlin.resolve.deprecation.DescriptorBasedDeprecationInfo;
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible;
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData;
import org.jetbrains.kotlin.types.KotlinType;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.jetbrains.kotlin.config.LanguageFeature.ReportTypeVarianceConflictOnQualifierArguments;
import static org.jetbrains.kotlin.diagnostics.ClassicPositioningStrategies.ACTUAL_DECLARATION_NAME;
import static org.jetbrains.kotlin.diagnostics.ClassicPositioningStrategies.INCOMPATIBLE_DECLARATION;
import static org.jetbrains.kotlin.diagnostics.PositioningStrategies.*;
import static org.jetbrains.kotlin.diagnostics.Severity.*;

/**
 * For error messages, see DefaultErrorMessages and IdeErrorMessages.
 */
public interface Errors {

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Meta-errors: unsupported features, failure

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    DiagnosticFactory1 UNSUPPORTED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 UNSUPPORTED_WARNING = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory1 NEW_INFERENCE_ERROR = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 NEW_INFERENCE_DIAGNOSTIC = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 NON_APPLICABLE_CALL_FOR_BUILDER_INFERENCE = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory1> UNSUPPORTED_FEATURE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 EXCEPTION_FROM_ANALYZER = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 MISSING_STDLIB = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1> EXPERIMENTAL_FEATURE_WARNING =
            DiagnosticFactory1.create(WARNING);
    DiagnosticFactory1> EXPERIMENTAL_FEATURE_ERROR =
            DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 EXPLICIT_BACKING_FIELDS_UNSUPPORTED = DiagnosticFactory0.create(ERROR);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Generic errors/warnings: applicable in many contexts

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    DiagnosticFactory1> REDECLARATION =
            DiagnosticFactory1.create(ERROR, FOR_REDECLARATION);
    DiagnosticFactory1 PACKAGE_OR_CLASSIFIER_REDECLARATION =
            DiagnosticFactory1.create(ERROR, FOR_REDECLARATION);
    DiagnosticFactory0 DUPLICATE_PARAMETER_NAME_IN_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR, DECLARATION_NAME);

    DiagnosticFactory1 EXTENSION_SHADOWED_BY_MEMBER =
            DiagnosticFactory1.create(WARNING, FOR_REDECLARATION);
    DiagnosticFactory1 EXTENSION_FUNCTION_SHADOWED_BY_INNER_CLASS_CONSTRUCTOR =
            DiagnosticFactory1.create(WARNING, FOR_REDECLARATION);
    DiagnosticFactory2 EXTENSION_FUNCTION_SHADOWED_BY_MEMBER_PROPERTY_WITH_INVOKE =
            DiagnosticFactory2.create(WARNING, FOR_REDECLARATION);

    DiagnosticFactory1 UNRESOLVED_REFERENCE =
            DiagnosticFactory1.create(ERROR, FOR_UNRESOLVED_REFERENCE);

    DiagnosticFactory2 DEPRECATION = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 DEPRECATION_ERROR = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory3 TYPEALIAS_EXPANSION_DEPRECATION =
            DiagnosticFactory3.create(WARNING);
    DiagnosticFactory3 TYPEALIAS_EXPANSION_DEPRECATION_ERROR =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3>
            VERSION_REQUIREMENT_DEPRECATION = DiagnosticFactory3.create(WARNING);
    DiagnosticFactory3>
            VERSION_REQUIREMENT_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR);
    // descriptor and deprecation infos are needed only for IDE quickfix for this warning
    DiagnosticFactory3> OVERRIDE_DEPRECATION =
            DiagnosticFactory3.create(WARNING, DECLARATION_NAME);

    DiagnosticFactory0 DEPRECATED_SINCE_KOTLIN_WITHOUT_DEPRECATED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DEPRECATED_SINCE_KOTLIN_WITH_UNORDERED_VERSIONS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DEPRECATED_SINCE_KOTLIN_WITHOUT_ARGUMENTS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DEPRECATED_SINCE_KOTLIN_OUTSIDE_KOTLIN_SUBPACKAGE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory2 API_NOT_AVAILABLE = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory1 MISSING_DEPENDENCY_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 MISSING_DEPENDENCY_SUPERCLASS = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1 MISSING_BUILT_IN_DECLARATION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 MISSING_SCRIPT_BASE_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 MISSING_SCRIPT_STANDARD_TEMPLATE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 MISSING_SCRIPT_RECEIVER_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 MISSING_IMPORTED_SCRIPT_FILE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 MISSING_IMPORTED_SCRIPT_PSI = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 MISSING_SCRIPT_PROVIDED_PROPERTY_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 PRE_RELEASE_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 IR_WITH_UNSTABLE_ABI_COMPILED_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 FIR_COMPILED_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2> INCOMPATIBLE_CLASS = DiagnosticFactory2.create(ERROR);

    //Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error
    //"INVISIBLE_REFERENCE" is used for invisible classes references and references in import
    DiagnosticFactory3 INVISIBLE_REFERENCE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 INVISIBLE_MEMBER =
            DiagnosticFactory3.create(ERROR, CALL_ELEMENT);
    DiagnosticFactory1 DEPRECATED_ACCESS_BY_SHORT_NAME = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory1 DEPRECATED_ACCESS_TO_ENUM_COMPANION_PROPERTY = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory2 DEPRECATED_RESOLVE_WITH_AMBIGUOUS_ENUM_ENTRY = DiagnosticFactory2.create(WARNING);

    DiagnosticFactory1 PROTECTED_CONSTRUCTOR_NOT_IN_SUPER_CALL = DiagnosticFactory1.create(ERROR);

    // Exposed visibility group
    DiagnosticFactory3 EXPOSED_PROPERTY_TYPE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactoryForDeprecation3
            EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR =
            DiagnosticFactoryForDeprecation3.create(LanguageFeature.ForbidExposingTypesInPrimaryConstructorProperties);
    DiagnosticFactory3 EXPOSED_FUNCTION_RETURN_TYPE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EXPOSED_PARAMETER_TYPE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EXPOSED_RECEIVER_TYPE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EXPOSED_TYPE_PARAMETER_BOUND =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EXPOSED_SUPER_CLASS =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EXPOSED_SUPER_INTERFACE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EXPOSED_TYPEALIAS_EXPANDED_TYPE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EXPOSED_FROM_PRIVATE_IN_FILE =
            DiagnosticFactory3.create(WARNING);

    DiagnosticFactory2> INACCESSIBLE_TYPE = DiagnosticFactory2.create(WARNING);

    DiagnosticFactory1> PLATFORM_CLASS_MAPPED_TO_KOTLIN = DiagnosticFactory1.create(WARNING);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Errors/warnings in types
    // Note: class/interface declaration is NOT a type. A type is something that may be written on the right-hand side of ":"

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    DiagnosticFactory0 PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT = DiagnosticFactory0.create(ERROR, VARIANCE_IN_PROJECTION);
    DiagnosticFactory2 UPPER_BOUND_VIOLATED = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 UPPER_BOUND_VIOLATED_WARNING = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory0 REDUNDANT_NULLABLE = DiagnosticFactory0.create(WARNING, NULLABLE_TYPE);
    DiagnosticFactory0 NULLABLE_ON_DEFINITELY_NOT_NULLABLE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INCORRECT_LEFT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INCORRECT_RIGHT_COMPONENT_OF_INTERSECTION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory2 WRONG_NUMBER_OF_TYPE_ARGUMENTS = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1 OUTER_CLASS_ARGUMENTS_REQUIRED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 TYPE_ARGUMENTS_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 NO_TYPE_ARGUMENTS_ON_RHS = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1 CONFLICTING_PROJECTION =
            DiagnosticFactory1.create(ERROR, VARIANCE_IN_PROJECTION);
    DiagnosticFactory1 REDUNDANT_PROJECTION =
            DiagnosticFactory1.create(WARNING, VARIANCE_IN_PROJECTION);
    DiagnosticFactoryForDeprecation1 TYPE_VARIANCE_CONFLICT =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.ReportTypeVarianceConflictOnQualifierArguments, DECLARATION_SIGNATURE_OR_DEFAULT);
    DiagnosticFactory1 TYPE_VARIANCE_CONFLICT_IN_EXPANDED_TYPE =
            DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
    DiagnosticFactory0 FINITE_BOUNDS_VIOLATION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 FINITE_BOUNDS_VIOLATION_IN_JAVA = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 EXPANSIVE_INHERITANCE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 EXPANSIVE_INHERITANCE_IN_JAVA = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory0 TYPE_ARGUMENTS_FOR_OUTER_CLASS_WHEN_NESTED_REFERENCED = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 REIFIED_TYPE_IN_CATCH_CLAUSE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 TYPE_PARAMETER_IN_CATCH_CLAUSE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 GENERIC_THROWABLE_SUBCLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INNER_CLASS_OF_GENERIC_THROWABLE_SUBCLASS =
            DiagnosticFactory0.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory0 INNER_CLASS_OF_GENERIC_THROWABLE_SUBCLASS_WARNING =
            DiagnosticFactory0.create(WARNING, DECLARATION_NAME);

    DiagnosticFactory0 TOPLEVEL_TYPEALIASES_ONLY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 RECURSIVE_TYPEALIAS_EXPANSION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory3 UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 UPPER_BOUND_VIOLATED_IN_TYPEALIAS_EXPANSION_WARNING =
            DiagnosticFactory3.create(WARNING);
    DiagnosticFactory1 CONFLICTING_PROJECTION_IN_TYPEALIAS_EXPANSION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 TYPEALIAS_SHOULD_EXPAND_TO_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 TYPEALIAS_EXPANDED_TO_MALFORMED_TYPE = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1 EXPANDED_TYPE_CANNOT_BE_CONSTRUCTED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 EXPANDED_TYPE_CANNOT_BE_INHERITED = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 DEPRECATED_SYNTAX_WITH_DEFINITELY_NOT_NULL = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 MODIFIER_LIST_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);

    DiagnosticFactoryForDeprecation1 PROGRESSIONS_CHANGING_RESOLVE = DiagnosticFactoryForDeprecation1.create(LanguageFeature.ProgressionsChangingResolve);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Errors in declarations

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Imports

    DiagnosticFactory1 CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 CANNOT_BE_IMPORTED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 PACKAGE_CANNOT_BE_IMPORTED = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1 CONFLICTING_IMPORT = DiagnosticFactory1.create(ERROR, PositioningStrategies.IMPORT_ALIAS);

    DiagnosticFactory0 OPERATOR_RENAMED_ON_IMPORT = DiagnosticFactory0.create(ERROR);

    // Modifiers

    DiagnosticFactory2 INCOMPATIBLE_MODIFIERS =
            DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 DEPRECATED_MODIFIER_PAIR =
            DiagnosticFactory2.create(WARNING);
    DiagnosticFactory1 REPEATED_MODIFIER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 REDUNDANT_MODIFIER = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 WRONG_MODIFIER_TARGET = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 DEPRECATED_MODIFIER_FOR_TARGET = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 DEPRECATED_MODIFIER = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 REDUNDANT_MODIFIER_FOR_TARGET = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory0 NO_EXPLICIT_VISIBILITY_IN_API_MODE = DiagnosticFactory0.create(ERROR, DECLARATION_START_TO_NAME);
    DiagnosticFactory0 NO_EXPLICIT_RETURN_TYPE_IN_API_MODE = DiagnosticFactory0.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory0 NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING = DiagnosticFactory0.create(WARNING,
                                                                                                             DECLARATION_START_TO_NAME);
    DiagnosticFactory0 NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING =
            DiagnosticFactory0.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory2 WRONG_MODIFIER_CONTAINING_DECLARATION = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 DEPRECATED_MODIFIER_CONTAINING_DECLARATION =
            DiagnosticFactory2.create(WARNING);
    DiagnosticFactory1 ILLEGAL_INLINE_PARAMETER_MODIFIER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 INLINE_SUSPEND_FUNCTION_TYPE_UNSUPPORTED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory1 WRONG_ANNOTATION_TARGET = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1 WRONG_ANNOTATION_TARGET_WITH_USE_SITE_TARGET_ON_TYPE = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 REPEATED_ANNOTATION_WARNING = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 NON_SOURCE_ANNOTATION_ON_INLINED_LAMBDA_EXPRESSION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 WRONG_EXTENSION_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 WRONG_EXTENSION_FUNCTION_TYPE_WARNING = DiagnosticFactory0.create(WARNING);

    // Annotations

    DiagnosticFactory0 SUPERTYPES_FOR_ANNOTATION_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactoryForDeprecation0 ANNOTATION_ON_SUPERCLASS =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitUseSiteTargetAnnotationsOnSuperTypes);
    DiagnosticFactory0 MISSING_VAL_ON_ANNOTATION_PARAMETER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 VAR_ANNOTATION_PARAMETER = DiagnosticFactory0.create(ERROR, VAL_OR_VAR_NODE);
    DiagnosticFactory0 ANNOTATION_CLASS_CONSTRUCTOR_CALL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 NOT_AN_ANNOTATION_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 ANNOTATION_CLASS_MEMBER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INVALID_TYPE_OF_ANNOTATION_MEMBER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NULLABLE_TYPE_OF_ANNOTATION_MEMBER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ANNOTATION_ARGUMENT_MUST_BE_CONST = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ANNOTATION_ARGUMENT_MUST_BE_KCLASS_LITERAL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ANNOTATION_ARGUMENT_MUST_BE_ENUM_CONST = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 ANNOTATION_ARGUMENT_KCLASS_LITERAL_OF_TYPE_PARAMETER_ERROR = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ANNOTATION_PARAMETER_DEFAULT_VALUE_MUST_BE_CONSTANT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ANNOTATIONS_ON_BLOCK_LEVEL_EXPRESSION_ON_THE_SAME_LINE = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 ANNOTATION_USED_AS_ANNOTATION_ARGUMENT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ANNOTATION_ARGUMENT_IS_NON_CONST = DiagnosticFactory0.create(WARNING);
    DiagnosticFactoryForDeprecation0 CYCLE_IN_ANNOTATION_PARAMETER = DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitCyclesInAnnotations);

    DiagnosticFactoryForDeprecation0 RESTRICTED_RETENTION_FOR_EXPRESSION_ANNOTATION =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.RestrictRetentionForExpressionAnnotations);

    DiagnosticFactoryForDeprecation0 LOCAL_ANNOTATION_CLASS =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitLocalAnnotations);

    DiagnosticFactory1 ILLEGAL_KOTLIN_VERSION_STRING_VALUE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 NEWER_VERSION_IN_SINCE_KOTLIN = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory2 OPT_IN_USAGE = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 OPT_IN_USAGE_ERROR = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 OPT_IN_USAGE_FUTURE_ERROR = DiagnosticFactory2.create(WARNING);

    DiagnosticFactory2 OPT_IN_OVERRIDE = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 OPT_IN_OVERRIDE_ERROR = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory0 OPT_IN_IS_NOT_ENABLED = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 OPT_IN_CAN_ONLY_BE_USED_AS_ANNOTATION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0
            OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 OPT_IN_WITHOUT_ARGUMENTS = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory1 OPT_IN_ARGUMENT_IS_NOT_MARKER = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory1 OPT_IN_MARKER_WITH_WRONG_TARGET = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 OPT_IN_MARKER_WITH_WRONG_RETENTION = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1 OPT_IN_MARKER_ON_WRONG_TARGET = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 OPT_IN_MARKER_ON_OVERRIDE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 OPT_IN_MARKER_ON_OVERRIDE_WARNING = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory1 EXPERIMENTAL_UNSIGNED_LITERALS = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory1 EXPERIMENTAL_UNSIGNED_LITERALS_ERROR = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 NON_PARENTHESIZED_ANNOTATIONS_ON_FUNCTIONAL_TYPES = DiagnosticFactory0.create(ERROR);

    // Const
    DiagnosticFactory0 CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 CONST_VAL_WITH_GETTER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 CONST_VAL_WITH_DELEGATE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 TYPE_CANT_BE_USED_FOR_CONST_VAL = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 CONST_VAL_WITHOUT_INITIALIZER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 CONST_VAL_WITH_NON_CONST_INITIALIZER = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1 INAPPLICABLE_TARGET_ON_PROPERTY = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 INAPPLICABLE_TARGET_PROPERTY_IMMUTABLE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 INAPPLICABLE_TARGET_PROPERTY_HAS_NO_DELEGATE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INAPPLICABLE_TARGET_PROPERTY_HAS_NO_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INAPPLICABLE_PARAM_TARGET = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 REDUNDANT_ANNOTATION_TARGET = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 INAPPLICABLE_FILE_TARGET = DiagnosticFactory0.create(ERROR);

    // Classes and interfaces

    DiagnosticFactory0 PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE =
            DiagnosticFactory0.create(ERROR, VARIANCE_IN_PROJECTION);

    DiagnosticFactory0 CYCLIC_INHERITANCE_HIERARCHY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 CYCLIC_SCOPES_WITH_COMPANION = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 SUPERTYPE_NOT_INITIALIZED = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 DELEGATION_NOT_TO_INTERFACE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory2>
            DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE =
            DiagnosticFactory2.create(WARNING, DECLARATION_NAME);

    DiagnosticFactory0 SUPERTYPE_NOT_A_CLASS_OR_INTERFACE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SUPERTYPE_IS_SUSPEND_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SUPERTYPE_IS_KSUSPEND_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 MIXING_SUSPEND_AND_NON_SUSPEND_SUPERTYPES = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 MANY_CLASSES_IN_SUPERTYPE_LIST = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SUPERTYPE_APPEARS_TWICE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory3>
            INCONSISTENT_TYPE_PARAMETER_VALUES = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3>
            INCONSISTENT_TYPE_PARAMETER_BOUNDS = DiagnosticFactory3.create(ERROR);


    DiagnosticFactory0 FINAL_SUPERTYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DATA_CLASS_CANNOT_HAVE_CLASS_SUPERTYPES = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SINGLETON_IN_SUPERTYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NULLABLE_SUPERTYPE = DiagnosticFactory0.create(ERROR, NULLABLE_TYPE);
    DiagnosticFactory0 DYNAMIC_SUPERTYPE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1 CLASS_CANNOT_BE_EXTENDED_DIRECTLY = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 MISSING_CONSTRUCTOR_KEYWORD = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 MISSING_CONSTRUCTOR_BRACKETS = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 NON_PRIVATE_CONSTRUCTOR_IN_ENUM = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NON_PRIVATE_CONSTRUCTOR_IN_SEALED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED = DiagnosticFactory0.create(ERROR);

    // Inline classes, Value classes

    DiagnosticFactory0 VALUE_CLASS_NOT_TOP_LEVEL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 VALUE_CLASS_NOT_FINAL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 VALUE_CLASS_EMPTY_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 DELEGATED_PROPERTY_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 VALUE_CLASS_CANNOT_EXTEND_CLASSES = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 VALUE_CLASS_CANNOT_BE_RECURSIVE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 RESERVED_MEMBER_INSIDE_VALUE_CLASS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INNER_CLASS_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 VALUE_CLASS_CANNOT_BE_CLONEABLE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INLINE_CLASS_DEPRECATED = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 INLINE_CLASS_CANNOT_HAVE_CONTEXT_RECEIVERS = DiagnosticFactory0.create(ERROR);

    // Result class

    DiagnosticFactory0 RESULT_CLASS_IN_RETURN_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 RESULT_CLASS_WITH_NULLABLE_OPERATOR = DiagnosticFactory1.create(ERROR);

    // Fun interfaces

    DiagnosticFactory0 FUN_INTERFACE_WRONG_COUNT_OF_ABSTRACT_MEMBERS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 FUN_INTERFACE_CANNOT_HAVE_ABSTRACT_PROPERTIES = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 FUN_INTERFACE_ABSTRACT_METHOD_WITH_TYPE_PARAMETERS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 FUN_INTERFACE_ABSTRACT_METHOD_WITH_DEFAULT_VALUE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 FUN_INTERFACE_CONSTRUCTOR_REFERENCE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 FUN_INTERFACE_WITH_SUSPEND_FUNCTION = DiagnosticFactory0.create(ERROR);

    // Secondary constructors

    DiagnosticFactory0 CYCLIC_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 CONSTRUCTOR_IN_OBJECT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED =
            DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);

    DiagnosticFactory0 PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED_IN_ENUM =
            DiagnosticFactory0.create(WARNING, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);

    DiagnosticFactory0 DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR =
            DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EXPLICIT_DELEGATION_CALL_REQUIRED =
            DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);

    DiagnosticFactory1 INSTANCE_ACCESS_BEFORE_SUPER_CALL = DiagnosticFactory1.create(ERROR);

    // Interface-specific

    DiagnosticFactory0 REDUNDANT_OPEN_IN_INTERFACE = DiagnosticFactory0.create(WARNING, OPEN_MODIFIER);

    DiagnosticFactory0 CONSTRUCTOR_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 SUPERTYPE_INITIALIZED_IN_INTERFACE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 DELEGATION_IN_INTERFACE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 INTERFACE_WITH_SUPERCLASS = DiagnosticFactory0.create(ERROR);

    // Enum-specific

    DiagnosticFactory0 CLASS_IN_SUPERTYPE_FOR_ENUM = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 TYPE_PARAMETERS_IN_ENUM = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ENUM_ENTRY_SHOULD_BE_INITIALIZED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ENUM_CLASS_CONSTRUCTOR_CALL = DiagnosticFactory0.create(ERROR);

    // Sealed-specific
    DiagnosticFactory0 SEALED_CLASS_CONSTRUCTOR_CALL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SEALED_SUPERTYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory2 SEALED_SUPERTYPE_IN_LOCAL_CLASS = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 SEALED_INHERITOR_IN_DIFFERENT_PACKAGE = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory0 SEALED_INHERITOR_IN_DIFFERENT_MODULE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 CLASS_INHERITS_JAVA_SEALED_CLASS = DiagnosticFactory0.create(ERROR);

    // Companion objects

    DiagnosticFactory0 MANY_COMPANION_OBJECTS = DiagnosticFactory0.create(ERROR, COMPANION_OBJECT);
    DiagnosticFactoryForDeprecation0 SELF_CALL_IN_NESTED_OBJECT_CONSTRUCTOR =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitSelfCallsInNestedObjects);

    // Objects

    DiagnosticFactory1 LOCAL_OBJECT_NOT_ALLOWED = DiagnosticFactory1.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory1 LOCAL_INTERFACE_NOT_ALLOWED = DiagnosticFactory1.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory0 TYPE_PARAMETERS_IN_OBJECT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 TYPE_PARAMETERS_IN_ANONYMOUS_OBJECT = DiagnosticFactory0.create(WARNING);

    // Type parameter declarations

    DiagnosticFactory1 FINAL_UPPER_BOUND = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 DYNAMIC_UPPER_BOUND = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 UPPER_BOUND_IS_EXTENSION_FUNCTION_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ONLY_ONE_CLASS_BOUND_ALLOWED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 BOUNDS_NOT_ALLOWED_IF_BOUNDED_BY_TYPE_PARAMETER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 REPEATED_BOUND = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1 CONFLICTING_UPPER_BOUNDS =
            DiagnosticFactory1.create(ERROR, DECLARATION_NAME);

    DiagnosticFactory2 NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER =
            DiagnosticFactory2.create(ERROR);

    DiagnosticFactory0 VARIANCE_ON_TYPE_PARAMETER_NOT_ALLOWED = DiagnosticFactory0.create(ERROR, VARIANCE_MODIFIER);
    DiagnosticFactory0 BOUND_ON_TYPE_ALIAS_PARAMETER_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 DEPRECATED_TYPE_PARAMETER_SYNTAX = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 REIFIED_TYPE_PARAMETER_NO_INLINE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 TYPE_PARAMETERS_NOT_ALLOWED
            = DiagnosticFactory0.create(ERROR, TYPE_PARAMETERS_OR_DECLARATION_SIGNATURE);

    DiagnosticFactory0 TYPE_PARAMETER_OF_PROPERTY_NOT_USED_IN_RECEIVER = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 CYCLIC_GENERIC_UPPER_BOUND = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 MISPLACED_TYPE_PARAMETER_CONSTRAINTS = DiagnosticFactory0.create(WARNING);

    // Members

    DiagnosticFactory1> CONFLICTING_OVERLOADS =
            DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);

    DiagnosticFactory0 NON_FINAL_MEMBER_IN_FINAL_CLASS = DiagnosticFactory0.create(WARNING, modifierSetPosition(
            KtTokens.OPEN_KEYWORD));

    DiagnosticFactory0 NON_FINAL_MEMBER_IN_OBJECT = DiagnosticFactory0.create(WARNING, modifierSetPosition(
            KtTokens.OPEN_KEYWORD));

    DiagnosticFactory1 NOTHING_TO_OVERRIDE =
            DiagnosticFactory1.create(ERROR, OVERRIDE_MODIFIER);

    DiagnosticFactory3
            VIRTUAL_MEMBER_HIDDEN =
            DiagnosticFactory3.create(ERROR, DECLARATION_NAME);

    DiagnosticFactory2 CANNOT_OVERRIDE_INVISIBLE_MEMBER =
            DiagnosticFactory2.create(ERROR, OVERRIDE_MODIFIER);

    DiagnosticFactory2 DATA_CLASS_OVERRIDE_CONFLICT =
            DiagnosticFactory2.create(ERROR);
    DiagnosticFactoryForDeprecation2 DATA_CLASS_OVERRIDE_DEFAULT_VALUES =
            DiagnosticFactoryForDeprecation2.create(LanguageFeature.ProhibitDataClassesOverridingCopy);
    //        DiagnosticFactory2.create(ERROR);

    DiagnosticFactory1 CANNOT_INFER_VISIBILITY =
            DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);

    DiagnosticFactory2 OVERRIDING_FINAL_MEMBER =
            DiagnosticFactory2.create(ERROR, OVERRIDE_MODIFIER);

    DiagnosticFactory3
            CANNOT_WEAKEN_ACCESS_PRIVILEGE =
            DiagnosticFactory3.create(ERROR, VISIBILITY_MODIFIER);
    DiagnosticFactory3
            CANNOT_CHANGE_ACCESS_PRIVILEGE =
            DiagnosticFactory3.create(ERROR, VISIBILITY_MODIFIER);
    DiagnosticFactory2 RETURN_TYPE_MISMATCH_ON_OVERRIDE =
            DiagnosticFactory2.create(ERROR, DECLARATION_RETURN_TYPE);
    DiagnosticFactory2 PROPERTY_TYPE_MISMATCH_ON_OVERRIDE =
            DiagnosticFactory2.create(ERROR, DECLARATION_RETURN_TYPE);
    DiagnosticFactory2 VAR_TYPE_MISMATCH_ON_OVERRIDE =
            DiagnosticFactory2.create(ERROR, DECLARATION_RETURN_TYPE);

    DiagnosticFactory2 RETURN_TYPE_MISMATCH_ON_INHERITANCE =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 PROPERTY_TYPE_MISMATCH_ON_INHERITANCE =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 VAR_TYPE_MISMATCH_ON_INHERITANCE =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);

    DiagnosticFactory2 OVERRIDING_FINAL_MEMBER_BY_DELEGATION =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 RETURN_TYPE_MISMATCH_BY_DELEGATION =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 PROPERTY_TYPE_MISMATCH_BY_DELEGATION =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);

    DiagnosticFactory2> CONFLICTING_INHERITED_MEMBERS =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2> CONFLICTING_INHERITED_MEMBERS_WARNING =
            DiagnosticFactory2.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory2 ABSTRACT_MEMBER_NOT_IMPLEMENTED =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED_WARNING =
            DiagnosticFactory2.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory2 MANY_IMPL_MEMBER_NOT_IMPLEMENTED =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED =
            DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory2 MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED_WARNING =
            DiagnosticFactory2.create(WARNING, DECLARATION_NAME);
    DiagnosticFactoryForDeprecation2>
            INVISIBLE_ABSTRACT_MEMBER_FROM_SUPER =
            DiagnosticFactoryForDeprecation2.create(LanguageFeature.ProhibitInvisibleAbstractMethodsInSuperclasses, DECLARATION_NAME);

    DiagnosticFactory1> AMBIGUOUS_ANONYMOUS_TYPE_INFERRED =
            DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE);

    DiagnosticFactory1
            KCLASS_WITH_NULLABLE_TYPE_PARAMETER_IN_SIGNATURE = DiagnosticFactory1.create(ERROR, PositioningStrategies.DECLARATION_NAME);

    // Property-specific

    DiagnosticFactory2 VAR_OVERRIDDEN_BY_VAL =
            DiagnosticFactory2.create(ERROR, VAL_OR_VAR_NODE);

    DiagnosticFactory0 REDUNDANT_MODIFIER_IN_GETTER = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 PRIVATE_SETTER_FOR_ABSTRACT_PROPERTY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 PRIVATE_SETTER_FOR_OPEN_PROPERTY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory2 WRONG_GETTER_RETURN_TYPE = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory0 WRONG_SETTER_RETURN_TYPE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0
            ABSTRACT_PROPERTY_IN_PRIMARY_CONSTRUCTOR_PARAMETERS = DiagnosticFactory0.create(ERROR, ABSTRACT_MODIFIER);
    DiagnosticFactory0 ABSTRACT_PROPERTY_WITH_INITIALIZER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ABSTRACT_PROPERTY_WITH_GETTER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ABSTRACT_PROPERTY_WITH_SETTER = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 ABSTRACT_DELEGATED_PROPERTY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ACCESSOR_FOR_DELEGATED_PROPERTY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DELEGATED_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 PROPERTY_WITH_NO_TYPE_NO_INITIALIZER = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);

    DiagnosticFactory0 MUST_BE_INITIALIZED = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 MUST_BE_INITIALIZED_OR_BE_ABSTRACT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT =
            DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 UNNECESSARY_LATEINIT = DiagnosticFactory0.create(WARNING, LATEINIT_MODIFIER);

    DiagnosticFactory0 EXTENSION_PROPERTY_WITH_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 CONTEXT_RECEIVERS_WITH_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 PROPERTY_INITIALIZER_NO_BACKING_FIELD = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 PROPERTY_INITIALIZER_IN_INTERFACE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 PRIVATE_PROPERTY_IN_INTERFACE = DiagnosticFactory0.create(ERROR, PRIVATE_MODIFIER);
    DiagnosticFactory0 BACKING_FIELD_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);

    DiagnosticFactory1 INAPPLICABLE_LATEINIT_MODIFIER = DiagnosticFactory1.create(ERROR, LATEINIT_MODIFIER);
    DiagnosticFactory0 LATEINIT_INTRINSIC_CALL_ON_NON_LITERAL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 LATEINIT_INTRINSIC_CALL_ON_NON_LATEINIT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 LATEINIT_INTRINSIC_CALL_IN_INLINE_FUNCTION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 LATEINIT_INTRINSIC_CALL_ON_NON_ACCESSIBLE_PROPERTY =
            DiagnosticFactory1.create(ERROR);

    DiagnosticFactory2 ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS =
            DiagnosticFactory2.create(ERROR, ABSTRACT_MODIFIER);

    DiagnosticFactory0 VAL_WITH_SETTER = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 SETTER_PARAMETER_WITH_DEFAULT_VALUE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory2 WRONG_SETTER_PARAMETER_TYPE = DiagnosticFactory2.create(ERROR);
    DiagnosticFactoryForDeprecation1 DELEGATE_USES_EXTENSION_PROPERTY_TYPE_PARAMETER = DiagnosticFactoryForDeprecation1.create(LanguageFeature.ForbidUsingExtensionPropertyTypeParameterInDelegate);

    // Function-specific

    DiagnosticFactory2 ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS =
            DiagnosticFactory2.create(ERROR, ABSTRACT_MODIFIER);

    DiagnosticFactory1 ABSTRACT_FUNCTION_WITH_BODY =
            DiagnosticFactory1.create(ERROR, ABSTRACT_MODIFIER);
    DiagnosticFactory1 NON_ABSTRACT_FUNCTION_WITH_NO_BODY =
            DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory1 PRIVATE_FUNCTION_WITH_NO_BODY =
            DiagnosticFactory1.create(ERROR, PRIVATE_MODIFIER);

    DiagnosticFactory1 NON_MEMBER_FUNCTION_NO_BODY =
            DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE);

    DiagnosticFactory0 FUNCTION_DECLARATION_WITH_NO_NAME = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 ANONYMOUS_FUNCTION_WITH_NAME = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 NO_TAIL_CALLS_FOUND = DiagnosticFactory0.create(WARNING, TAILREC_MODIFIER);
    DiagnosticFactoryForDeprecation0 TAILREC_ON_VIRTUAL_MEMBER =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitTailrecOnVirtualMember, TAILREC_MODIFIER);

    DiagnosticFactory0
            ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE = DiagnosticFactory0.create(ERROR, PARAMETER_DEFAULT_VALUE);

    DiagnosticFactory0 USELESS_VARARG_ON_PARAMETER = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 MULTIPLE_VARARG_PARAMETERS = DiagnosticFactory0.create(ERROR, PARAMETER_VARARG_MODIFIER);

    DiagnosticFactory1 FORBIDDEN_VARARG_PARAMETER_TYPE =
            DiagnosticFactory1.create(ERROR, PARAMETER_VARARG_MODIFIER);

    DiagnosticFactory0 CHANGING_ARGUMENTS_EXECUTION_ORDER_FOR_NAMED_VARARGS = DiagnosticFactory0.create(WARNING);

    // Named parameters

    DiagnosticFactory0 DEFAULT_VALUE_NOT_ALLOWED_IN_OVERRIDE = DiagnosticFactory0.create(ERROR, PARAMETER_DEFAULT_VALUE);

    DiagnosticFactory1 MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES =
            DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 MULTIPLE_DEFAULTS_INHERITED_FROM_SUPERTYPES_WHEN_NO_EXPLICIT_OVERRIDE =
            DiagnosticFactory1.create(ERROR, DECLARATION_NAME);

    DiagnosticFactory2 PARAMETER_NAME_CHANGED_ON_OVERRIDE =
            DiagnosticFactory2.create(WARNING, DECLARATION_NAME);

    DiagnosticFactory2, Integer>
            DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES =
            DiagnosticFactory2.create(WARNING, DECLARATION_NAME);

    DiagnosticFactory0 NAME_FOR_AMBIGUOUS_PARAMETER = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 DATA_CLASS_WITHOUT_PARAMETERS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DATA_CLASS_VARARG_PARAMETER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DATA_CLASS_NOT_PROPERTY_PARAMETER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DATA_OBJECT_CUSTOM_EQUALS_OR_HASH_CODE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 CATCH_PARAMETER_WITH_DEFAULT_VALUE = DiagnosticFactory0.create(ERROR);

    // Multi-platform projects

    DiagnosticFactory0 EXPECTED_DECLARATION_WITH_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 EXPECTED_CLASS_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EXPECTED_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0> EXPECTED_ENUM_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EXPECTED_ENUM_ENTRY_WITH_BODY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EXPECTED_PROPERTY_INITIALIZER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EXPECTED_DELEGATED_PROPERTY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EXPECTED_LATEINIT_PROPERTY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SUPERTYPE_INITIALIZED_IN_EXPECTED_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EXPECTED_PRIVATE_DECLARATION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 IMPLEMENTATION_BY_DELEGATION_IN_EXPECT_CLASS = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 ACTUAL_TYPE_ALIAS_NOT_TO_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0
            ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 ACTUAL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 ACTUAL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 ACTUAL_ANNOTATION_CONFLICTING_DEFAULT_ARGUMENT_VALUE =
            DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 EXPECTED_FUNCTION_SOURCE_WITH_DEFAULT_ARGUMENTS_NOT_FOUND = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory3, Collection>> NO_ACTUAL_FOR_EXPECT =
            DiagnosticFactory3.create(ERROR, INCOMPATIBLE_DECLARATION);
    DiagnosticFactory2, Collection>> ACTUAL_WITHOUT_EXPECT =
            DiagnosticFactory2.create(ERROR, INCOMPATIBLE_DECLARATION);
    DiagnosticFactory2> AMBIGUOUS_ACTUALS =
            DiagnosticFactory2.create(ERROR, INCOMPATIBLE_DECLARATION);
    DiagnosticFactory2> AMBIGUOUS_EXPECTS =
            DiagnosticFactory2.create(ERROR, INCOMPATIBLE_DECLARATION);

    DiagnosticFactory2, Collection>>>>
            NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS =
            DiagnosticFactory2.create(ERROR, ACTUAL_DECLARATION_NAME);
    DiagnosticFactory0 ACTUAL_MISSING = DiagnosticFactory0.create(ERROR, ACTUAL_DECLARATION_NAME);

    DiagnosticFactory0 OPTIONAL_EXPECTATION_NOT_ON_EXPECTED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NESTED_OPTIONAL_EXPECTATION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE = DiagnosticFactory0.create(ERROR);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Errors/warnings inside code blocks

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // General

    DiagnosticFactory1 NAME_SHADOWING = DiagnosticFactory1.create(WARNING, PositioningStrategies.FOR_REDECLARATION);
    DiagnosticFactory0 ACCESSOR_PARAMETER_NAME_SHADOWING = DiagnosticFactory0.create(WARNING);

    DiagnosticFactoryForDeprecation0 TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ForbidRecursiveDelegateExpressions);

    // Checking call arguments

    DiagnosticFactory0 MIXING_NAMED_AND_POSITIONED_ARGUMENTS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ARGUMENT_PASSED_TWICE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 NAMED_PARAMETER_NOT_FOUND =
            DiagnosticFactory1.create(ERROR, FOR_UNRESOLVED_REFERENCE);
    DiagnosticFactory1 NAMED_ARGUMENTS_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);

    enum BadNamedArgumentsTarget {
        NON_KOTLIN_FUNCTION, // a function provided by non-Kotlin artifact, ex: Java function
        INTEROP_FUNCTION, // deserialized Kotlin function that serves as a bridge to a function written in another language, ex: Obj-C
        INVOKE_ON_FUNCTION_TYPE,
        EXPECTED_CLASS_MEMBER,
    }

    DiagnosticFactory0 VARARG_OUTSIDE_PARENTHESES = DiagnosticFactory0.create(ERROR);
    DiagnosticFactoryForDeprecation0 NON_VARARG_SPREAD =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ReportNonVarargSpreadOnGenericCalls);
    DiagnosticFactory0 SPREAD_OF_NULLABLE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SPREAD_OF_LAMBDA_OR_CALLABLE_REFERENCE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 MANY_LAMBDA_EXPRESSION_ARGUMENTS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 UNEXPECTED_TRAILING_LAMBDA_ON_A_NEW_LINE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1 TOO_MANY_ARGUMENTS = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 NO_VALUE_FOR_PARAMETER = DiagnosticFactory1.create(ERROR, VALUE_ARGUMENTS);

    DiagnosticFactory1 MISSING_RECEIVER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 NO_RECEIVER_ALLOWED = DiagnosticFactory0.create(ERROR);

    DiagnosticFactoryForDeprecation1 ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_FUNCTION =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.ProhibitAssigningSingleElementsToVarargsInNamedForm);
    DiagnosticFactory0 REDUNDANT_SPREAD_OPERATOR_IN_NAMED_FORM_IN_FUNCTION = DiagnosticFactory0.create(WARNING);
    DiagnosticFactoryForDeprecation0 ASSIGNING_SINGLE_ELEMENT_TO_VARARG_IN_NAMED_FORM_ANNOTATION =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitAssigningSingleElementsToVarargsInNamedForm);
    DiagnosticFactory0 REDUNDANT_SPREAD_OPERATOR_IN_NAMED_FORM_IN_ANNOTATION = DiagnosticFactory0.create(WARNING);

    // Call resolution

    DiagnosticFactory0 ILLEGAL_SELECTOR = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory2 FUNCTION_EXPECTED = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 FUNCTION_CALL_EXPECTED = DiagnosticFactory2.create(ERROR, CALL_EXPRESSION);

    DiagnosticFactory0 NON_TAIL_RECURSIVE_CALL = DiagnosticFactory0.create(WARNING, CALL_EXPRESSION);
    DiagnosticFactory0 TAIL_RECURSION_IN_TRY_IS_NOT_SUPPORTED = DiagnosticFactory0.create(WARNING, CALL_EXPRESSION);

    DiagnosticFactory0 NO_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NO_CONSTRUCTOR_WARNING = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NOT_A_CLASS = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1>> OVERLOAD_RESOLUTION_AMBIGUITY = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory3 OVERLOAD_RESOLUTION_AMBIGUITY_BECAUSE_OF_STUB_TYPES = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 STUB_TYPE_IN_ARGUMENT_CAUSES_AMBIGUITY = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory4 STUB_TYPE_IN_RECEIVER_CAUSES_AMBIGUITY = DiagnosticFactory4.create(ERROR);
    DiagnosticFactory2 BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 BUILDER_INFERENCE_STUB_RECEIVER = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory1>> NONE_APPLICABLE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1>> CANNOT_COMPLETE_RESOLVE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1>> UNRESOLVED_REFERENCE_WRONG_RECEIVER =
            DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1> CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY =
            DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 TYPE_PARAMETER_AS_REIFIED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 DEFINITELY_NON_NULLABLE_AS_REIFIED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactoryForDeprecation1 TYPE_PARAMETER_AS_REIFIED_ARRAY =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.ProhibitNonReifiedArraysAsReifiedTypeArguments);
    DiagnosticFactory1 REIFIED_TYPE_FORBIDDEN_SUBSTITUTION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 REIFIED_TYPE_UNSAFE_SUBSTITUTION = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 CANDIDATE_CHOSEN_USING_OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory1 COMPATIBILITY_WARNING = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory3 RESOLUTION_TO_CLASSIFIER =
            DiagnosticFactory3.create(ERROR);

    DiagnosticFactory0 RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 PARENTHESIZED_COMPANION_LHS_DEPRECATION = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 RESOLUTION_TO_PRIVATE_CONSTRUCTOR_OF_SEALED_CLASS = DiagnosticFactory0.create(WARNING);

    // Type inference

    DiagnosticFactory0 CANNOT_INFER_PARAMETER_TYPE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory1 TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 INFERRED_INTO_DECLARED_UPPER_BOUNDS = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory1 COULD_BE_INFERRED_ONLY_WITH_UNRESTRICTED_BUILDER_INFERENCE = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 TYPE_INFERENCE_CANNOT_CAPTURE_TYPES = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 TYPE_INFERENCE_INCORPORATION_ERROR = DiagnosticFactory0.create(ERROR);

    DiagnosticFactoryForDeprecation1 TYPE_INFERENCE_ONLY_INPUT_TYPES =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.StrictOnlyInputTypesChecks);
    DiagnosticFactoryForDeprecation4, String, String> INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION =
            DiagnosticFactoryForDeprecation4.create(LanguageFeature.ForbidInferringTypeVariablesIntoEmptyIntersection);
    DiagnosticFactory4, String, String> INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION =
            DiagnosticFactory4.create(WARNING);
    DiagnosticFactory1 TYPE_INFERENCE_UPPER_BOUND_VIOLATED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory0 TYPE_INFERENCE_CANDIDATE_WITH_SAM_AND_VARARG = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 TYPE_INFERENCE_FAILED_ON_SPECIAL_CONSTRUCT = DiagnosticFactory0.create(ERROR, SPECIAL_CONSTRUCT_TOKEN);

    DiagnosticFactory0 IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 IMPLICIT_NOTHING_TYPE_ARGUMENT_AGAINST_NOT_NOTHING_EXPECTED_TYPE = DiagnosticFactory0.create(WARNING);

    // Reflection

    DiagnosticFactory1 EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 CALLABLE_REFERENCE_LHS_NOT_A_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 CALLABLE_REFERENCE_TO_ANNOTATION_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 CLASS_LITERAL_LHS_NOT_A_CLASS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ARRAY_CLASS_LITERAL_REQUIRES_ARGUMENT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NULLABLE_TYPE_IN_CLASS_LITERAL_LHS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 EXPRESSION_OF_NULLABLE_TYPE_IN_CLASS_LITERAL_LHS = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 CALLABLE_REFERENCE_TO_JAVA_SYNTHETIC_PROPERTY = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE = DiagnosticFactory0.create(ERROR);

    // Destructuring-declarations

    DiagnosticFactory0 INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION =
            DiagnosticFactory0.create(ERROR, DEFAULT);
    DiagnosticFactory2 COMPONENT_FUNCTION_MISSING = DiagnosticFactory2.create(ERROR, DEFAULT);
    DiagnosticFactory1 COMPONENT_FUNCTION_ON_NULLABLE = DiagnosticFactory1.create(ERROR, DEFAULT);
    DiagnosticFactory2>> COMPONENT_FUNCTION_AMBIGUITY =
            DiagnosticFactory2.create(ERROR, DEFAULT);
    DiagnosticFactory3 COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH =
            DiagnosticFactory3.create(ERROR, DEFAULT);

    // Super calls

    DiagnosticFactory1 SUPER_IS_NOT_AN_EXPRESSION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 SUPER_CANT_BE_EXTENSION_RECEIVER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 SUPER_NOT_AVAILABLE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 AMBIGUOUS_SUPER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ABSTRACT_SUPER_CALL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ABSTRACT_SUPER_CALL_WARNING = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 NOT_A_SUPERTYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 TYPE_ARGUMENTS_REDUNDANT_IN_SUPER_QUALIFIER = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory1 QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE = DiagnosticFactory1.create(ERROR);

    // Conventions

    DiagnosticFactory2 DEPRECATED_IDENTITY_EQUALS = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 IMPLICIT_BOXING_IN_IDENTITY_EQUALS = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 FORBIDDEN_IDENTITY_EQUALS = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1 FORBIDDEN_SYNCHRONIZED_BY_VALUE_CLASSES_OR_PRIMITIVES = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory2 DEPRECATED_BINARY_MOD = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 FORBIDDEN_BINARY_MOD = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 DEPRECATED_BINARY_MOD_AS_REM = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 FORBIDDEN_BINARY_MOD_AS_REM = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory0 NO_GET_METHOD = DiagnosticFactory0.create(ERROR, ARRAY_ACCESS);
    DiagnosticFactory0 NO_SET_METHOD = DiagnosticFactory0.create(ERROR, ARRAY_ACCESS);

    DiagnosticFactory0 INC_DEC_SHOULD_NOT_RETURN_UNIT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory2 ASSIGNMENT_OPERATOR_SHOULD_RETURN_UNIT =
            DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1>>
            ASSIGN_OPERATOR_AMBIGUITY = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 EQUALS_MISSING = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory3 EQUALITY_NOT_APPLICABLE =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 EQUALITY_NOT_APPLICABLE_WARNING =
            DiagnosticFactory3.create(WARNING);

    DiagnosticFactory2 INCOMPATIBLE_ENUM_COMPARISON =
            DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 INCOMPATIBLE_ENUM_COMPARISON_ERROR =
            DiagnosticFactory2.create(ERROR);

    DiagnosticFactory1 HAS_NEXT_MISSING = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 HAS_NEXT_FUNCTION_AMBIGUITY = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 HAS_NEXT_FUNCTION_NONE_APPLICABLE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 HAS_NEXT_FUNCTION_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 NEXT_AMBIGUITY = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 NEXT_MISSING = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 NEXT_NONE_APPLICABLE = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 ITERATOR_MISSING = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ITERATOR_ON_NULLABLE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1>> ITERATOR_AMBIGUITY = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory3 DELEGATE_SPECIAL_FUNCTION_MISSING = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory2>> DELEGATE_SPECIAL_FUNCTION_AMBIGUITY =
            DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2>> DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE =
            DiagnosticFactory2.create(ERROR);
    DiagnosticFactory3 DELEGATE_SPECIAL_FUNCTION_RETURN_TYPE_MISMATCH =
            DiagnosticFactory3.create(ERROR);
    DiagnosticFactory2>> DELEGATE_PD_METHOD_NONE_APPLICABLE =
            DiagnosticFactory2.create(WARNING);

    DiagnosticFactory1 COMPARE_TO_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 YIELD_IS_RESERVED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 UNDERSCORE_IS_RESERVED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 UNDERSCORE_USAGE_WITHOUT_BACKTICKS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 RESOLVED_TO_UNDERSCORE_NAMED_CATCH_PARAMETER = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory1 INVALID_CHARACTERS = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 INAPPLICABLE_OPERATOR_MODIFIER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 INAPPLICABLE_INFIX_MODIFIER = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory2 OPERATOR_MODIFIER_REQUIRED = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 INFIX_MODIFIER_REQUIRED = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory2 PROPERTY_AS_OPERATOR = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory2 INAPPLICABLE_MODIFIER = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory1 DSL_SCOPE_VIOLATION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 DSL_SCOPE_VIOLATION_WARNING = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory0 NULLABLE_EXTENSION_OPERATOR_WITH_SAFE_CALL_RECEIVER = DiagnosticFactory0.create(WARNING);

    // Labels

    DiagnosticFactory0 LABEL_NAME_CLASH = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory2 LABEL_RESOLVE_WILL_CHANGE = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory0 AMBIGUOUS_LABEL = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 BREAK_OR_CONTINUE_OUTSIDE_A_LOOP = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 BREAK_OR_CONTINUE_IN_WHEN = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 NOT_A_LOOP_LABEL = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 NOT_A_FUNCTION_LABEL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NOT_A_FUNCTION_LABEL_WARNING = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 REDUNDANT_LABEL_WARNING = DiagnosticFactory0.create(WARNING);

    // Control flow / Data flow

    DiagnosticFactory2, Set> UNREACHABLE_CODE = DiagnosticFactory2.create(
            WARNING, ClassicPositioningStrategies.UNREACHABLE_CODE);

    DiagnosticFactory0 VARIABLE_WITH_NO_TYPE_NO_INITIALIZER = DiagnosticFactory0.create(ERROR, DECLARATION_NAME);

    DiagnosticFactory1 UNINITIALIZED_VARIABLE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 UNINITIALIZED_PARAMETER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 UNINITIALIZED_PARAMETER_WARNING = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory1 UNINITIALIZED_ENUM_ENTRY = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 UNINITIALIZED_ENUM_COMPANION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 UNINITIALIZED_ENUM_COMPANION_WARNING = DiagnosticFactory1.create(WARNING);

    DiagnosticFactory1 UNUSED_VARIABLE = DiagnosticFactory1.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory1 UNUSED_PARAMETER = DiagnosticFactory1.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory1 UNUSED_ANONYMOUS_PARAMETER = DiagnosticFactory1.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory1 UNUSED_DESTRUCTURED_PARAMETER_ENTRY =
            DiagnosticFactory1.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory2 UNUSED_TYPEALIAS_PARAMETER =
            DiagnosticFactory2.create(WARNING, DECLARATION_NAME);

    DiagnosticFactory1 ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE =
            DiagnosticFactory1.create(WARNING, DECLARATION_NAME);
    DiagnosticFactory1 VARIABLE_WITH_REDUNDANT_INITIALIZER = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory2 UNUSED_VALUE =
            DiagnosticFactory2.create(WARNING, PositioningStrategies.UNUSED_VALUE);
    DiagnosticFactory1 UNUSED_CHANGED_VALUE = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 UNUSED_EXPRESSION = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 UNUSED_LAMBDA_EXPRESSION = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory1 VAL_REASSIGNMENT = DiagnosticFactory1.create(ERROR);
    DiagnosticFactoryForDeprecation1 VAL_REASSIGNMENT_VIA_BACKING_FIELD =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.RestrictionOfValReassignmentViaBackingField);
    DiagnosticFactory1 CAPTURED_VAL_INITIALIZATION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 CAPTURED_MEMBER_VAL_INITIALIZATION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 SETTER_PROJECTED_OUT = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory1 INITIALIZATION_BEFORE_DECLARATION = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 VARIABLE_EXPECTED = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory2 SENSELESS_COMPARISON = DiagnosticFactory2.create(WARNING);

    DiagnosticFactory0 SENSELESS_NULL_IN_WHEN = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 INVALID_IF_AS_EXPRESSION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INVALID_IF_AS_EXPRESSION_WARNING = DiagnosticFactory0.create(WARNING);
    DiagnosticFactoryForDeprecation0 CONFUSING_BRANCH_CONDITION =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ProhibitConfusingSyntaxInWhenBranches);

    // Nullability

    DiagnosticFactory1 UNSAFE_CALL = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 UNSAFE_IMPLICIT_INVOKE_CALL = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory3 UNSAFE_INFIX_CALL = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 UNSAFE_OPERATOR_CALL = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory1 UNNECESSARY_SAFE_CALL = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 SAFE_CALL_WILL_CHANGE_NULLABILITY = DiagnosticFactory0.create(WARNING, PositioningStrategies.CALL_ELEMENT_WITH_DOT);
    DiagnosticFactory0 UNEXPECTED_SAFE_CALL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 UNNECESSARY_NOT_NULL_ASSERTION = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 NOT_NULL_ASSERTION_ON_LAMBDA_EXPRESSION = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory1 USELESS_ELVIS =
            DiagnosticFactory1.create(WARNING, PositioningStrategies.USELESS_ELVIS);
    DiagnosticFactory0 USELESS_ELVIS_RIGHT_IS_NULL =
            DiagnosticFactory0.create(WARNING, PositioningStrategies.USELESS_ELVIS);

    // Compile-time values

    DiagnosticFactory0 DIVISION_BY_ZERO = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 INTEGER_OVERFLOW = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 WRONG_LONG_SUFFIX = DiagnosticFactory0.create(ERROR, LONG_LITERAL_SUFFIX);
    DiagnosticFactory0 INT_LITERAL_OUT_OF_RANGE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 FLOAT_LITERAL_OUT_OF_RANGE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 FLOAT_LITERAL_CONFORMS_INFINITY = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 FLOAT_LITERAL_CONFORMS_ZERO = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory2 CONSTANT_EXPECTED_TYPE_MISMATCH = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory0 INCORRECT_CHARACTER_LITERAL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 EMPTY_CHARACTER_LITERAL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ILLEGAL_UNDERSCORE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 TOO_MANY_CHARACTERS_IN_CHARACTER_LITERAL =
            DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 ILLEGAL_ESCAPE = DiagnosticFactory1.create(ERROR, CUT_CHAR_QUOTES);
    DiagnosticFactory1 NULL_FOR_NONNULL_TYPE = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 NULL_FOR_NONNULL_TYPE_WARNING = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory0 ILLEGAL_ESCAPE_SEQUENCE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 UNSIGNED_LITERAL_WITHOUT_DECLARATIONS_ON_CLASSPATH = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 INTEGER_OPERATOR_RESOLVE_WILL_CHANGE = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory1 NON_TRIVIAL_BOOLEAN_CONSTANT = DiagnosticFactory1.create(WARNING);

    // Casts and is-checks

    DiagnosticFactory1 CANNOT_CHECK_FOR_ERASED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 UNCHECKED_CAST = DiagnosticFactory2.create(WARNING, AS_TYPE);

    DiagnosticFactory0 USELESS_CAST = DiagnosticFactory0.create(WARNING, AS_TYPE);
    DiagnosticFactory0 CAST_NEVER_SUCCEEDS = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 DYNAMIC_NOT_ALLOWED = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 IS_ENUM_ENTRY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ENUM_ENTRY_AS_TYPE = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory2 IMPLICIT_CAST_TO_ANY = DiagnosticFactory2.create(WARNING);

    DiagnosticFactory3 SMARTCAST_IMPOSSIBLE = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory3 DEPRECATED_SMARTCAST = DiagnosticFactory3.create(WARNING);
    DiagnosticFactory0 ALWAYS_NULL = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 USELESS_NULLABLE_CHECK = DiagnosticFactory0.create(WARNING, NULLABLE_TYPE);
    DiagnosticFactory1 USELESS_IS_CHECK = DiagnosticFactory1.create(WARNING);


    // Properties / locals

    DiagnosticFactory0 LOCAL_EXTENSION_PROPERTY = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 LOCAL_VARIABLE_WITH_GETTER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 LOCAL_VARIABLE_WITH_SETTER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 LOCAL_VARIABLE_WITH_TYPE_PARAMETERS_WARNING = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory0 LOCAL_VARIABLE_WITH_TYPE_PARAMETERS = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory3 INVISIBLE_SETTER =
            DiagnosticFactory3.create(ERROR);

    DiagnosticFactory1 VAL_OR_VAR_ON_LOOP_PARAMETER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 VAL_OR_VAR_ON_FUN_PARAMETER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 VAL_OR_VAR_ON_CATCH_PARAMETER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER = DiagnosticFactory1.create(ERROR);

    // When expressions

    DiagnosticFactory0 EXPECTED_CONDITION = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ELSE_MISPLACED_IN_WHEN = DiagnosticFactory0.create(ERROR, ELSE_ENTRY);
    DiagnosticFactory0 REDUNDANT_ELSE_IN_WHEN = DiagnosticFactory0.create(WARNING, ELSE_ENTRY);
    DiagnosticFactory1> NO_ELSE_IN_WHEN = DiagnosticFactory1.create(ERROR, WHEN_EXPRESSION);
    DiagnosticFactory1> NO_ELSE_IN_WHEN_WARNING =
            DiagnosticFactory1.create(WARNING, WHEN_EXPRESSION);
    DiagnosticFactory1> NON_EXHAUSTIVE_WHEN = DiagnosticFactory1.create(WARNING, WHEN_EXPRESSION);
    DiagnosticFactory2> NON_EXHAUSTIVE_WHEN_STATEMENT =
            DiagnosticFactory2.create(WARNING, WHEN_EXPRESSION);
    DiagnosticFactory1>
            NON_EXHAUSTIVE_WHEN_ON_SEALED_CLASS = DiagnosticFactory1.create(INFO, WHEN_EXPRESSION);
    DiagnosticFactory1 EXPECT_TYPE_IN_WHEN_WITHOUT_ELSE = DiagnosticFactory1.create(ERROR, WHEN_EXPRESSION);

    DiagnosticFactory0 COMMA_IN_WHEN_CONDITION_WITHOUT_ARGUMENT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DUPLICATE_LABEL_IN_WHEN = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory1 ILLEGAL_DECLARATION_IN_WHEN_SUBJECT = DiagnosticFactory1.create(ERROR);

    // Type mismatch

    DiagnosticFactory2 TYPE_MISMATCH = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 TYPE_MISMATCH_WARNING = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory1 TYPE_MISMATCH_DUE_TO_EQUALS_LAMBDA_IN_FUN = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS =
            DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 MEMBER_PROJECTED_OUT = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory1 RETURN_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 EXPECTED_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 ASSIGNMENT_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 TYPE_MISMATCH_IN_FOR_LOOP = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory3 RESULT_TYPE_MISMATCH = DiagnosticFactory3.create(ERROR);
    DiagnosticFactory0 TYPE_MISMATCH_IN_RANGE = DiagnosticFactory0.create(ERROR, WHEN_CONDITION_IN_RANGE);

    DiagnosticFactory1 EXPECTED_PARAMETER_TYPE_MISMATCH = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 EXPECTED_PARAMETER_TYPE_MISMATCH_WARNING = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory2> EXPECTED_PARAMETERS_NUMBER_MISMATCH =
            DiagnosticFactory2.create(ERROR, FUNCTION_PARAMETERS);

    DiagnosticFactory2 INCOMPATIBLE_TYPES = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory0 IMPLICIT_NOTHING_RETURN_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 IMPLICIT_NOTHING_PROPERTY_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ABBREVIATED_NOTHING_RETURN_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 ABBREVIATED_NOTHING_PROPERTY_TYPE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 IMPLICIT_INTERSECTION_TYPE = DiagnosticFactory1.create(ERROR);

    DiagnosticFactory0 DYNAMIC_RECEIVER_NOT_ALLOWED =
            DiagnosticFactory0.create(ERROR, PositioningStrategies.RECEIVER);

    // Context tracking

    DiagnosticFactory1 EXPRESSION_EXPECTED = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 ASSIGNMENT_IN_EXPRESSION_CONTEXT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 DECLARATION_IN_ILLEGAL_CONTEXT = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 EXPRESSION_EXPECTED_PACKAGE_FOUND = DiagnosticFactory0.create(ERROR);

    DiagnosticFactory0 RETURN_NOT_ALLOWED = DiagnosticFactory0.create(ERROR, PositioningStrategies.RETURN_WITH_LABEL);
    DiagnosticFactory0 RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY =
            DiagnosticFactory0.create(ERROR, PositioningStrategies.RETURN_WITH_LABEL);
    DiagnosticFactory0
            NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_WITH_BODY);
    DiagnosticFactory0
            NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY_MIGRATION = DiagnosticFactory0.create(ERROR, DECLARATION_WITH_BODY);

    DiagnosticFactory0 ANONYMOUS_INITIALIZER_IN_INTERFACE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);

    DiagnosticFactory0 NO_THIS = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 NO_COMPANION_OBJECT = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 TYPE_PARAMETER_IS_NOT_AN_EXPRESSION =
            DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 TYPE_PARAMETER_ON_LHS_OF_DOT = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE =
            DiagnosticFactory1.create(ERROR);
    DiagnosticFactory2 NESTED_CLASS_SHOULD_BE_QUALIFIED = DiagnosticFactory2.create(ERROR);

    DiagnosticFactory1 INACCESSIBLE_OUTER_CLASS_EXPRESSION =
            DiagnosticFactory1.create(ERROR, SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
    DiagnosticFactory1 NESTED_CLASS_NOT_ALLOWED = DiagnosticFactory1.create(ERROR, DECLARATION_NAME);
    DiagnosticFactory1 NESTED_CLASS_DEPRECATED = DiagnosticFactory1.create(WARNING, DECLARATION_NAME);

    //Inline and inlinable parameters
    DiagnosticFactory2 NON_PUBLIC_CALL_FROM_PUBLIC_INLINE =
            DiagnosticFactory2.create(ERROR, CALL_ELEMENT);
    DiagnosticFactory2 PRIVATE_CLASS_MEMBER_FROM_INLINE =
            DiagnosticFactory2.create(ERROR, CALL_ELEMENT);
    DiagnosticFactory1 NON_LOCAL_RETURN_NOT_ALLOWED = DiagnosticFactory1.create(ERROR, CALL_ELEMENT);
    DiagnosticFactory1 NOT_YET_SUPPORTED_IN_INLINE =
            DiagnosticFactory1.create(ERROR, NOT_SUPPORTED_IN_INLINE_MOST_RELEVANT);
    DiagnosticFactory0 NOTHING_TO_INLINE = DiagnosticFactory0.create(WARNING);
    DiagnosticFactory2 USAGE_IS_NOT_INLINABLE = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 USAGE_IS_NOT_INLINABLE_WARNING = DiagnosticFactory2.create(WARNING);
    DiagnosticFactory2 NULLABLE_INLINE_PARAMETER = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 RECURSION_IN_INLINE = DiagnosticFactory2.create(ERROR);
    DiagnosticFactory0 DECLARATION_CANT_BE_INLINED = DiagnosticFactory0.create(ERROR, INLINE_FUN_MODIFIER);
    DiagnosticFactory0 OVERRIDE_BY_INLINE = DiagnosticFactory0.create(WARNING, DECLARATION_SIGNATURE);
    DiagnosticFactory0 REIFIED_TYPE_PARAMETER_IN_OVERRIDE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 INLINE_CALL_CYCLE = DiagnosticFactory1.create(ERROR, DEFAULT);
    DiagnosticFactory0 NON_LOCAL_RETURN_IN_DISABLED_INLINE = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 INLINE_PROPERTY_WITH_BACKING_FIELD = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
    DiagnosticFactory0 NON_INTERNAL_PUBLISHED_API = DiagnosticFactory0.create(ERROR);
    DiagnosticFactoryForDeprecation1 PROTECTED_CALL_FROM_PUBLIC_INLINE =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.ProhibitProtectedCallFromInline);
    DiagnosticFactoryForDeprecation1 PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.ProhibitProtectedConstructorCallFromPublicInline);
    DiagnosticFactoryForDeprecation1 SUPER_CALL_FROM_PUBLIC_INLINE =
            DiagnosticFactoryForDeprecation1.create(LanguageFeature.ProhibitSuperCallsFromPublicInline);
    DiagnosticFactory2 INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE =
            DiagnosticFactory2.create(ERROR);
    DiagnosticFactory2 NOT_SUPPORTED_INLINE_PARAMETER_IN_INLINE_PARAMETER_DEFAULT_VALUE =
            DiagnosticFactory2.create(ERROR);
    DiagnosticFactory0 PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS = DiagnosticFactory0.create(WARNING);

    DiagnosticFactory0 NON_LOCAL_SUSPENSION_POINT = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory1 ILLEGAL_SUSPEND_FUNCTION_CALL = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 ILLEGAL_SUSPEND_PROPERTY_ACCESS = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 ILLEGAL_RESTRICTED_SUSPENDING_FUNCTION_CALL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 NON_MODIFIER_FORM_FOR_BUILT_IN_SUSPEND = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 RETURN_FOR_BUILT_IN_SUSPEND = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND = DiagnosticFactory0.create(ERROR);
    DiagnosticFactoryForDeprecation0 MODIFIER_FORM_FOR_NON_BUILT_IN_SUSPEND_FUN =
            DiagnosticFactoryForDeprecation0.create(LanguageFeature.ModifierNonBuiltinSuspendFunError);

    DiagnosticFactory1> PLUGIN_ERROR = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1> PLUGIN_WARNING = DiagnosticFactory1.create(WARNING);
    DiagnosticFactory1> PLUGIN_INFO = DiagnosticFactory1.create(INFO);

    // Function contracts
    DiagnosticFactory1 ERROR_IN_CONTRACT_DESCRIPTION = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 CONTRACT_NOT_ALLOWED = DiagnosticFactory1.create(ERROR);

    // Context receivers
    DiagnosticFactory1 NO_CONTEXT_RECEIVER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory1 MULTIPLE_ARGUMENTS_APPLICABLE_FOR_CONTEXT_RECEIVER = DiagnosticFactory1.create(ERROR);
    DiagnosticFactory0 AMBIGUOUS_CALL_WITH_IMPLICIT_CONTEXT_RECEIVER = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 UNSUPPORTED_CONTEXTUAL_DECLARATION_CALL = DiagnosticFactory0.create(ERROR);
    DiagnosticFactory0 SUBTYPING_BETWEEN_CONTEXT_RECEIVERS = DiagnosticFactory0.create(ERROR);

    // Error sets
    ImmutableSet> UNRESOLVED_REFERENCE_DIAGNOSTICS = ImmutableSet.of(
            UNRESOLVED_REFERENCE, NAMED_PARAMETER_NOT_FOUND, UNRESOLVED_REFERENCE_WRONG_RECEIVER);
    ImmutableSet> INVISIBLE_REFERENCE_DIAGNOSTICS = ImmutableSet.of(
            INVISIBLE_MEMBER, NON_PUBLIC_CALL_FROM_PUBLIC_INLINE, INVISIBLE_REFERENCE, INVISIBLE_SETTER);
    ImmutableSet> UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of(
            UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE, VARIABLE_WITH_REDUNDANT_INITIALIZER,
            UNUSED_LAMBDA_EXPRESSION, USELESS_CAST, UNUSED_VALUE, USELESS_ELVIS, UNNECESSARY_LATEINIT, REDUNDANT_ELSE_IN_WHEN);
    ImmutableSet> TYPE_INFERENCE_ERRORS = ImmutableSet.of(
            TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS,
            TYPE_INFERENCE_PARAMETER_CONSTRAINT_ERROR,
            TYPE_INFERENCE_UPPER_BOUND_VIOLATED, TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH,
            NEW_INFERENCE_ERROR, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER);
    ImmutableSet> MUST_BE_INITIALIZED_DIAGNOSTICS = ImmutableSet.of(
            MUST_BE_INITIALIZED, MUST_BE_INITIALIZED_OR_BE_ABSTRACT
    );
    ImmutableSet> TYPE_MISMATCH_ERRORS = ImmutableSet.of(
            TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH, NULL_FOR_NONNULL_TYPE, TYPE_MISMATCH_DUE_TO_TYPE_PROJECTIONS,
            MEMBER_PROJECTED_OUT);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // This field is needed to make the Initializer class load (interfaces cannot have static initializers)

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    @SuppressWarnings("UnusedDeclaration")
    Initializer __initializer = Initializer.INSTANCE;

    class Initializer {
        private static final String WARNING = "_WARNING";
        private static final String ERROR = "_ERROR";

        static {
            initializeFactoryNames(Errors.class);
        }

        public static void initializeFactoryNames(@NotNull Class aClass) {
            initializeFactoryNamesAndDefaultErrorMessages(aClass, DiagnosticFactoryToRendererMap::new);
        }

        public static void initializeFactoryNamesAndDefaultErrorMessages(
                @NotNull Class aClass,
                @NotNull DefaultErrorMessages.Extension defaultErrorMessages
        ) {
            DiagnosticFactoryToRendererMap diagnosticToRendererMap = defaultErrorMessages.getMap();
            for (Field field : aClass.getFields()) {
                if (Modifier.isStatic(field.getModifiers())) {
                    try {
                        Object value = field.get(null);
                        if (value instanceof DiagnosticFactory) {
                            initializeNameAndRenderer(diagnosticToRendererMap, field.getName(), (DiagnosticFactory) value);
                        }
                        if (value instanceof DiagnosticFactoryForDeprecation) {
                            String errorName = field.getName();
                            DiagnosticFactoryForDeprecation factory = (DiagnosticFactoryForDeprecation) value;
                            initializeNameAndRenderer(diagnosticToRendererMap, field.getName() + ERROR, factory.getErrorFactory());
                            initializeNameAndRenderer(diagnosticToRendererMap, field.getName() + WARNING, factory.getWarningFactory());
                        }
                    }
                    catch (IllegalAccessException e) {
                        throw new IllegalStateException(e);
                    }
                }
            }
        }

        @SuppressWarnings("unchecked")
        private static void initializeNameAndRenderer(
                DiagnosticFactoryToRendererMap diagnosticToRendererMap,
                String name,
                DiagnosticFactory factory
        ) {
            factory.initializeName(name);
            factory.setDefaultRenderer((DiagnosticRenderer) diagnosticToRendererMap.get(factory));
        }

        private static final Initializer INSTANCE = new Initializer();

        private Initializer() {
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy