diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmFieldApplicabilityChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmFieldApplicabilityChecker.kt index 7fc30fd2fb1..3942b4e1f28 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmFieldApplicabilityChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmFieldApplicabilityChecker.kt @@ -23,14 +23,13 @@ import org.jetbrains.kotlin.fileClasses.isInsideJvmMultifileClassFile import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtProperty import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.checkers.SimpleDeclarationChecker import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.resolve.DescriptorUtils +import org.jetbrains.kotlin.resolve.checkers.SimpleDeclarationChecker import org.jetbrains.kotlin.resolve.jvm.annotations.findJvmFieldAnnotation import org.jetbrains.kotlin.resolve.jvm.checkers.JvmFieldApplicabilityChecker.Problem.* import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm - class JvmFieldApplicabilityChecker : SimpleDeclarationChecker { internal enum class Problem(val errorMessage: String) { @@ -83,7 +82,7 @@ class JvmFieldApplicabilityChecker : SimpleDeclarationChecker { val containingClass = containingDeclaration as? ClassDescriptor ?: return false if (!DescriptorUtils.isCompanionObject(containingClass)) return false - val outerClassForObject = containingClass.containingDeclaration as? ClassDescriptor ?: return false - return DescriptorUtils.isInterface(outerClassForObject) + val outerClassKind = (containingClass.containingDeclaration as? ClassDescriptor)?.kind + return outerClassKind == ClassKind.INTERFACE || outerClassKind == ClassKind.ANNOTATION_CLASS } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index d8972b26709..b3bd34cce05 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -225,7 +225,7 @@ public interface Errors { 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_WITH_BODY = DiagnosticFactory0.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_PARAMETER_MUST_BE_CONST = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 66d39a66786..595fa9fdf06 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -790,7 +790,7 @@ public class DefaultErrorMessages { MAP.put(VAR_ANNOTATION_PARAMETER, "An annotation parameter cannot be 'var'"); MAP.put(ANNOTATION_CLASS_CONSTRUCTOR_CALL, "Annotation class cannot be instantiated"); MAP.put(NOT_AN_ANNOTATION_CLASS, "''{0}'' is not an annotation class", NAME); - MAP.put(ANNOTATION_CLASS_WITH_BODY, "Body is not allowed for annotation class"); + MAP.put(ANNOTATION_CLASS_MEMBER, "Members are not allowed in annotation class"); MAP.put(INVALID_TYPE_OF_ANNOTATION_MEMBER, "Invalid type of annotation member"); MAP.put(NULLABLE_TYPE_OF_ANNOTATION_MEMBER, "An annotation parameter cannot be nullable"); MAP.put(ANNOTATION_PARAMETER_MUST_BE_CONST, "An annotation parameter must be a compile-time constant"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt index 6c089b53c09..336b019318d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt @@ -449,7 +449,7 @@ class DeclarationsChecker( } } classDescriptor.kind == ClassKind.ANNOTATION_CLASS -> { - checkAnnotationClassWithBody(aClass) + checkAnnotationClassMembers(aClass) checkValOnAnnotationParameter(aClass) } aClass is KtEnumEntry -> checkEnumEntry(aClass, classDescriptor) @@ -524,8 +524,13 @@ class DeclarationsChecker( } } - private fun checkAnnotationClassWithBody(classOrObject: KtClassOrObject) { - classOrObject.getBody()?.let { trace.report(ANNOTATION_CLASS_WITH_BODY.on(it)) } + private fun checkAnnotationClassMembers(classOrObject: KtClassOrObject) { + for (declaration in classOrObject.declarations) { + if (declaration !is KtClassOrObject || + !languageVersionSettings.supportsFeature(LanguageFeature.NestedClassesInAnnotations)) { + trace.report(ANNOTATION_CLASS_MEMBER.on(declaration)) + } + } } private fun checkValOnAnnotationParameter(aClass: KtClass) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt index 24c6e85afe4..85c8ba68363 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt @@ -158,7 +158,7 @@ object ModifierCheckerCore { PROTECTED_KEYWORD to always(CLASS_ONLY, LOCAL_CLASS, ENUM_CLASS, COMPANION_OBJECT), INTERNAL_KEYWORD to always(CLASS_ONLY, LOCAL_CLASS, OBJECT, OBJECT_LITERAL, ENUM_CLASS, ENUM_ENTRY, FILE), PRIVATE_KEYWORD to always(CLASS_ONLY, LOCAL_CLASS, OBJECT, OBJECT_LITERAL, INTERFACE, ENUM_CLASS, ENUM_ENTRY, FILE), - COMPANION_KEYWORD to always(CLASS_ONLY, ENUM_CLASS, INTERFACE), + COMPANION_KEYWORD to always(CLASS_ONLY, INTERFACE, ENUM_CLASS, ANNOTATION_CLASS), FINAL_KEYWORD to always(CLASS_ONLY, LOCAL_CLASS, OBJECT, OBJECT_LITERAL, ENUM_CLASS, ENUM_ENTRY, ANNOTATION_CLASS, FILE), VARARG_KEYWORD to always(CONSTRUCTOR, FUNCTION, CLASS) ) diff --git a/compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt b/compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt new file mode 100644 index 00000000000..25c4b4546af --- /dev/null +++ b/compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt @@ -0,0 +1,10 @@ +// !LANGUAGE: +NestedClassesInAnnotations + +annotation class Foo(val kind: Kind) { + enum class Kind { FAIL, OK } +} + +@Foo(Foo.Kind.OK) +fun box(): String { + return Foo.Kind.OK.name +} diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt index ed2250bcc44..dc2ceb0f63e 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody.kt @@ -1,28 +1,28 @@ -annotation class Annotation2() { - public val s: String = "" -} +annotation class Annotation2() { + public val s: String = "" +} -annotation class Annotation3() { - public fun foo() {} -} +annotation class Annotation3() { + public fun foo() {} +} -annotation class Annotation4() { - class Foo() {} -} +annotation class Annotation4() { + class Foo() {} +} -annotation class Annotation5() { - companion object {} -} +annotation class Annotation5() { + companion object {} +} -annotation class Annotation6() { - init {} -} +annotation class Annotation6() { + init {} +} -annotation class Annotation1() {} +annotation class Annotation1() {} -annotation class Annotation7(val name: String) {} +annotation class Annotation7(val name: String) {} -annotation class Annotation8(var name: String = "") {} +annotation class Annotation8(var name: String = "") {} annotation class Annotation9(val name: String) diff --git a/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt new file mode 100644 index 00000000000..24fb2eadb87 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt @@ -0,0 +1,23 @@ +// !LANGUAGE: +NestedClassesInAnnotations + +annotation class Foo { + class Nested + + inner class Inner + + enum class E { A, B } + object O + interface I + annotation class Anno(val e: E) + + companion object { + val x = 1 + const val y = "" + } + + + constructor(s: Int) {} + init {} + fun function() {} + val property get() = Unit +} diff --git a/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.txt new file mode 100644 index 00000000000..5fff957c734 --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.txt @@ -0,0 +1,75 @@ +package + +public final annotation class Foo : kotlin.Annotation { + public constructor Foo(/*0*/ s: kotlin.Int) + public final val property: kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun function(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public final annotation class Anno : kotlin.Annotation { + public constructor Anno(/*0*/ e: Foo.E) + public final val e: Foo.E + 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 + } + + public companion object Companion { + private constructor Companion() + public final val x: kotlin.Int = 1 + public const final val y: kotlin.String = "" + 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 + } + + public final enum class E : kotlin.Enum { + enum entry A + + enum entry B + + private constructor E() + public final override /*1*/ /*fake_override*/ val name: kotlin.String + public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int + protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any + public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: Foo.E): kotlin.Int + public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit + public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class! + public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + // Static members + public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): Foo.E + public final /*synthesized*/ fun values(): kotlin.Array + } + + public interface I { + 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 + } + + public final inner class Inner { + public constructor Inner() + 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 + } + + public final class Nested { + public constructor Nested() + 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 + } + + public object O { + private constructor O() + 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/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt index a885363b41a..96770388a9c 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/missingNames.kt @@ -25,9 +25,9 @@ enum class { } -annotation class { +annotation class { -} +} class Outer { fun () { @@ -52,9 +52,9 @@ class Outer { } - annotation class { + annotation class { - } + } } fun outerFun() { diff --git a/compiler/testData/diagnostics/tests/recovery/namelessToplevelDeclarations.kt b/compiler/testData/diagnostics/tests/recovery/namelessToplevelDeclarations.kt index 3768e6f9a09..2074c1a18ca 100644 --- a/compiler/testData/diagnostics/tests/recovery/namelessToplevelDeclarations.kt +++ b/compiler/testData/diagnostics/tests/recovery/namelessToplevelDeclarations.kt @@ -23,4 +23,4 @@ object { enum class {} -annotation class {} \ No newline at end of file +annotation class {} diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.kt index 17ace818ce2..8bad5a18b3e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.kt @@ -1,4 +1,6 @@ +// !LANGUAGE: +NestedClassesInAnnotations // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE + @kotlin.jvm.JvmField fun foo() { @kotlin.jvm.JvmField val x = "A" @@ -110,10 +112,17 @@ open class KKK : K { override final val j: Int = 0 } +annotation class L { + companion object { + @JvmField + var c = 3 + } +} + object O { @JvmField val c = 3 } @JvmField -private val private = 3 \ No newline at end of file +private val private = 3 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.txt index c981bb854f9..369df04519e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmField/jvmFieldApplicability.txt @@ -99,6 +99,21 @@ public open class KKK : K { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +public final annotation class L : kotlin.Annotation { + public constructor L() + 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 + + public companion object Companion { + private constructor Companion() + @kotlin.jvm.JvmField public final var c: 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 + } +} + public object O { private constructor O() @kotlin.jvm.JvmField public final val c: kotlin.Int = 3 diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 5aeae2adfc5..c531a37f670 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -117,6 +117,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } + @TestMetadata("nestedClassesInAnnotations.kt") + public void testNestedClassesInAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt"); + doTest(fileName); + } + @TestMetadata("parameterAnnotationInDefaultImpls.kt") public void testParameterAnnotationInDefaultImpls() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 23b359b46c7..befb198e9e3 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -1151,6 +1151,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("nestedClassesInAnnotations.kt") + public void testNestedClassesInAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt"); + doTest(fileName); + } + @TestMetadata("noNameProperty.kt") public void testNoNameProperty() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/noNameProperty.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 1e6c16789e5..e0fcc23e54a 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -1151,6 +1151,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing doTest(fileName); } + @TestMetadata("nestedClassesInAnnotations.kt") + public void testNestedClassesInAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt"); + doTest(fileName); + } + @TestMetadata("noNameProperty.kt") public void testNoNameProperty() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/noNameProperty.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 4560506325e..712e47652ef 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -117,6 +117,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } + @TestMetadata("nestedClassesInAnnotations.kt") + public void testNestedClassesInAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt"); + doTest(fileName); + } + @TestMetadata("parameterAnnotationInDefaultImpls.kt") public void testParameterAnnotationInDefaultImpls() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index bacba6fb6a1..9af299bfc53 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -129,6 +129,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } + @TestMetadata("nestedClassesInAnnotations.kt") + public void testNestedClassesInAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt"); + doTest(fileName); + } + @TestMetadata("parameterAnnotationInDefaultImpls.kt") public void testParameterAnnotationInDefaultImpls() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt"); diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index 472c6bd6244..ff3fa84e184 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -76,6 +76,7 @@ enum class LanguageFeature( ProhibitInnerClassesOfGenericClassExtendingThrowable(KOTLIN_1_3), ProperVisibilityForCompanionObjectInstanceField(KOTLIN_1_3), ProperForInArrayLoopRangeVariableAssignmentSemantic(KOTLIN_1_3), + NestedClassesInAnnotations(KOTLIN_1_3), StrictJavaNullabilityAssertions(sinceVersion = null, defaultState = State.DISABLED), diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 6d0890bb8fb..e039491302e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -201,6 +201,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); } + @TestMetadata("nestedClassesInAnnotations.kt") + public void testNestedClassesInAnnotations() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt"); + doTest(fileName); + } + @TestMetadata("parameterAnnotationInDefaultImpls.kt") public void testParameterAnnotationInDefaultImpls() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/annotations/parameterAnnotationInDefaultImpls.kt");