[Gradle] Add IT that useExperimentalAnnotation produces deprecation warn

#KT-38111 Fixed
This commit is contained in:
Alexander Likhachev
2021-07-14 15:58:44 +03:00
parent 68ced78d89
commit 7bb4612149
3 changed files with 42 additions and 0 deletions
@@ -207,4 +207,16 @@ class SimpleKotlinGradleIT : KGPBaseTest() {
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")
}
}
}
}
@@ -0,0 +1,19 @@
plugins {
id "org.jetbrains.kotlin.jvm"
}
repositories {
mavenLocal()
mavenCentral()
}
kotlin {
sourceSets {
main {
languageSettings {
useExperimentalAnnotation("kotlin.RequiresOptIn")
useExperimentalAnnotation("FooAnnotation")
}
}
}
}
@@ -0,0 +1,11 @@
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
@RequiresOptIn
annotation class FooAnnotation
@FooAnnotation
class FooClass
fun foo() {
FooClass()
}