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:
Alexander Udalov
2017-02-02 16:13:30 +03:00
parent 81e083a133
commit 0db60bf6cb
34 changed files with 166 additions and 60 deletions
@@ -3,10 +3,10 @@ public final class A {
private final @AnnField @AnnParameterField @AnnTypeField field a: int
private final @AnnField @AnnTypeField field x: int
public method <init>(@AnnParameterProperty @AnnParameterField p0: int): void
private synthetic deprecated static @AnnProperty @AnnFieldProperty @AnnParameterProperty method a$annotations(): void
public synthetic deprecated static @AnnProperty @AnnFieldProperty @AnnParameterProperty method a$annotations(): void
public final method getA(): int
public final method getX(): int
private synthetic deprecated static @AnnProperty @AnnFieldProperty method x$annotations(): void
public synthetic deprecated static @AnnProperty @AnnFieldProperty method x$annotations(): void
}
@kotlin.annotation.Target
@@ -56,4 +56,4 @@ public final class DefaultTargetsKt {
private final static @Anno field p2: int
static method <clinit>(): void
public final static method getP2(): int
}
}
@@ -11,11 +11,11 @@ public final class A {
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final method getX(): int
public final @AnnGetter method getY(): int
private synthetic deprecated static @AnnProp @AnnProp2 method p$annotations(): void
private synthetic deprecated static @AnnProp @AnnProp2 @AnnDelegate method s$annotations(): void
public synthetic deprecated static @AnnProp @AnnProp2 method p$annotations(): void
public synthetic deprecated static @AnnProp @AnnProp2 @AnnDelegate method s$annotations(): void
public final @AnnSetter method setP(@AnnParam p0: int): void
public final @AnnSetter method setY(p0: int): void
private synthetic deprecated static @AnnProp2 method x$annotations(): void
public synthetic deprecated static @AnnProp2 method x$annotations(): void
}
@java.lang.annotation.Retention
@@ -50,4 +50,4 @@ public annotation class AnnSetter
public final class CustomDelegate {
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
}
}