Don't generate annotations on synthetic accessor parameters
This commit is contained in:
@@ -509,17 +509,16 @@ public class FunctionCodegen {
|
||||
@NotNull InnerClassConsumer innerClassConsumer,
|
||||
@NotNull GenerationState state
|
||||
) {
|
||||
if (isAccessor(functionDescriptor)) return;
|
||||
KotlinTypeMapper typeMapper = state.getTypeMapper();
|
||||
Iterator<ValueParameterDescriptor> iterator = valueParameters.iterator();
|
||||
List<JvmMethodParameterSignature> kotlinParameterTypes = jvmSignature.getValueParameters();
|
||||
boolean isAccessor = isAccessor(functionDescriptor);
|
||||
|
||||
for (int i = 0; i < kotlinParameterTypes.size(); i++) {
|
||||
JvmMethodParameterSignature parameterSignature = kotlinParameterTypes.get(i);
|
||||
JvmMethodParameterKind kind = parameterSignature.getKind();
|
||||
if (kind.isSkippedInGenericSignature()) {
|
||||
if (!isAccessor)
|
||||
markEnumOrInnerConstructorParameterAsSynthetic(mv, i, state.getClassBuilderMode());
|
||||
markEnumOrInnerConstructorParameterAsSynthetic(mv, i, state.getClassBuilderMode());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
annotation class Ann
|
||||
|
||||
class Foo private @Ann constructor(@Ann s: String) {
|
||||
|
||||
@Ann
|
||||
private fun foo(@Ann s: String) {}
|
||||
|
||||
companion object {
|
||||
fun foo() {
|
||||
Foo("123").foo("456")
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
@java.lang.annotation.Retention
|
||||
@kotlin.Metadata
|
||||
public annotation class Ann
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo$Companion {
|
||||
inner class Foo$Companion
|
||||
private method <init>(): void
|
||||
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public final method foo(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
public final static field Companion: Foo$Companion
|
||||
inner class Foo$Companion
|
||||
static method <clinit>(): void
|
||||
private @Ann method <init>(@Ann p0: java.lang.String): void
|
||||
public synthetic method <init>(p0: java.lang.String, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public synthetic final static method access$foo(p0: Foo, p1: java.lang.String): void
|
||||
private final @Ann method foo(@Ann p0: java.lang.String): void
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ public abstract class Sealed {
|
||||
inner class Sealed$Derived
|
||||
inner class Sealed$Inner
|
||||
private @Ann method <init>(@Ann p0: int): void
|
||||
public synthetic method <init>(@Ann p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public synthetic method <init>(p0: int, p1: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
public final method getZ(): int
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -210,6 +210,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/noAdditionalAnnotationsInAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAnnotationsInSyntheticAccessors.kt")
|
||||
public void testNoAnnotationsInSyntheticAccessors() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/noAnnotationsInSyntheticAccessors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("onProperties.kt")
|
||||
public void testOnProperties() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/annotations/onProperties.kt");
|
||||
|
||||
Reference in New Issue
Block a user