Do not always generate synthetic "$annotations" as private
Since annotations are a part of the declaration, they must have the same visibility as the declaration in the bytecode. Otherwise obfuscators like Proguard might strip the "$annotations" method and no annotations would be found via Kotlin reflection #KT-15993 Fixed
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
class Foo {
|
||||
annotation class Anno
|
||||
|
||||
@Anno
|
||||
private val prop = 42
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Foo, prop$annotations
|
||||
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PRIVATE
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
open class Foo {
|
||||
annotation class Anno
|
||||
|
||||
@Anno
|
||||
protected val prop = 42
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Foo, prop$annotations
|
||||
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PROTECTED
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Foo {
|
||||
annotation class Anno
|
||||
|
||||
@Anno
|
||||
val prop = 42
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Foo, prop$annotations
|
||||
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PUBLIC
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
@Target(AnnotationTarget.TYPEALIAS)
|
||||
annotation class Anno
|
||||
|
||||
@Anno
|
||||
private typealias Foo = String
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: PrivateTypealiasKt, Foo$annotations
|
||||
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PRIVATE
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
@Target(AnnotationTarget.TYPEALIAS)
|
||||
annotation class Anno
|
||||
|
||||
@Anno
|
||||
typealias Foo = String
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: PublicTypealiasKt, Foo$annotations
|
||||
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PUBLIC
|
||||
Reference in New Issue
Block a user