From c15bd2f75d8373ebb4e8c075c869fb7b6f3496ae Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Fri, 2 Mar 2012 20:43:47 +0400 Subject: [PATCH] KT-1490 serialization of constructor parameters --- .../jetbrains/jet/codegen/ImplementationBodyCodegen.java | 4 +++- .../constructor/ConstructorCollectionParameter.kt | 5 +++++ .../constructor/ConstructorCollectionParameter.txt | 6 ++++++ .../constructor/ConstructorCollectionParameter.kt | 8 ++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.kt create mode 100644 compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.txt create mode 100644 compiler/testData/writeSignature/constructor/ConstructorCollectionParameter.kt diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java index dbf357ba540..446762aac84 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ImplementationBodyCodegen.java @@ -516,10 +516,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { } for (ValueParameterDescriptor valueParameter : constructorDescriptor.getValueParameters()) { - JetValueParameterAnnotationWriter jetValueParameterAnnotation = JetValueParameterAnnotationWriter.visitParameterAnnotation(mv, i++); + JetValueParameterAnnotationWriter jetValueParameterAnnotation = JetValueParameterAnnotationWriter.visitParameterAnnotation(mv, i); jetValueParameterAnnotation.writeName(valueParameter.getName()); jetValueParameterAnnotation.writeHasDefaultValue(valueParameter.hasDefaultValue()); + jetValueParameterAnnotation.writeType(constructorMethod.getKotlinParameterType(i)); jetValueParameterAnnotation.visitEnd(); + ++i; } } diff --git a/compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.kt b/compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.kt new file mode 100644 index 00000000000..18bd6c956fb --- /dev/null +++ b/compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.kt @@ -0,0 +1,5 @@ +package test + +import java.util.Collection + +class TestingKotlinCollections(val arguments: Collection) diff --git a/compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.txt b/compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.txt new file mode 100644 index 00000000000..e2bab636486 --- /dev/null +++ b/compiler/testData/readKotlinBinaryClass/constructor/ConstructorCollectionParameter.txt @@ -0,0 +1,6 @@ +namespace test + +final class test.TestingKotlinCollections : jet.Any { + final /*constructor*/ fun (/*0*/ arguments: java.util.Collection): test.TestingKotlinCollections + val arguments: java.util.Collection +} diff --git a/compiler/testData/writeSignature/constructor/ConstructorCollectionParameter.kt b/compiler/testData/writeSignature/constructor/ConstructorCollectionParameter.kt new file mode 100644 index 00000000000..0fcf0d63681 --- /dev/null +++ b/compiler/testData/writeSignature/constructor/ConstructorCollectionParameter.kt @@ -0,0 +1,8 @@ +import java.util.Collection + +class TestingKotlinCollections(val arguments: Collection) + +// method: TestingKotlinCollections:: +// jvm signature: (Ljava/util/Collection;)V +// generic signature: (Ljava/util/Collection;)V +// kotlin signature: (Ljava/util/Collection;)null