From d6406d8d4a02fbdbc9bec5eed0e0097262e77a54 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 23 Jul 2015 12:02:28 +0300 Subject: [PATCH] Annotation repetition checking with a pair of tests, some old tests changes --- .../jetbrains/kotlin/diagnostics/Errors.java | 3 +- .../rendering/DefaultErrorMessages.java | 1 + .../kotlin/resolve/AnnotationTargetChecker.kt | 29 +++++++++++--- .../tests/annotations/options/repeatable.kt | 16 +++++++- .../tests/annotations/options/repeatable.txt | 39 ++++++++++++++++++ .../tests/annotations/options/unrepeatable.kt | 13 ++++++ .../annotations/options/unrepeatable.txt | 40 +++++++++++++++++++ .../tests/inner/classesInClassObjectHeader.kt | 2 +- .../array.kt | 4 +- .../array.txt | 4 +- .../simple.kt | 2 +- .../simple.txt | 2 +- .../vararg.kt | 4 +- .../vararg.txt | 4 +- .../annotations/qualifiedCallValue.kt | 6 +-- .../checkers/JetDiagnosticsTestGenerated.java | 6 +++ idea/testData/checker/AnnotationOnFile.kt | 10 ++--- .../stubBuilder/Annotations/Annotations.kt | 2 +- js/js.libraries/src/jquery/common.kt | 2 - 19 files changed, 159 insertions(+), 30 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/annotations/options/unrepeatable.kt create mode 100644 compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 2a39f3bec73..a3bbb09161e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -113,7 +113,8 @@ public interface Errors { DiagnosticFactory1 REPEATED_MODIFIER = DiagnosticFactory1.create(ERROR); DiagnosticFactory2 REDUNDANT_MODIFIER = DiagnosticFactory2.create(WARNING); DiagnosticFactory0 INAPPLICABLE_PLATFORM_NAME = DiagnosticFactory0.create(ERROR); - DiagnosticFactory1 WRONG_ANNOTATION_TARGET = DiagnosticFactory1.create(ERROR); + DiagnosticFactory1 WRONG_ANNOTATION_TARGET = DiagnosticFactory1.create(ERROR); + DiagnosticFactory0 REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR); // Annotations 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 bbf186a2e52..fe14901d328 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -137,6 +137,7 @@ public class DefaultErrorMessages { MAP.put(REPEATED_MODIFIER, "Repeated ''{0}''", TO_STRING); MAP.put(INAPPLICABLE_PLATFORM_NAME, "platformName annotation is not applicable to this declaration"); MAP.put(WRONG_ANNOTATION_TARGET, "This annotation is not applicable to target ''{0}''", TO_STRING); + MAP.put(REPEATED_ANNOTATION, "This annotation is not repeatable"); MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING); MAP.put(ABSTRACT_MODIFIER_IN_TRAIT, "Modifier ''abstract'' is redundant in interface"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationTargetChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationTargetChecker.kt index 5ae117a54dd..60365fdab78 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationTargetChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationTargetChecker.kt @@ -30,6 +30,7 @@ import org.jetbrains.kotlin.types.TypeUtils import java.lang.annotation.ElementType import java.util.* import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget +import org.jetbrains.kotlin.resolve.constants.BooleanValue import kotlin.annotation public object AnnotationTargetChecker { @@ -37,9 +38,7 @@ public object AnnotationTargetChecker { public fun check(annotated: JetAnnotated, trace: BindingTrace, descriptor: ClassDescriptor? = null) { if (annotated is JetTypeParameter) return // TODO: support type parameter annotations val actualTargets = getActualTargetList(annotated, descriptor) - for (entry in annotated.getAnnotationEntries()) { - checkAnnotationEntry(entry, actualTargets, trace) - } + checkEntries(annotated.annotationEntries, actualTargets, trace) if (annotated is JetCallableDeclaration) { annotated.getTypeReference()?.let { check(it, trace) } } @@ -61,9 +60,7 @@ public object AnnotationTargetChecker { } public fun checkExpression(expression: JetExpression, trace: BindingTrace) { - for (entry in expression.getAnnotationEntries()) { - checkAnnotationEntry(entry, listOf(KotlinTarget.EXPRESSION), trace) - } + checkEntries(expression.getAnnotationEntries(), listOf(KotlinTarget.EXPRESSION), trace) if (expression is JetFunctionLiteralExpression) { for (parameter in expression.getValueParameters()) { parameter.getTypeReference()?.let { check(it, trace) } @@ -71,6 +68,26 @@ public object AnnotationTargetChecker { } } + private fun isRepeatable(classDescriptor: ClassDescriptor): Boolean { + val annotationEntryDescriptor = classDescriptor.annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.annotation) ?: return false + val repeatableArgumentValue = annotationEntryDescriptor.allValueArguments.entrySet().firstOrNull { + "repeatable" == it.key.name.asString() + }?.getValue() as? BooleanValue ?: return false + return repeatableArgumentValue.value + } + + private fun checkEntries(entries: List, actualTargets: List, trace: BindingTrace) { + val entryTypes: MutableSet = hashSetOf() + for (entry in entries) { + checkAnnotationEntry(entry, actualTargets, trace) + val descriptor = trace.get(BindingContext.ANNOTATION, entry) ?: continue + val classDescriptor = TypeUtils.getClassDescriptor(descriptor.type) ?: continue + if (!entryTypes.add(descriptor.type) && !isRepeatable(classDescriptor)) { + trace.report(Errors.REPEATED_ANNOTATION.on(entry)); + } + } + } + public fun possibleTargetSet(classDescriptor: ClassDescriptor): Set? { val targetEntryDescriptor = classDescriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.target) ?: return null diff --git a/compiler/testData/diagnostics/tests/annotations/options/repeatable.kt b/compiler/testData/diagnostics/tests/annotations/options/repeatable.kt index d4080ec2f62..2c327f3dbcd 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/repeatable.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/repeatable.kt @@ -1,3 +1,17 @@ annotation(repeatable = true) class repann -repann repann class DoubleAnnotated \ No newline at end of file +annotation(retention = AnnotationRetention.SOURCE, repeatable = true) class repann1(val x: Int) + +annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class repann2(val f: Boolean) + +target(AnnotationTarget.EXPRESSION) annotation(repeatable = true) class repexpr + +repann repann class DoubleAnnotated + +repann1(1) repann1(2) repann1(3) class TripleAnnotated + +repann2(true) repann2(false) repann2(false) repann2(true) class FourTimesAnnotated + +@repann @repann fun foo(@repann @repann x: Int): Int { + @repexpr @repexpr return x +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt b/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt index a396fa6b17f..55fbbdfa675 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt +++ b/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt @@ -1,5 +1,7 @@ package +repann() repann() internal fun foo(/*0*/ repann() repann() x: kotlin.Int): kotlin.Int + repann() repann() internal final class DoubleAnnotated { public constructor DoubleAnnotated() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -7,9 +9,46 @@ repann() repann() internal final class DoubleAnnotated { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +repann2(f = true) repann2(f = false) repann2(f = false) repann2(f = true) internal final class FourTimesAnnotated { + public constructor FourTimesAnnotated() + 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 +} + +repann1(x = 1) repann1(x = 2) repann1(x = 3) internal final class TripleAnnotated { + public constructor TripleAnnotated() + 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 +} + kotlin.annotation.annotation(repeatable = true) internal final class repann : kotlin.Annotation { public constructor repann() 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 } + +kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class repann1 : kotlin.Annotation { + public constructor repann1(/*0*/ x: kotlin.Int) + internal final val x: 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 +} + +kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class repann2 : kotlin.Annotation { + public constructor repann2(/*0*/ f: kotlin.Boolean) + internal final val f: kotlin.Boolean + 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 +} + +kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation(repeatable = true) internal final class repexpr : kotlin.Annotation { + public constructor repexpr() + 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/annotations/options/unrepeatable.kt b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.kt new file mode 100644 index 00000000000..88cc0fed1ee --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.kt @@ -0,0 +1,13 @@ +annotation(repeatable = false) class unrepann(val x: Int) + +annotation class ann(val y: Int) + +unrepann(1) unrepann(2) class DoubleAnnotated + +ann(3) ann(7) ann(42) class TripleAnnotated + +target(AnnotationTarget.EXPRESSION) annotation class annexpr + +ann(0) ann(1) fun foo(@ann(7) @ann(2) x: Int): Int { + @annexpr @annexpr return x +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt new file mode 100644 index 00000000000..6a5637df7ae --- /dev/null +++ b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt @@ -0,0 +1,40 @@ +package + +ann(y = 0) ann(y = 1) internal fun foo(/*0*/ ann(y = 7) ann(y = 2) x: kotlin.Int): kotlin.Int + +unrepann(x = 1) unrepann(x = 2) internal final class DoubleAnnotated { + public constructor DoubleAnnotated() + 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 +} + +ann(y = 3) ann(y = 7) ann(y = 42) internal final class TripleAnnotated { + public constructor TripleAnnotated() + 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 +} + +kotlin.annotation.annotation() internal final class ann : kotlin.Annotation { + public constructor ann(/*0*/ y: kotlin.Int) + internal final val y: 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 +} + +kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation() internal final class annexpr : kotlin.Annotation { + public constructor annexpr() + 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 +} + +kotlin.annotation.annotation(repeatable = false) internal final class unrepann : kotlin.Annotation { + public constructor unrepann(/*0*/ x: kotlin.Int) + internal final val x: 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/testData/diagnostics/tests/inner/classesInClassObjectHeader.kt b/compiler/testData/diagnostics/tests/inner/classesInClassObjectHeader.kt index 426e478525f..510894438c2 100644 --- a/compiler/testData/diagnostics/tests/inner/classesInClassObjectHeader.kt +++ b/compiler/testData/diagnostics/tests/inner/classesInClassObjectHeader.kt @@ -1,5 +1,5 @@ class Test { - @`InnerAnnotation` @InnerAnnotation + @`InnerAnnotation` @InnerAnnotation companion object : StaticClass(), InnerClass() { } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt index 14abb71eb73..8706a9da0dd 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt @@ -1,4 +1,4 @@ -annotation class Ann(val i: IntArray) +annotation(repeatable = true) class Ann(val i: IntArray) Ann(intArrayOf(i)) Ann(intArrayOf(i2)) @@ -13,7 +13,7 @@ val i3 = foo() fun foo(): Int = 1 -annotation class AnnAnn(val i: Array) +annotation(repeatable = true) class AnnAnn(val i: Array) AnnAnn(arrayOf(Ann(intArrayOf(1)))) AnnAnn(arrayOf(iAnn)) class TestAnn diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt index 559b318378d..b45cf14aca8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt @@ -6,7 +6,7 @@ internal val i3: kotlin.Int internal val iAnn: Ann internal fun foo(): kotlin.Int -kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { +kotlin.annotation.annotation(repeatable = true) internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ i: kotlin.IntArray) internal final val i: kotlin.IntArray public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -14,7 +14,7 @@ kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation() internal final class AnnAnn : kotlin.Annotation { +kotlin.annotation.annotation(repeatable = true) internal final class AnnAnn : kotlin.Annotation { public constructor AnnAnn(/*0*/ i: kotlin.Array) internal final val i: kotlin.Array public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt index 356f62aac1e..f2ebffa977c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt @@ -1,4 +1,4 @@ -annotation class Ann(val i: Int) +annotation(repeatable = true) class Ann(val i: Int) annotation class AnnIA(val ia: IntArray) annotation class AnnSA(val sa: Array) diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt index c97995c25ea..70682abd8df 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt @@ -6,7 +6,7 @@ internal val ia: kotlin.IntArray internal val sa: kotlin.Array internal fun foo(): kotlin.Int -kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { +kotlin.annotation.annotation(repeatable = true) internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ i: kotlin.Int) internal final val i: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt index bbd598e71f8..c7b7d2f9185 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt @@ -1,4 +1,4 @@ -annotation class Ann(vararg val i: Int) +annotation(repeatable = true) class Ann(vararg val i: Int) Ann(i) Ann(i2) @@ -16,7 +16,7 @@ val i3 = foo() fun foo(): Int = 1 -annotation class AnnAnn(vararg val i: Ann) +annotation(repeatable = true) class AnnAnn(vararg val i: Ann) AnnAnn(*arrayOf(Ann(1))) AnnAnn(*arrayOf(iAnn)) class TestAnn diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt index 6621e28bf33..128bec460d6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt @@ -6,7 +6,7 @@ internal val i3: kotlin.Int internal val iAnn: Ann internal fun foo(): kotlin.Int -kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { +kotlin.annotation.annotation(repeatable = true) internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ vararg i: kotlin.Int /*kotlin.IntArray*/) internal final val i: kotlin.IntArray public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -14,7 +14,7 @@ kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation() internal final class AnnAnn : kotlin.Annotation { +kotlin.annotation.annotation(repeatable = true) internal final class AnnAnn : kotlin.Annotation { public constructor AnnAnn(/*0*/ vararg i: Ann /*kotlin.Array*/) internal final val i: kotlin.Array public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/qualifiedCallValue.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/qualifiedCallValue.kt index 3f26304ee03..f861fcc95ba 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/qualifiedCallValue.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/qualifiedCallValue.kt @@ -4,14 +4,14 @@ package a.b.c kotlin.deprecated("aaa") ann1(kotlin.deprecated("aaa")) -a.b.c.ann1() +a.b.c.ann1() ann2(a.b.c.ann1()) A.IAnn() ann3(A.IAnn()) -a.b.c.A.IAnn() -ann3(a.b.c.A.IAnn()) +a.b.c.A.IAnn() +ann3(a.b.c.A.IAnn()) annArray(kotlin.arrayOf("a")) fun test() = 1 diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 3880a5008dc..aeffa27b2eb 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -1040,6 +1040,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("unrepeatable.kt") + public void testUnrepeatable() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/annotations/options/unrepeatable.kt"); + doTest(fileName); + } + @TestMetadata("compiler/testData/diagnostics/tests/annotations/options/targets") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/idea/testData/checker/AnnotationOnFile.kt b/idea/testData/checker/AnnotationOnFile.kt index b7268c4c2c9..3aa74e65ad2 100644 --- a/idea/testData/checker/AnnotationOnFile.kt +++ b/idea/testData/checker/AnnotationOnFile.kt @@ -1,10 +1,10 @@ @file:kotlin.deprecated("message") @file:suppress(BAR) -@file:suppress(BAZ) +@file:suppress(BAZ) -@kotlin.deprecated("message") -@suppress(BAR) -@suppress(BAZ) +@kotlin.deprecated("message") +@suppress(BAR) +@suppress(BAZ) @file:myAnnotation(1, "string") @file:boo.myAnnotation(1, BAR) @@ -20,4 +20,4 @@ val BAZ = "baz" val N = 0 target(AnnotationTarget.FILE) -annotation class myAnnotation(val i: Int, val s: String) +annotation(repeatable = true) class myAnnotation(val i: Int, val s: String) diff --git a/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt b/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt index 6eaf41a5c51..b351531a8da 100644 --- a/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt +++ b/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt @@ -32,6 +32,6 @@ annotation class a target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CLASSIFIER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.TYPE) -annotation(repeatable = false) class b(val e: E) +annotation(repeatable = true) class b(val e: E) enum class E { E1 E2 } \ No newline at end of file diff --git a/js/js.libraries/src/jquery/common.kt b/js/js.libraries/src/jquery/common.kt index 57c03accde6..8bce5e1f14e 100644 --- a/js/js.libraries/src/jquery/common.kt +++ b/js/js.libraries/src/jquery/common.kt @@ -62,12 +62,10 @@ public fun jq(selector: String): JQuery = JQuery(); native("$") public fun jq(selector: String, context: Element): JQuery = JQuery(); native("$") -native("$") public fun jq(callback: () -> Unit): JQuery = JQuery(); native("$") public fun jq(obj: JQuery): JQuery = JQuery(); native("$") public fun jq(el: Element): JQuery = JQuery(); native("$") -native("$") public fun jq(): JQuery = JQuery();