From dd50438c786bbcf6e21d42ed3fae0ced092b325b Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 22 Oct 2013 21:23:53 +0400 Subject: [PATCH] Deserialize annotations on property setter parameters --- .../serialization/src/descriptors.proto | 2 +- .../serialization/DescriptorDeserializer.java | 20 +- .../serialization/DescriptorSerializer.java | 10 +- .../descriptors/serialization/ProtoBuf.java | 277 +++++++++--------- .../serialization/TypeDeserializer.java | 22 +- .../descriptors/AnnotationDeserializer.java | 2 + compiler/testData/cli/wrongAbiVersion.out | 4 +- .../parameters/ExtensionPropertySetter.kt | 9 + .../parameters/ExtensionPropertySetter.txt | 12 + .../parameters/PropertySetterInClass.kt | 9 + .../parameters/PropertySetterInClass.txt | 12 + .../parameters/TopLevelPropertySetter.kt | 8 + .../parameters/TopLevelPropertySetter.txt | 13 + .../LoadCompiledKotlinTestGenerated.java | 15 + ...esolveNamespaceComparingTestGenerated.java | 15 + .../jet/lang/resolve/java/JvmAbi.java | 2 +- .../AnnotationDescriptorDeserializer.java | 7 +- 17 files changed, 271 insertions(+), 168 deletions(-) create mode 100644 compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.kt create mode 100644 compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.txt create mode 100644 compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.kt create mode 100644 compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.txt create mode 100644 compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.kt create mode 100644 compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.txt diff --git a/compiler/frontend/serialization/src/descriptors.proto b/compiler/frontend/serialization/src/descriptors.proto index 60f5f829864..ce4f3ffc5d1 100644 --- a/compiler/frontend/serialization/src/descriptors.proto +++ b/compiler/frontend/serialization/src/descriptors.proto @@ -171,7 +171,6 @@ message Callable { */ optional int32 getter_flags = 9 /* absent => same as property */; optional int32 setter_flags = 10 /* absent => same as property */; - optional int32 setter_parameter_name = 11; repeated TypeParameter type_parameter = 4; @@ -192,6 +191,7 @@ message Callable { extensions 100 to 199; } + // Value parameters for functions and constructors, or setter value parameter for properties repeated ValueParameter value_parameter = 7; required Type return_type = 8; diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java index b114f30d3f6..f78bb97fdf8 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java @@ -176,10 +176,11 @@ public class DescriptorDeserializer { modality(Flags.MODALITY.get(setterFlags)), visibility(Flags.VISIBILITY.get(setterFlags)), isNotDefault, !isNotDefault, property.getKind() ); - setter.initialize(new ValueParameterDescriptorImpl( - setter, 0, Collections.emptyList(), - nameResolver.getName(proto.getSetterParameterName()), - property.getReturnType(), false, null)); + DescriptorDeserializer setterLocal = local.createChildDeserializer(setter, Collections.emptyList(), + Collections.emptyList()); + List valueParameters = setterLocal.valueParameters(proto, AnnotatedCallableKind.PROPERTY_SETTER); + assert valueParameters.size() == 1 : "Property setter should have a single value parameter: " + setter; + setter.initialize(valueParameters.get(0)); } else { setter = DescriptorFactory.createDefaultSetter(property); @@ -237,7 +238,7 @@ public class DescriptorDeserializer { local.typeDeserializer.typeOrNull(proto.hasReceiverType() ? proto.getReceiverType() : null), getExpectedThisObject(), typeParameters, - local.valueParameters(proto), + local.valueParameters(proto, AnnotatedCallableKind.FUNCTION), local.typeDeserializer.type(proto.getReturnType()), modality(Flags.MODALITY.get(flags)), visibility(Flags.VISIBILITY.get(flags)), @@ -265,7 +266,7 @@ public class DescriptorDeserializer { DescriptorDeserializer local = createChildDeserializer(descriptor, Collections.emptyList(), typeParameters); descriptor.initialize( classDescriptor.getTypeConstructor().getParameters(), - local.valueParameters(proto), + local.valueParameters(proto, AnnotatedCallableKind.FUNCTION), visibility(Flags.VISIBILITY.get(proto.getFlags())), DescriptorUtils.isConstructorOfStaticNestedClass(descriptor) ); @@ -384,7 +385,7 @@ public class DescriptorDeserializer { } @NotNull - private List valueParameters(@NotNull Callable callable) { + private List valueParameters(@NotNull Callable callable, @NotNull AnnotatedCallableKind kind) { DeclarationDescriptor containerOfCallable = containingDeclaration.getContainingDeclaration(); assert containerOfCallable instanceof ClassOrNamespaceDescriptor : "Only members in classes or namespaces should be serialized: " + containerOfCallable; @@ -397,7 +398,7 @@ public class DescriptorDeserializer { result.add(new ValueParameterDescriptorImpl( containingDeclaration, i, - getAnnotations(classOrNamespace, callable, proto), + getAnnotations(classOrNamespace, callable, kind, proto), nameResolver.getName(proto.getName()), typeDeserializer.type(proto.getType()), Flags.DECLARES_DEFAULT_VALUE.get(proto.getFlags()), @@ -411,10 +412,11 @@ public class DescriptorDeserializer { private List getAnnotations( @NotNull ClassOrNamespaceDescriptor classOrNamespace, @NotNull Callable callable, + @NotNull AnnotatedCallableKind kind, @NotNull Callable.ValueParameter valueParameter ) { return Flags.HAS_ANNOTATIONS.get(valueParameter.getFlags()) - ? annotationDeserializer.loadValueParameterAnnotations(classOrNamespace, callable, nameResolver, valueParameter) + ? annotationDeserializer.loadValueParameterAnnotations(classOrNamespace, callable, nameResolver, kind, valueParameter) : Collections.emptyList(); } } diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java index a88c73e6cec..d06df0d9cfc 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java @@ -145,6 +145,8 @@ public class DescriptorSerializer { public ProtoBuf.Callable.Builder callableProto(@NotNull CallableMemberDescriptor descriptor) { ProtoBuf.Callable.Builder builder = ProtoBuf.Callable.newBuilder(); + DescriptorSerializer local = createChildSerializer(); + boolean hasGetter = false; boolean hasSetter = false; if (descriptor instanceof PropertyDescriptor) { @@ -175,9 +177,9 @@ public class DescriptorSerializer { } if (!setter.isDefault()) { - List parameters = setter.getValueParameters(); - assert parameters.size() == 1 : "Unexpected number of setter parameters: " + setter; - builder.setSetterParameterName(nameTable.getSimpleNameIndex(parameters.get(0).getName())); + for (ValueParameterDescriptor valueParameterDescriptor : setter.getValueParameters()) { + builder.addValueParameter(local.valueParameter(valueParameterDescriptor)); + } } } } @@ -195,8 +197,6 @@ public class DescriptorSerializer { )); //TODO builder.setExtraVisibility() - DescriptorSerializer local = createChildSerializer(); - for (TypeParameterDescriptor typeParameterDescriptor : descriptor.getTypeParameters()) { builder.addTypeParameter(local.typeParameter(typeParameterDescriptor)); } diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java index 13b697c6890..7f779dae45c 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java @@ -7125,16 +7125,6 @@ public final class ProtoBuf { */ int getSetterFlags(); - // optional int32 setter_parameter_name = 11; - /** - * optional int32 setter_parameter_name = 11; - */ - boolean hasSetterParameterName(); - /** - * optional int32 setter_parameter_name = 11; - */ - int getSetterParameterName(); - // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 4; /** * repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 4; @@ -7173,15 +7163,27 @@ public final class ProtoBuf { // repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ java.util.List getValueParameterList(); /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter getValueParameter(int index); /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ int getValueParameterCount(); @@ -7249,16 +7251,16 @@ public final class ProtoBuf { break; } case 34: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { typeParameter_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; + mutable_bitField0_ |= 0x00000010; } typeParameter_.add(input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.TypeParameter.PARSER, extensionRegistry)); break; } case 42: { org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder subBuilder = null; - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { subBuilder = receiverType_.toBuilder(); } receiverType_ = input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.PARSER, extensionRegistry); @@ -7266,25 +7268,25 @@ public final class ProtoBuf { subBuilder.mergeFrom(receiverType_); receiverType_ = subBuilder.buildPartial(); } - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000010; break; } case 48: { - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000020; name_ = input.readInt32(); break; } case 58: { - if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { + if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) { valueParameter_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000100; + mutable_bitField0_ |= 0x00000080; } valueParameter_.add(input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter.PARSER, extensionRegistry)); break; } case 66: { org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder subBuilder = null; - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { subBuilder = returnType_.toBuilder(); } returnType_ = input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.PARSER, extensionRegistry); @@ -7292,7 +7294,7 @@ public final class ProtoBuf { subBuilder.mergeFrom(returnType_); returnType_ = subBuilder.buildPartial(); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000040; break; } case 72: { @@ -7305,11 +7307,6 @@ public final class ProtoBuf { setterFlags_ = input.readInt32(); break; } - case 88: { - bitField0_ |= 0x00000010; - setterParameterName_ = input.readInt32(); - break; - } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -7318,10 +7315,10 @@ public final class ProtoBuf { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_); } - if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { + if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) { valueParameter_ = java.util.Collections.unmodifiableList(valueParameter_); } makeExtensionsImmutable(); @@ -8405,22 +8402,6 @@ public final class ProtoBuf { return setterFlags_; } - // optional int32 setter_parameter_name = 11; - public static final int SETTER_PARAMETER_NAME_FIELD_NUMBER = 11; - private int setterParameterName_; - /** - * optional int32 setter_parameter_name = 11; - */ - public boolean hasSetterParameterName() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional int32 setter_parameter_name = 11; - */ - public int getSetterParameterName() { - return setterParameterName_; - } - // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 4; public static final int TYPE_PARAMETER_FIELD_NUMBER = 4; private java.util.List typeParameter_; @@ -8464,7 +8445,7 @@ public final class ProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.Type receiver_type = 5; */ public boolean hasReceiverType() { - return ((bitField0_ & 0x00000020) == 0x00000020); + return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional .org.jetbrains.jet.descriptors.serialization.Type receiver_type = 5; @@ -8480,7 +8461,7 @@ public final class ProtoBuf { * required int32 name = 6; */ public boolean hasName() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000020) == 0x00000020); } /** * required int32 name = 6; @@ -8494,12 +8475,20 @@ public final class ProtoBuf { private java.util.List valueParameter_; /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ public java.util.List getValueParameterList() { return valueParameter_; } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ public java.util.List getValueParameterOrBuilderList() { @@ -8507,18 +8496,30 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ public int getValueParameterCount() { return valueParameter_.size(); } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter getValueParameter(int index) { return valueParameter_.get(index); } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+     * Value parameters for functions and constructors, or setter value parameter for properties
+     * 
*/ public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameterOrBuilder getValueParameterOrBuilder( int index) { @@ -8532,7 +8533,7 @@ public final class ProtoBuf { * required .org.jetbrains.jet.descriptors.serialization.Type return_type = 8; */ public boolean hasReturnType() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000040) == 0x00000040); } /** * required .org.jetbrains.jet.descriptors.serialization.Type return_type = 8; @@ -8546,7 +8547,6 @@ public final class ProtoBuf { extraVisibility_ = ""; getterFlags_ = 0; setterFlags_ = 0; - setterParameterName_ = 0; typeParameter_ = java.util.Collections.emptyList(); receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); name_ = 0; @@ -8611,16 +8611,16 @@ public final class ProtoBuf { for (int i = 0; i < typeParameter_.size(); i++) { output.writeMessage(4, typeParameter_.get(i)); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeMessage(5, receiverType_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt32(6, name_); } for (int i = 0; i < valueParameter_.size(); i++) { output.writeMessage(7, valueParameter_.get(i)); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeMessage(8, returnType_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { @@ -8629,9 +8629,6 @@ public final class ProtoBuf { if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt32(10, setterFlags_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeInt32(11, setterParameterName_); - } extensionWriter.writeUntil(200, output); } @@ -8653,11 +8650,11 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, typeParameter_.get(i)); } - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, receiverType_); } - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(6, name_); } @@ -8665,7 +8662,7 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeMessageSize(7, valueParameter_.get(i)); } - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(8, returnType_); } @@ -8677,10 +8674,6 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeInt32Size(10, setterFlags_); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(11, setterParameterName_); - } size += extensionsSerializedSize(); memoizedSerializedSize = size; return size; @@ -8780,18 +8773,16 @@ public final class ProtoBuf { bitField0_ = (bitField0_ & ~0x00000004); setterFlags_ = 0; bitField0_ = (bitField0_ & ~0x00000008); - setterParameterName_ = 0; - bitField0_ = (bitField0_ & ~0x00000010); typeParameter_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); name_ = 0; - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); valueParameter_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000080); returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000200); + bitField0_ = (bitField0_ & ~0x00000100); return this; } @@ -8831,30 +8822,26 @@ public final class ProtoBuf { to_bitField0_ |= 0x00000008; } result.setterFlags_ = setterFlags_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.setterParameterName_ = setterParameterName_; - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); } result.typeParameter_ = typeParameter_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000010; + } + result.receiverType_ = receiverType_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000020; } - result.receiverType_ = receiverType_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000040; - } result.name_ = name_; - if (((bitField0_ & 0x00000100) == 0x00000100)) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { valueParameter_ = java.util.Collections.unmodifiableList(valueParameter_); - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000080); } result.valueParameter_ = valueParameter_; - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { - to_bitField0_ |= 0x00000080; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000040; } result.returnType_ = returnType_; result.bitField0_ = to_bitField0_; @@ -8877,13 +8864,10 @@ public final class ProtoBuf { if (other.hasSetterFlags()) { setSetterFlags(other.getSetterFlags()); } - if (other.hasSetterParameterName()) { - setSetterParameterName(other.getSetterParameterName()); - } if (!other.typeParameter_.isEmpty()) { if (typeParameter_.isEmpty()) { typeParameter_ = other.typeParameter_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); } else { ensureTypeParameterIsMutable(); typeParameter_.addAll(other.typeParameter_); @@ -8899,7 +8883,7 @@ public final class ProtoBuf { if (!other.valueParameter_.isEmpty()) { if (valueParameter_.isEmpty()) { valueParameter_ = other.valueParameter_; - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000080); } else { ensureValueParameterIsMutable(); valueParameter_.addAll(other.valueParameter_); @@ -9247,46 +9231,13 @@ public final class ProtoBuf { return this; } - // optional int32 setter_parameter_name = 11; - private int setterParameterName_ ; - /** - * optional int32 setter_parameter_name = 11; - */ - public boolean hasSetterParameterName() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * optional int32 setter_parameter_name = 11; - */ - public int getSetterParameterName() { - return setterParameterName_; - } - /** - * optional int32 setter_parameter_name = 11; - */ - public Builder setSetterParameterName(int value) { - bitField0_ |= 0x00000010; - setterParameterName_ = value; - - return this; - } - /** - * optional int32 setter_parameter_name = 11; - */ - public Builder clearSetterParameterName() { - bitField0_ = (bitField0_ & ~0x00000010); - setterParameterName_ = 0; - - return this; - } - // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 4; private java.util.List typeParameter_ = java.util.Collections.emptyList(); private void ensureTypeParameterIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { typeParameter_ = new java.util.ArrayList(typeParameter_); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000010; } } @@ -9391,7 +9342,7 @@ public final class ProtoBuf { */ public Builder clearTypeParameter() { typeParameter_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -9411,7 +9362,7 @@ public final class ProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.Type receiver_type = 5; */ public boolean hasReceiverType() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional .org.jetbrains.jet.descriptors.serialization.Type receiver_type = 5; @@ -9428,7 +9379,7 @@ public final class ProtoBuf { } receiverType_ = value; - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000020; return this; } /** @@ -9438,14 +9389,14 @@ public final class ProtoBuf { org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder builderForValue) { receiverType_ = builderForValue.build(); - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000020; return this; } /** * optional .org.jetbrains.jet.descriptors.serialization.Type receiver_type = 5; */ public Builder mergeReceiverType(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { - if (((bitField0_ & 0x00000040) == 0x00000040) && + if (((bitField0_ & 0x00000020) == 0x00000020) && receiverType_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance()) { receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.newBuilder(receiverType_).mergeFrom(value).buildPartial(); @@ -9453,7 +9404,7 @@ public final class ProtoBuf { receiverType_ = value; } - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000020; return this; } /** @@ -9462,7 +9413,7 @@ public final class ProtoBuf { public Builder clearReceiverType() { receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); return this; } @@ -9472,7 +9423,7 @@ public final class ProtoBuf { * required int32 name = 6; */ public boolean hasName() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000040) == 0x00000040); } /** * required int32 name = 6; @@ -9484,7 +9435,7 @@ public final class ProtoBuf { * required int32 name = 6; */ public Builder setName(int value) { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000040; name_ = value; return this; @@ -9493,7 +9444,7 @@ public final class ProtoBuf { * required int32 name = 6; */ public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); name_ = 0; return this; @@ -9503,32 +9454,48 @@ public final class ProtoBuf { private java.util.List valueParameter_ = java.util.Collections.emptyList(); private void ensureValueParameterIsMutable() { - if (!((bitField0_ & 0x00000100) == 0x00000100)) { + if (!((bitField0_ & 0x00000080) == 0x00000080)) { valueParameter_ = new java.util.ArrayList(valueParameter_); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000080; } } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public java.util.List getValueParameterList() { return java.util.Collections.unmodifiableList(valueParameter_); } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public int getValueParameterCount() { return valueParameter_.size(); } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter getValueParameter(int index) { return valueParameter_.get(index); } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder setValueParameter( int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter value) { @@ -9542,6 +9509,10 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder setValueParameter( int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter.Builder builderForValue) { @@ -9552,6 +9523,10 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder addValueParameter(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter value) { if (value == null) { @@ -9564,6 +9539,10 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder addValueParameter( int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter value) { @@ -9577,6 +9556,10 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder addValueParameter( org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter.Builder builderForValue) { @@ -9587,6 +9570,10 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder addValueParameter( int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.ValueParameter.Builder builderForValue) { @@ -9597,6 +9584,10 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder addAllValueParameter( java.lang.Iterable values) { @@ -9607,15 +9598,23 @@ public final class ProtoBuf { } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder clearValueParameter() { valueParameter_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000080); return this; } /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable.ValueParameter value_parameter = 7; + * + *
+       * Value parameters for functions and constructors, or setter value parameter for properties
+       * 
*/ public Builder removeValueParameter(int index) { ensureValueParameterIsMutable(); @@ -9630,7 +9629,7 @@ public final class ProtoBuf { * required .org.jetbrains.jet.descriptors.serialization.Type return_type = 8; */ public boolean hasReturnType() { - return ((bitField0_ & 0x00000200) == 0x00000200); + return ((bitField0_ & 0x00000100) == 0x00000100); } /** * required .org.jetbrains.jet.descriptors.serialization.Type return_type = 8; @@ -9647,7 +9646,7 @@ public final class ProtoBuf { } returnType_ = value; - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000100; return this; } /** @@ -9657,14 +9656,14 @@ public final class ProtoBuf { org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder builderForValue) { returnType_ = builderForValue.build(); - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000100; return this; } /** * required .org.jetbrains.jet.descriptors.serialization.Type return_type = 8; */ public Builder mergeReturnType(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { - if (((bitField0_ & 0x00000200) == 0x00000200) && + if (((bitField0_ & 0x00000100) == 0x00000100) && returnType_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance()) { returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.newBuilder(returnType_).mergeFrom(value).buildPartial(); @@ -9672,7 +9671,7 @@ public final class ProtoBuf { returnType_ = value; } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000100; return this; } /** @@ -9681,7 +9680,7 @@ public final class ProtoBuf { public Builder clearReturnType() { returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000200); + bitField0_ = (bitField0_ & ~0x00000100); return this; } diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java index 424805fb83d..78b418d09a4 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java @@ -138,17 +138,25 @@ public class TypeDeserializer { return classDescriptor.getTypeConstructor(); case TYPE_PARAMETER: - TypeParameterDescriptor descriptor = typeParameterDescriptors.get(proto.getId()); - if (descriptor == null && parent != null) { - descriptor = parent.typeParameterDescriptors.get(proto.getId()); - } - if (descriptor == null) return null; - - return descriptor.getTypeConstructor(); + return typeParameterTypeConstructor(proto); } throw new IllegalStateException("Unknown kind " + proto.getKind()); } + @Nullable + private TypeConstructor typeParameterTypeConstructor(@NotNull ProtoBuf.Type.Constructor proto) { + TypeParameterDescriptor descriptor = typeParameterDescriptors.get(proto.getId()); + if (descriptor != null) { + return descriptor.getTypeConstructor(); + } + + if (parent != null) { + return parent.typeParameterTypeConstructor(proto); + } + + return null; + } + @Nullable private ClassDescriptor computeClassDescriptor(int fqNameIndex) { ClassId classId = nameResolver.getClassId(fqNameIndex); diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java index 5fa07699c38..a075f75cb26 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java @@ -50,6 +50,7 @@ public interface AnnotationDeserializer { @NotNull ClassOrNamespaceDescriptor container, @NotNull ProtoBuf.Callable callable, @NotNull NameResolver nameResolver, + @NotNull AnnotatedCallableKind kind, @NotNull ProtoBuf.Callable.ValueParameter proto ) { return notSupported(); @@ -84,6 +85,7 @@ public interface AnnotationDeserializer { @NotNull ClassOrNamespaceDescriptor container, @NotNull ProtoBuf.Callable callable, @NotNull NameResolver nameResolver, + @NotNull AnnotatedCallableKind kind, @NotNull ProtoBuf.Callable.ValueParameter proto ); } diff --git a/compiler/testData/cli/wrongAbiVersion.out b/compiler/testData/cli/wrongAbiVersion.out index 8498e9a1374..ca19062111a 100644 --- a/compiler/testData/cli/wrongAbiVersion.out +++ b/compiler/testData/cli/wrongAbiVersion.out @@ -1,5 +1,5 @@ WARNING: $TESTDATA_DIR$/wrongAbiVersion.kt: (3, 9) Parameter 'x' is never used ERROR: $TESTDATA_DIR$/wrongAbiVersion.kt: (4, 3) Unresolved reference: bar -ERROR: $TESTDATA_DIR$/wrongAbiVersionLib/wrong/WrongPackage.class: (0, 0) Class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is 10 -ERROR: $TESTDATA_DIR$/wrongAbiVersionLib/ClassWithWrongAbiVersion.class: (0, 0) Class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is 10 +ERROR: $TESTDATA_DIR$/wrongAbiVersionLib/wrong/WrongPackage.class: (0, 0) Class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is 11 +ERROR: $TESTDATA_DIR$/wrongAbiVersionLib/ClassWithWrongAbiVersion.class: (0, 0) Class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is 11 COMPILATION_ERROR diff --git a/compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.kt b/compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.kt new file mode 100644 index 00000000000..7f29456f346 --- /dev/null +++ b/compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.kt @@ -0,0 +1,9 @@ +package test + +annotation class A + +class Class { + var Int.foo: Int + get() = this + set([A] value) {} +} diff --git a/compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.txt b/compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.txt new file mode 100644 index 00000000000..2f274ec3dd9 --- /dev/null +++ b/compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.txt @@ -0,0 +1,12 @@ +package test + +internal final annotation class A : jet.Annotation { + /*primary*/ public constructor A() +} + +internal final class Class { + /*primary*/ public constructor Class() + internal final var jet.Int.foo: jet.Int + internal final fun jet.Int.(): jet.Int + internal final fun jet.Int.(/*0*/ test.A() value: jet.Int): jet.Unit +} diff --git a/compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.kt b/compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.kt new file mode 100644 index 00000000000..e58450573c0 --- /dev/null +++ b/compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.kt @@ -0,0 +1,9 @@ +package test + +annotation class A + +class Class { + var foo: Int + get() = 42 + set([A] value) {} +} diff --git a/compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.txt b/compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.txt new file mode 100644 index 00000000000..1350c7db2d3 --- /dev/null +++ b/compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.txt @@ -0,0 +1,12 @@ +package test + +internal final annotation class A : jet.Annotation { + /*primary*/ public constructor A() +} + +internal final class Class { + /*primary*/ public constructor Class() + internal final var foo: jet.Int + internal final fun (): jet.Int + internal final fun (/*0*/ test.A() value: jet.Int): jet.Unit +} diff --git a/compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.kt b/compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.kt new file mode 100644 index 00000000000..b95a94d9178 --- /dev/null +++ b/compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.kt @@ -0,0 +1,8 @@ +package test + +annotation class A +annotation class B + +var foo: Int + get() = 42 + set([A B] value) {} diff --git a/compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.txt b/compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.txt new file mode 100644 index 00000000000..0a7d7663e3c --- /dev/null +++ b/compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.txt @@ -0,0 +1,13 @@ +package test + +internal var foo: jet.Int + internal fun (): jet.Int + internal fun (/*0*/ test.A() test.B() value: jet.Int): jet.Unit + +internal final annotation class A : jet.Annotation { + /*primary*/ public constructor A() +} + +internal final annotation class B : jet.Annotation { + /*primary*/ public constructor B() +} diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadCompiledKotlinTestGenerated.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadCompiledKotlinTestGenerated.java index cfbac25cd03..1440a061433 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadCompiledKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadCompiledKotlinTestGenerated.java @@ -209,6 +209,11 @@ public class LoadCompiledKotlinTestGenerated extends AbstractLoadCompiledKotlinT doTestWithAccessors("compiler/testData/loadKotlin/annotations/parameters/ExtensionFunctionInClass.kt"); } + @TestMetadata("ExtensionPropertySetter.kt") + public void testExtensionPropertySetter() throws Exception { + doTestWithAccessors("compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.kt"); + } + @TestMetadata("FunctionInClass.kt") public void testFunctionInClass() throws Exception { doTestWithAccessors("compiler/testData/loadKotlin/annotations/parameters/FunctionInClass.kt"); @@ -224,11 +229,21 @@ public class LoadCompiledKotlinTestGenerated extends AbstractLoadCompiledKotlinT doTestWithAccessors("compiler/testData/loadKotlin/annotations/parameters/ManyAnnotations.kt"); } + @TestMetadata("PropertySetterInClass.kt") + public void testPropertySetterInClass() throws Exception { + doTestWithAccessors("compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.kt"); + } + @TestMetadata("TopLevelFunction.kt") public void testTopLevelFunction() throws Exception { doTestWithAccessors("compiler/testData/loadKotlin/annotations/parameters/TopLevelFunction.kt"); } + @TestMetadata("TopLevelPropertySetter.kt") + public void testTopLevelPropertySetter() throws Exception { + doTestWithAccessors("compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.kt"); + } + } @TestMetadata("compiler/testData/loadKotlin/annotations/propertiesWithoutBackingFields") diff --git a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java index 0ad3930d74e..57f095ae549 100644 --- a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveNamespaceComparingTestGenerated.java @@ -211,6 +211,11 @@ public class LazyResolveNamespaceComparingTestGenerated extends AbstractLazyReso doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/annotations/parameters/ExtensionFunctionInClass.kt"); } + @TestMetadata("ExtensionPropertySetter.kt") + public void testExtensionPropertySetter() throws Exception { + doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/annotations/parameters/ExtensionPropertySetter.kt"); + } + @TestMetadata("FunctionInClass.kt") public void testFunctionInClass() throws Exception { doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/annotations/parameters/FunctionInClass.kt"); @@ -226,11 +231,21 @@ public class LazyResolveNamespaceComparingTestGenerated extends AbstractLazyReso doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/annotations/parameters/ManyAnnotations.kt"); } + @TestMetadata("PropertySetterInClass.kt") + public void testPropertySetterInClass() throws Exception { + doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/annotations/parameters/PropertySetterInClass.kt"); + } + @TestMetadata("TopLevelFunction.kt") public void testTopLevelFunction() throws Exception { doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/annotations/parameters/TopLevelFunction.kt"); } + @TestMetadata("TopLevelPropertySetter.kt") + public void testTopLevelPropertySetter() throws Exception { + doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadKotlin/annotations/parameters/TopLevelPropertySetter.kt"); + } + } @TestMetadata("compiler/testData/loadKotlin/annotations/propertiesWithoutBackingFields") diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/JvmAbi.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/JvmAbi.java index fc72992ff29..df313193879 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/JvmAbi.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/JvmAbi.java @@ -28,7 +28,7 @@ public final class JvmAbi { * This constant is used to identify binary format (class file) versions * If you change class file metadata format and/or naming conventions, please increase this number */ - public static final int VERSION = 10; + public static final int VERSION = 11; public static final String TRAIT_IMPL_CLASS_NAME = "$TImpl"; public static final String TRAIT_IMPL_SUFFIX = "$" + TRAIT_IMPL_CLASS_NAME; diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/AnnotationDescriptorDeserializer.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/AnnotationDescriptorDeserializer.java index 4d0c85ad5b5..ab3dcebf620 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/AnnotationDescriptorDeserializer.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/AnnotationDescriptorDeserializer.java @@ -507,16 +507,15 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer @NotNull ClassOrNamespaceDescriptor container, @NotNull ProtoBuf.Callable callable, @NotNull NameResolver nameResolver, + @NotNull AnnotatedCallableKind kind, @NotNull ProtoBuf.Callable.ValueParameter proto ) { - // Kind = FUNCTION because properties and getters don't have any value parameters, and property setters are not supported yet - // TODO: support annotations on property setter value parameters - MemberSignature methodSignature = getCallableSignature(callable, nameResolver, AnnotatedCallableKind.FUNCTION); + MemberSignature methodSignature = getCallableSignature(callable, nameResolver, kind); if (methodSignature != null) { if (proto.hasExtension(JavaProtoBuf.index)) { MemberSignature paramSignature = MemberSignature.fromMethodSignatureAndParameterIndex(methodSignature, proto.getExtension(JavaProtoBuf.index)); - return findClassAndLoadMemberAnnotations(container, callable, nameResolver, AnnotatedCallableKind.FUNCTION, paramSignature); + return findClassAndLoadMemberAnnotations(container, callable, nameResolver, kind, paramSignature); } }