(UltraLightClasses) fast-path for Deprecated.HIDDEN annotation

This commit is contained in:
Vladimir Ilmov
2020-06-08 21:32:32 +02:00
parent 852e860743
commit 40ec794c66
2 changed files with 95 additions and 4 deletions
@@ -33,6 +33,70 @@ class KtLightAnnotationTest : KotlinLightCodeInsightFixtureTestCase() {
override fun getProjectDescriptor(): LightProjectDescriptor =
KotlinJdkAndLibraryProjectDescriptor(ForTestCompileRuntime.runtimeJarForTests())
fun testIsHiddenByDeprecated() {
myFixture.configureByText(
"test.kt", """
import kotlin.DeprecationLevel.WARNING
import kotlin.DeprecationLevel.HIDDEN
import java.lang.annotation.ElementType
import kotlin.DeprecationLevel
import kotlin.annotation.AnnotationTarget
@kotlin.annotation.Target(kotlin.annotation.AnnotationTarget.FUNCTION)
annotation class Dep(
val message: String = "",
val message1: String = "",
val level: DeprecationLevel = DeprecationLevel.WARNING
)
typealias LOL = Deprecated
typealias DL = DeprecationLevel
class A {
@Deprecated("", ReplaceWith("a"), HIDDEN)
fun a() {}
@Deprecated(message = "", level = HIDDEN)
fun b() {}
@Deprecated(message = "", replaceWith = ReplaceWith(""), level = DeprecationLevel.HIDDEN)
fun c() {}
@Deprecated(message = "", replaceWith = ReplaceWith(""), level = DeprecationLevel.WARNING)
fun d() {}
@Deprecated(message = "", replaceWith = ReplaceWith(""), level = WARNING)
fun e() {}
@Deprecated(message = "", replaceWith = ReplaceWith(""))
fun f() {}
@Deprecated("")
fun g() {}
@Deprecated(message = "", level = WARNING)
fun h() {}
@Dep(level = DeprecationLevel.HIDDEN)
fun i() {}
@Dep("", "", DeprecationLevel.HIDDEN)
fun j() {}
@LOL(level = HIDDEN, message="")
fun k() {}
@Deprecated(level = DL.HIDDEN, message="")
fun l() {}
}
""".trimIndent()
)
myFixture.testHighlighting("test.kt")
val methods = myFixture.findClass("A").methods.map { it.name }.sorted()
TestCase.assertEquals(listOf("A","d","e","f","g","h","i","j"), methods)
}
fun testBooleanAnnotationDefaultValue() {
myFixture.addClass(
"""