[Gradle] Add IT that useExperimentalAnnotation produces deprecation warn
#KT-38111 Fixed
This commit is contained in:
+12
@@ -207,4 +207,16 @@ class SimpleKotlinGradleIT : KGPBaseTest() {
|
|||||||
build("assemble")
|
build("assemble")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GradleTest
|
||||||
|
@DisplayName("useExperimentalAnnotation should produce deprecation warning")
|
||||||
|
fun testUseExperimentalAnnotationShouldProduceWarning(gradleVersion: GradleVersion) {
|
||||||
|
project("optInAnnotation", gradleVersion, buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)) {
|
||||||
|
build("assemble") {
|
||||||
|
assertOutputContains("-Xopt-in=kotlin.RequiresOptIn")
|
||||||
|
assertOutputContains("-Xopt-in=FooAnnotation")
|
||||||
|
assertOutputContains("is deprecated and will be removed in next major releases")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
plugins {
|
||||||
|
id "org.jetbrains.kotlin.jvm"
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
languageSettings {
|
||||||
|
useExperimentalAnnotation("kotlin.RequiresOptIn")
|
||||||
|
useExperimentalAnnotation("FooAnnotation")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.BINARY)
|
||||||
|
@RequiresOptIn
|
||||||
|
annotation class FooAnnotation
|
||||||
|
|
||||||
|
@FooAnnotation
|
||||||
|
class FooClass
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
FooClass()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user