diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt index ecf908d24e9..3e71d677efb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt @@ -95,7 +95,9 @@ public object ModifierCheckerCore { OVERRIDE_KEYWORD to EnumSet.of(CLASS, ENUM_ENTRY), PROTECTED_KEYWORD to EnumSet.of(CLASS_ONLY, INNER_CLASS, LOCAL_CLASS, ENUM_CLASS, OBJECT), INTERNAL_KEYWORD to EnumSet.of(CLASS_ONLY, INNER_CLASS, LOCAL_CLASS, OBJECT, OBJECT_LITERAL, - ANNOTATION_CLASS, ENUM_CLASS, ENUM_ENTRY, FILE), + ENUM_CLASS, ENUM_ENTRY, FILE), + PRIVATE_KEYWORD to EnumSet.of(CLASS_ONLY, INNER_CLASS, LOCAL_CLASS, OBJECT, OBJECT_LITERAL, + INTERFACE, ENUM_CLASS, ENUM_ENTRY, FILE), COMPANION_KEYWORD to EnumSet.of(CLASS_ONLY, ENUM_CLASS, INTERFACE) ) diff --git a/compiler/testData/diagnostics/tests/modifiers/annotations.kt b/compiler/testData/diagnostics/tests/modifiers/annotations.kt new file mode 100644 index 00000000000..69758dfebbf --- /dev/null +++ b/compiler/testData/diagnostics/tests/modifiers/annotations.kt @@ -0,0 +1,6 @@ +annotation class My( + public val x: Int, + protected val y: Int, + internal val z: Int, + private val w: Int +) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/modifiers/annotations.txt b/compiler/testData/diagnostics/tests/modifiers/annotations.txt new file mode 100644 index 00000000000..a41a2c3ebde --- /dev/null +++ b/compiler/testData/diagnostics/tests/modifiers/annotations.txt @@ -0,0 +1,12 @@ +package + +@kotlin.annotation.annotation() public final class My : kotlin.Annotation { + public constructor My(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int, /*2*/ z: kotlin.Int, /*3*/ w: kotlin.Int) + private final val w: kotlin.Int + public final val x: kotlin.Int + protected final val y: kotlin.Int + internal final val z: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index aa10a7ed10a..9fb8eda2508 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -9156,6 +9156,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/modifiers"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("annotations.kt") + public void testAnnotations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/annotations.kt"); + doTest(fileName); + } + @TestMetadata("defaultModifier.kt") public void testDefaultModifier() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/defaultModifier.kt");