Introduce EXPERIMENTAL_ANNOTATION_WITH_WRONG_RETENTION diagnostic
#KT-22941 Fixed
This commit is contained in:
committed by
teamcityserver
parent
7393465696
commit
d8d38862d9
+6
@@ -34327,6 +34327,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noRetentionAfter.kt")
|
||||
public void testNoRetentionAfter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/noRetentionAfter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("override.kt")
|
||||
public void testOverride() throws Exception {
|
||||
|
||||
+6
@@ -34327,6 +34327,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noRetentionAfter.kt")
|
||||
public void testNoRetentionAfter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/noRetentionAfter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("override.kt")
|
||||
public void testOverride() throws Exception {
|
||||
|
||||
@@ -284,6 +284,7 @@ public interface Errors {
|
||||
DiagnosticFactory0<KtAnnotationEntry> USE_EXPERIMENTAL_WITHOUT_ARGUMENTS = DiagnosticFactory0.create(WARNING);
|
||||
DiagnosticFactory1<KtAnnotationEntry, FqName> USE_EXPERIMENTAL_ARGUMENT_IS_NOT_MARKER = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<KtAnnotationEntry, String> EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET = DiagnosticFactory1.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> EXPERIMENTAL_ANNOTATION_WITH_WRONG_RETENTION = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory1<PsiElement, String> EXPERIMENTAL_UNSIGNED_LITERALS = DiagnosticFactory1.create(WARNING);
|
||||
DiagnosticFactory1<PsiElement, String> EXPERIMENTAL_UNSIGNED_LITERALS_ERROR = DiagnosticFactory1.create(ERROR);
|
||||
|
||||
+1
@@ -168,6 +168,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(USE_EXPERIMENTAL_WITHOUT_ARGUMENTS, "@OptIn without any arguments has no effect");
|
||||
MAP.put(USE_EXPERIMENTAL_ARGUMENT_IS_NOT_MARKER, "Annotation ''{0}'' is not an opt-in requirement marker, therefore its usage in @OptIn is ignored", TO_STRING);
|
||||
MAP.put(EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET, "Opt-in requirement marker annotation cannot be used on the following code elements: {0}. Please remove these targets", STRING);
|
||||
MAP.put(EXPERIMENTAL_ANNOTATION_WITH_WRONG_RETENTION, "Opt-in requirement marker annotation cannot be used with SOURCE retention. Please replace retention with BINARY");
|
||||
|
||||
MAP.put(EXPERIMENTAL_UNSIGNED_LITERALS, "{0}", STRING);
|
||||
MAP.put(EXPERIMENTAL_UNSIGNED_LITERALS_ERROR, "{0}", STRING);
|
||||
|
||||
+37
-15
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.resolve.checkers
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinRetention
|
||||
import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.psi.KtAnnotationEntry
|
||||
@@ -19,12 +20,17 @@ import org.jetbrains.kotlin.resolve.constants.ArrayValue
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.resolve.constants.KClassValue
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.getAnnotationRetention
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
class ExperimentalMarkerDeclarationAnnotationChecker(private val module: ModuleDescriptor) : AdditionalAnnotationChecker {
|
||||
private val WRONG_TARGETS_FOR_MARKER = setOf(KotlinTarget.EXPRESSION, KotlinTarget.FILE)
|
||||
|
||||
override fun checkEntries(entries: List<KtAnnotationEntry>, actualTargets: List<KotlinTarget>, trace: BindingTrace) {
|
||||
override fun checkEntries(
|
||||
entries: List<KtAnnotationEntry>,
|
||||
actualTargets: List<KotlinTarget>,
|
||||
trace: BindingTrace
|
||||
) {
|
||||
var isAnnotatedWithExperimental = false
|
||||
|
||||
for (entry in entries) {
|
||||
@@ -43,7 +49,7 @@ class ExperimentalMarkerDeclarationAnnotationChecker(private val module: ModuleD
|
||||
}
|
||||
|
||||
if (isAnnotatedWithExperimental) {
|
||||
checkMarkerTargets(entries, trace)
|
||||
checkMarkerTargetsAndRetention(entries, trace)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,19 +72,35 @@ class ExperimentalMarkerDeclarationAnnotationChecker(private val module: ModuleD
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkMarkerTargets(entries: List<KtAnnotationEntry>, trace: BindingTrace) {
|
||||
val targetEntry =
|
||||
entries.associate { entry -> entry to trace.bindingContext.get(BindingContext.ANNOTATION, entry) }
|
||||
.entries
|
||||
.firstOrNull { (_, descriptor) -> descriptor != null && descriptor.fqName == StandardNames.FqNames.target }
|
||||
?: return
|
||||
val (entry, descriptor) = targetEntry
|
||||
val allowedTargets = AnnotationChecker.loadAnnotationTargets(descriptor!!) ?: return
|
||||
val wrongTargets = allowedTargets.intersect(WRONG_TARGETS_FOR_MARKER)
|
||||
if (wrongTargets.isNotEmpty()) {
|
||||
trace.report(
|
||||
Errors.EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET.on(entry, wrongTargets.joinToString(transform = KotlinTarget::description))
|
||||
)
|
||||
private fun checkMarkerTargetsAndRetention(
|
||||
entries: List<KtAnnotationEntry>,
|
||||
trace: BindingTrace
|
||||
) {
|
||||
val associatedEntries = entries.associateWith { entry -> trace.bindingContext.get(BindingContext.ANNOTATION, entry) }.entries
|
||||
val targetEntry = associatedEntries.firstOrNull { (_, descriptor) ->
|
||||
descriptor?.fqName == StandardNames.FqNames.target
|
||||
}
|
||||
if (targetEntry != null) {
|
||||
val (entry, descriptor) = targetEntry
|
||||
val allowedTargets = AnnotationChecker.loadAnnotationTargets(descriptor!!) ?: return
|
||||
val wrongTargets = allowedTargets.intersect(WRONG_TARGETS_FOR_MARKER)
|
||||
if (wrongTargets.isNotEmpty()) {
|
||||
trace.report(
|
||||
Errors.EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET.on(
|
||||
entry,
|
||||
wrongTargets.joinToString(transform = KotlinTarget::description)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val retentionEntry = associatedEntries.firstOrNull { (_, descriptor) ->
|
||||
descriptor?.fqName == StandardNames.FqNames.retention
|
||||
}
|
||||
if (retentionEntry != null) {
|
||||
val (entry, descriptor) = retentionEntry
|
||||
if (descriptor?.getAnnotationRetention() == KotlinRetention.SOURCE) {
|
||||
trace.report(Errors.EXPERIMENTAL_ANNOTATION_WITH_WRONG_RETENTION.on(entry))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package org.test
|
||||
|
||||
@Deprecated("Warning1", level = DeprecationLevel.WARNING)
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Warning1
|
||||
|
||||
@Deprecated("Warning2", level = DeprecationLevel.WARNING)
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Warning2
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.test
|
||||
|
||||
class Outer {
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Nested
|
||||
}
|
||||
|
||||
|
||||
@@ -7,11 +7,13 @@ package api
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS,
|
||||
AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS,
|
||||
AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class EAnno
|
||||
|
||||
// FILE: usage-propagate.kt
|
||||
|
||||
@@ -7,11 +7,13 @@ package api
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS,
|
||||
AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS,
|
||||
AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class EAnno
|
||||
|
||||
// FILE: usage-propagate.kt
|
||||
|
||||
@@ -2,14 +2,14 @@ package
|
||||
|
||||
package api {
|
||||
|
||||
@api.ExperimentalAPI @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) public final annotation class EAnno : kotlin.Annotation {
|
||||
@api.ExperimentalAPI @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class EAnno : kotlin.Annotation {
|
||||
public constructor EAnno()
|
||||
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.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
interface I
|
||||
|
||||
@@ -2,7 +2,7 @@ package
|
||||
|
||||
package api {
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class API
|
||||
|
||||
@API
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class API
|
||||
|
||||
@API
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package
|
||||
package api {
|
||||
@api.API public fun f(): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class API : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class API : kotlin.Annotation {
|
||||
public constructor API()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ package api {
|
||||
}
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
Vendored
+1
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
Vendored
+1
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ package api {
|
||||
}
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
@@ -11,7 +11,7 @@ package api {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
+1
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ package api {
|
||||
}
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E
|
||||
|
||||
open class Base {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E
|
||||
|
||||
open class Base {
|
||||
|
||||
@@ -10,7 +10,7 @@ package api {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class E : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E : kotlin.Annotation {
|
||||
public constructor 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
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// FILE: api.kt
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Marker
|
||||
|
||||
@Marker
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// FILE: api.kt
|
||||
|
||||
@<!EXPERIMENTAL_IS_NOT_ENABLED!>RequiresOptIn<!>
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Marker
|
||||
|
||||
@Marker
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ public fun use1(): kotlin.Unit
|
||||
@Marker public fun use2(): kotlin.Unit
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public fun use3(): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class Marker : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class Marker : kotlin.Annotation {
|
||||
public constructor Marker()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -7,6 +7,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ package
|
||||
package api {
|
||||
@api.ExperimentalAPI public fun function(): kotlin.String
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package test.abc
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E
|
||||
|
||||
@OptIn(test.abc.E::class)
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ package test {
|
||||
@kotlin.OptIn(markerClass = {test.abc.E::class}) public fun f(): kotlin.Unit
|
||||
@test.abc.E public fun g(): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class E : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E : kotlin.Annotation {
|
||||
public constructor 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
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package feature.experimental.self
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ImportedMarker
|
||||
|
||||
@ImportedMarker
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ package feature {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class ImportedMarker : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ImportedMarker : kotlin.Annotation {
|
||||
public constructor ImportedMarker()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ import kotlin.annotation.AnnotationTarget.*
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(CLASS, ANNOTATION_CLASS, TYPE_PARAMETER, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION,
|
||||
PROPERTY_GETTER, PROPERTY_SETTER, TYPE, TYPEALIAS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
|
||||
+3
-2
@@ -8,6 +8,7 @@ import kotlin.annotation.AnnotationTarget.*
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(CLASS, ANNOTATION_CLASS, TYPE_PARAMETER, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION,
|
||||
PROPERTY_GETTER, PROPERTY_SETTER, TYPE, TYPEALIAS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@@ -16,10 +17,10 @@ annotation class E2
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET!>@Target(EXPRESSION)<!>
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_RETENTION!>@Retention(AnnotationRetention.SOURCE)<!>
|
||||
annotation class E3
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_TARGET!>@Target(FILE, EXPRESSION)<!>
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
<!EXPERIMENTAL_ANNOTATION_WITH_WRONG_RETENTION!>@Retention(AnnotationRetention.SOURCE)<!>
|
||||
annotation class E4
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package
|
||||
|
||||
package api {
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS}) public final annotation class E1 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.TYPEALIAS}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E1 : kotlin.Annotation {
|
||||
public constructor E1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
@RequiresOptIn
|
||||
annotation class ExperimentalAPI
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
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
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E
|
||||
|
||||
open class Base {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E
|
||||
|
||||
open class Base {
|
||||
|
||||
@@ -18,7 +18,7 @@ package api {
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class E : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E : kotlin.Annotation {
|
||||
public constructor 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
|
||||
|
||||
compiler/testData/diagnostics/testsWithStdLib/experimental/overrideDifferentExperimentalities.fir.kt
Vendored
+3
@@ -1,8 +1,11 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E3
|
||||
|
||||
interface Base1 {
|
||||
|
||||
Vendored
+3
@@ -1,8 +1,11 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E3
|
||||
|
||||
interface Base1 {
|
||||
|
||||
Vendored
+2
-2
@@ -45,14 +45,14 @@ public final class DerivedC : Base1, Base2, Base3 {
|
||||
public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class E1 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E1 : kotlin.Annotation {
|
||||
public constructor E1()
|
||||
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.RequiresOptIn(level = Level.WARNING) public final annotation class E3 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E3 : kotlin.Annotation {
|
||||
public constructor E3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -7,6 +7,7 @@ package api
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS,
|
||||
AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
@@ -7,6 +7,7 @@ package api
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS,
|
||||
AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
@@ -4,7 +4,7 @@ package api {
|
||||
@api.ExperimentalAPI public val property: kotlin.String = ""
|
||||
@api.ExperimentalAPI public fun function(): kotlin.String
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.TYPEALIAS, AnnotationTarget.VALUE_PARAMETER}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
@RequiresOptIn
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
@@ -2,7 +2,7 @@ package
|
||||
|
||||
package api {
|
||||
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ import kotlin.RequiresOptIn
|
||||
// Usages with FQ names should be OK
|
||||
|
||||
@kotlin.RequiresOptIn(level = kotlin.RequiresOptIn.Level.ERROR)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class M
|
||||
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ import kotlin.RequiresOptIn
|
||||
// Usages with FQ names should be OK
|
||||
|
||||
@kotlin.RequiresOptIn(level = kotlin.RequiresOptIn.Level.ERROR)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class M
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ package test {
|
||||
public fun f8(): test.Marker?
|
||||
public fun f9(/*0*/ m: test.Marker0 /* = test.Marker */): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.ERROR) public final annotation class M : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.ERROR) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class M : kotlin.Annotation {
|
||||
public constructor M()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+2
@@ -5,10 +5,12 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI2
|
||||
|
||||
@ExperimentalAPI1
|
||||
|
||||
+2
@@ -5,10 +5,12 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI2
|
||||
|
||||
@ExperimentalAPI1
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@ package api {
|
||||
@api.ExperimentalAPI1 public fun compilation(): kotlin.Unit
|
||||
@api.ExperimentalAPI2 public fun runtime(): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI1 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI1 : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI1()
|
||||
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.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class ExperimentalAPI2 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI2 : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI2()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+2
@@ -5,10 +5,12 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class VeryExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@ package api {
|
||||
@api.ExperimentalAPI @api.VeryExperimentalAPI public fun f(): kotlin.Unit
|
||||
@api.ExperimentalAPI public fun g(): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
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
|
||||
}
|
||||
|
||||
@api.ExperimentalAPI @kotlin.RequiresOptIn(level = Level.WARNING) public final annotation class VeryExperimentalAPI : kotlin.Annotation {
|
||||
@api.ExperimentalAPI @kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class VeryExperimentalAPI : kotlin.Annotation {
|
||||
public constructor VeryExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class ExperimentalAPI
|
||||
|
||||
@ExperimentalAPI
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ package
|
||||
package api {
|
||||
@api.ExperimentalAPI public fun function(): kotlin.String
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.ERROR) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.ERROR) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class ExperimentalAPI : kotlin.Annotation {
|
||||
public constructor ExperimentalAPI()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E
|
||||
|
||||
@E
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public final class Constructor {
|
||||
|
||||
package api {
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) public final annotation class E : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E : kotlin.Annotation {
|
||||
public constructor 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
|
||||
|
||||
+3
@@ -5,14 +5,17 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E2
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E3
|
||||
|
||||
@E1
|
||||
|
||||
Vendored
+3
@@ -5,14 +5,17 @@ package api
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E1
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E2
|
||||
|
||||
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class E3
|
||||
|
||||
@E1
|
||||
|
||||
compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalWithSeveralAnnotations.txt
Vendored
+3
-3
@@ -5,21 +5,21 @@ package api {
|
||||
@api.E2 public fun e2(): kotlin.Unit
|
||||
@api.E3 public fun e3(): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E1 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E1 : kotlin.Annotation {
|
||||
public constructor E1()
|
||||
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.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E2 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E2 : kotlin.Annotation {
|
||||
public constructor E2()
|
||||
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.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) public final annotation class E3 : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn(level = Level.WARNING) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.FUNCTION}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class E3 : kotlin.Annotation {
|
||||
public constructor E3()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
+1
@@ -7,6 +7,7 @@ fun newPublishedFun() {}
|
||||
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Marker
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
|
||||
@@ -7,6 +7,7 @@ fun newPublishedFun() {}
|
||||
|
||||
|
||||
@RequiresOptIn
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
annotation class Marker
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ public fun use1(/*0*/ c1: NewClassExperimentalInThePast, /*1*/ t1: TypeAliasToNe
|
||||
@kotlin.OptIn(markerClass = {Marker::class}) public fun use2(/*0*/ c2: NewClassExperimentalInThePast, /*1*/ t2: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit
|
||||
@Marker public fun use3(/*0*/ c3: NewClassExperimentalInThePast, /*1*/ t3: TypeAliasToNewClass /* = NewClassExperimentalInThePast */): kotlin.Unit
|
||||
|
||||
@kotlin.RequiresOptIn public final annotation class Marker : kotlin.Annotation {
|
||||
@kotlin.RequiresOptIn @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class Marker : kotlin.Annotation {
|
||||
public constructor Marker()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
|
||||
Generated
+6
@@ -34423,6 +34423,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noRetentionAfter.kt")
|
||||
public void testNoRetentionAfter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/noRetentionAfter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("override.kt")
|
||||
public void testOverride() throws Exception {
|
||||
|
||||
@@ -207,9 +207,11 @@ fun Annotated.isDocumentedAnnotation(): Boolean =
|
||||
annotations.findAnnotation(StandardNames.FqNames.mustBeDocumented) != null
|
||||
|
||||
fun Annotated.getAnnotationRetention(): KotlinRetention? {
|
||||
val retentionArgumentValue =
|
||||
annotations.findAnnotation(StandardNames.FqNames.retention)?.allValueArguments?.get(RETENTION_PARAMETER_NAME)
|
||||
as? EnumValue ?: return null
|
||||
return annotations.findAnnotation(StandardNames.FqNames.retention)?.getAnnotationRetention()
|
||||
}
|
||||
|
||||
fun AnnotationDescriptor.getAnnotationRetention(): KotlinRetention? {
|
||||
val retentionArgumentValue = allValueArguments[RETENTION_PARAMETER_NAME] as? EnumValue ?: return null
|
||||
|
||||
val retentionArgumentValueName = retentionArgumentValue.enumEntryName.asString()
|
||||
return KotlinRetention.values().firstOrNull { it.name == retentionArgumentValueName }
|
||||
|
||||
+5
@@ -30141,6 +30141,11 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/incorrectUseExperimental.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noRetentionAfter.kt")
|
||||
public void testNoRetentionAfter() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/noRetentionAfter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("override.kt")
|
||||
public void testOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/experimental/override.kt");
|
||||
|
||||
Reference in New Issue
Block a user