diff --git a/compiler/frontend/builtins/jet/Array.kotlin_class b/compiler/frontend/builtins/jet/Array.kotlin_class index ac6b96d7030..ec6481f0f62 100644 Binary files a/compiler/frontend/builtins/jet/Array.kotlin_class and b/compiler/frontend/builtins/jet/Array.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/BooleanArray.kotlin_class b/compiler/frontend/builtins/jet/BooleanArray.kotlin_class index ff6e8c3dcbd..f93d9db003e 100644 Binary files a/compiler/frontend/builtins/jet/BooleanArray.kotlin_class and b/compiler/frontend/builtins/jet/BooleanArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ByteArray.kotlin_class b/compiler/frontend/builtins/jet/ByteArray.kotlin_class index f426f2e2fa6..38ec3a74be0 100644 Binary files a/compiler/frontend/builtins/jet/ByteArray.kotlin_class and b/compiler/frontend/builtins/jet/ByteArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ByteProgression.kotlin_class b/compiler/frontend/builtins/jet/ByteProgression.kotlin_class index 6816e90188a..5cd4442806a 100644 Binary files a/compiler/frontend/builtins/jet/ByteProgression.kotlin_class and b/compiler/frontend/builtins/jet/ByteProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ByteRange.kotlin_class b/compiler/frontend/builtins/jet/ByteRange.kotlin_class index 056abc65d9b..e2aa226a2a3 100644 Binary files a/compiler/frontend/builtins/jet/ByteRange.kotlin_class and b/compiler/frontend/builtins/jet/ByteRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ByteRange.object.kotlin_class b/compiler/frontend/builtins/jet/ByteRange.object.kotlin_class index f8109b24cc1..f3604a980fb 100644 --- a/compiler/frontend/builtins/jet/ByteRange.object.kotlin_class +++ b/compiler/frontend/builtins/jet/ByteRange.object.kotlin_class @@ -1,5 +1,4 @@ † H2 R Â0B -Z -F0JB - \ No newline at end of file +Z Æ0JB +H \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/CharArray.kotlin_class b/compiler/frontend/builtins/jet/CharArray.kotlin_class index 65c688fc6b4..13a69fea49e 100644 Binary files a/compiler/frontend/builtins/jet/CharArray.kotlin_class and b/compiler/frontend/builtins/jet/CharArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/CharProgression.kotlin_class b/compiler/frontend/builtins/jet/CharProgression.kotlin_class index 8906fb6ea0e..0b4bfae34fc 100644 Binary files a/compiler/frontend/builtins/jet/CharProgression.kotlin_class and b/compiler/frontend/builtins/jet/CharProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/CharRange.kotlin_class b/compiler/frontend/builtins/jet/CharRange.kotlin_class index 3495a4f06eb..86e8798f05a 100644 Binary files a/compiler/frontend/builtins/jet/CharRange.kotlin_class and b/compiler/frontend/builtins/jet/CharRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/CharRange.object.kotlin_class b/compiler/frontend/builtins/jet/CharRange.object.kotlin_class index 0ef5ffdd22c..2058eb93f40 100644 --- a/compiler/frontend/builtins/jet/CharRange.object.kotlin_class +++ b/compiler/frontend/builtins/jet/CharRange.object.kotlin_class @@ -1,5 +1,4 @@ † O2 R Â0B -"Z -F0JB - \ No newline at end of file +"Z Æ0JB +H \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/CharSequence.kotlin_class b/compiler/frontend/builtins/jet/CharSequence.kotlin_class index dd4e6dc3491..ba7062696ff 100644 Binary files a/compiler/frontend/builtins/jet/CharSequence.kotlin_class and b/compiler/frontend/builtins/jet/CharSequence.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/DoubleArray.kotlin_class b/compiler/frontend/builtins/jet/DoubleArray.kotlin_class index efb74d962b0..e96ed181d01 100644 Binary files a/compiler/frontend/builtins/jet/DoubleArray.kotlin_class and b/compiler/frontend/builtins/jet/DoubleArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/DoubleProgression.kotlin_class b/compiler/frontend/builtins/jet/DoubleProgression.kotlin_class index 82530d88f9b..4b89bb830d6 100644 Binary files a/compiler/frontend/builtins/jet/DoubleProgression.kotlin_class and b/compiler/frontend/builtins/jet/DoubleProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/DoubleRange.kotlin_class b/compiler/frontend/builtins/jet/DoubleRange.kotlin_class index 5837f1c86c8..403c1072749 100644 Binary files a/compiler/frontend/builtins/jet/DoubleRange.kotlin_class and b/compiler/frontend/builtins/jet/DoubleRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/DoubleRange.object.kotlin_class b/compiler/frontend/builtins/jet/DoubleRange.object.kotlin_class index 6d13f9f3e99..6aaa3e47a68 100644 --- a/compiler/frontend/builtins/jet/DoubleRange.object.kotlin_class +++ b/compiler/frontend/builtins/jet/DoubleRange.object.kotlin_class @@ -1,5 +1,4 @@ † b2 R Â0B -*Z -F0JB - \ No newline at end of file +*Z Æ0JB +H \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/FloatArray.kotlin_class b/compiler/frontend/builtins/jet/FloatArray.kotlin_class index 72e6af4dfcb..b36815c19d6 100644 Binary files a/compiler/frontend/builtins/jet/FloatArray.kotlin_class and b/compiler/frontend/builtins/jet/FloatArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/FloatProgression.kotlin_class b/compiler/frontend/builtins/jet/FloatProgression.kotlin_class index 87b873e00ea..274beba6177 100644 Binary files a/compiler/frontend/builtins/jet/FloatProgression.kotlin_class and b/compiler/frontend/builtins/jet/FloatProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/FloatRange.kotlin_class b/compiler/frontend/builtins/jet/FloatRange.kotlin_class index 994410ec650..aef53aad9bc 100644 Binary files a/compiler/frontend/builtins/jet/FloatRange.kotlin_class and b/compiler/frontend/builtins/jet/FloatRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/FloatRange.object.kotlin_class b/compiler/frontend/builtins/jet/FloatRange.object.kotlin_class index 2ecf0275af2..6af62297d0c 100644 --- a/compiler/frontend/builtins/jet/FloatRange.object.kotlin_class +++ b/compiler/frontend/builtins/jet/FloatRange.object.kotlin_class @@ -1,5 +1,4 @@ † ¯2 R Â0B -/Z -F0JB - \ No newline at end of file +/Z Æ0JB +H \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/IntArray.kotlin_class b/compiler/frontend/builtins/jet/IntArray.kotlin_class index 5589ec9f67c..b0e14472b9b 100644 Binary files a/compiler/frontend/builtins/jet/IntArray.kotlin_class and b/compiler/frontend/builtins/jet/IntArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/IntProgression.kotlin_class b/compiler/frontend/builtins/jet/IntProgression.kotlin_class index 9e43c3ee8f6..177ef04fbd9 100644 Binary files a/compiler/frontend/builtins/jet/IntProgression.kotlin_class and b/compiler/frontend/builtins/jet/IntProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/IntRange.kotlin_class b/compiler/frontend/builtins/jet/IntRange.kotlin_class index edbfffe684c..19f9c6b7da9 100644 Binary files a/compiler/frontend/builtins/jet/IntRange.kotlin_class and b/compiler/frontend/builtins/jet/IntRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/IntRange.object.kotlin_class b/compiler/frontend/builtins/jet/IntRange.object.kotlin_class index 9b67cb76039..1b7ad36f21a 100644 --- a/compiler/frontend/builtins/jet/IntRange.object.kotlin_class +++ b/compiler/frontend/builtins/jet/IntRange.object.kotlin_class @@ -1,5 +1,4 @@ † Ï2 R Â0B -3Z -F0JB - \ No newline at end of file +3Z Æ0JB +H \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/LongArray.kotlin_class b/compiler/frontend/builtins/jet/LongArray.kotlin_class index 4541666e83b..6203937d897 100644 Binary files a/compiler/frontend/builtins/jet/LongArray.kotlin_class and b/compiler/frontend/builtins/jet/LongArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/LongProgression.kotlin_class b/compiler/frontend/builtins/jet/LongProgression.kotlin_class index 539210aa8bc..29ca3aa641b 100644 Binary files a/compiler/frontend/builtins/jet/LongProgression.kotlin_class and b/compiler/frontend/builtins/jet/LongProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/LongRange.kotlin_class b/compiler/frontend/builtins/jet/LongRange.kotlin_class index e39898b4ca8..3675a20e22d 100644 Binary files a/compiler/frontend/builtins/jet/LongRange.kotlin_class and b/compiler/frontend/builtins/jet/LongRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/LongRange.object.kotlin_class b/compiler/frontend/builtins/jet/LongRange.object.kotlin_class index 7d8ea3b232d..6ac7c8606c7 100644 --- a/compiler/frontend/builtins/jet/LongRange.object.kotlin_class +++ b/compiler/frontend/builtins/jet/LongRange.object.kotlin_class @@ -1,5 +1,4 @@ † ¦2 R Â0B -fZ -F0JB - \ No newline at end of file +fZ Æ0JB +H \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/Progression.kotlin_class b/compiler/frontend/builtins/jet/Progression.kotlin_class index cbab00eb170..aeaf69fb2a8 100644 Binary files a/compiler/frontend/builtins/jet/Progression.kotlin_class and b/compiler/frontend/builtins/jet/Progression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/PropertyMetadata.kotlin_class b/compiler/frontend/builtins/jet/PropertyMetadata.kotlin_class index 89ed427036c..d40678d1b09 100644 --- a/compiler/frontend/builtins/jet/PropertyMetadata.kotlin_class +++ b/compiler/frontend/builtins/jet/PropertyMetadata.kotlin_class @@ -1,4 +1,3 @@ f Ê2 -Z -f0dB -# \ No newline at end of file +Z æ0dB +#H& \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/PropertyMetadataImpl.kotlin_class b/compiler/frontend/builtins/jet/PropertyMetadataImpl.kotlin_class index 60636f30b6d..c3f86774613 100644 Binary files a/compiler/frontend/builtins/jet/PropertyMetadataImpl.kotlin_class and b/compiler/frontend/builtins/jet/PropertyMetadataImpl.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/Range.kotlin_class b/compiler/frontend/builtins/jet/Range.kotlin_class index 40e7dad6b71..24837aaa54b 100644 Binary files a/compiler/frontend/builtins/jet/Range.kotlin_class and b/compiler/frontend/builtins/jet/Range.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ShortArray.kotlin_class b/compiler/frontend/builtins/jet/ShortArray.kotlin_class index 78031cf3574..a822238f134 100644 Binary files a/compiler/frontend/builtins/jet/ShortArray.kotlin_class and b/compiler/frontend/builtins/jet/ShortArray.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ShortProgression.kotlin_class b/compiler/frontend/builtins/jet/ShortProgression.kotlin_class index 88b4a9111a1..9aa8f225b2b 100644 Binary files a/compiler/frontend/builtins/jet/ShortProgression.kotlin_class and b/compiler/frontend/builtins/jet/ShortProgression.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ShortRange.kotlin_class b/compiler/frontend/builtins/jet/ShortRange.kotlin_class index abb6a090786..e9e31c592fa 100644 Binary files a/compiler/frontend/builtins/jet/ShortRange.kotlin_class and b/compiler/frontend/builtins/jet/ShortRange.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/ShortRange.object.kotlin_class b/compiler/frontend/builtins/jet/ShortRange.object.kotlin_class index a7b560fc573..9ef38e9efa7 100644 --- a/compiler/frontend/builtins/jet/ShortRange.object.kotlin_class +++ b/compiler/frontend/builtins/jet/ShortRange.object.kotlin_class @@ -1,5 +1,4 @@ † Ð2 R Â0B -xZ -F0JB - \ No newline at end of file +xZ Æ0JB +H \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/String.kotlin_class b/compiler/frontend/builtins/jet/String.kotlin_class index 0d63527d6de..0d92f3696a9 100644 Binary files a/compiler/frontend/builtins/jet/String.kotlin_class and b/compiler/frontend/builtins/jet/String.kotlin_class differ diff --git a/compiler/frontend/builtins/jet/Unit.object.kotlin_class b/compiler/frontend/builtins/jet/Unit.object.kotlin_class index ca3c112dbd9..4d7de249181 100644 --- a/compiler/frontend/builtins/jet/Unit.object.kotlin_class +++ b/compiler/frontend/builtins/jet/Unit.object.kotlin_class @@ -1,4 +1,4 @@ † Ø2 R Â0B -{Z F0ÙB - \ No newline at end of file +{ZÆ0ÙB +H \ No newline at end of file diff --git a/compiler/frontend/serialization/src/descriptors.proto b/compiler/frontend/serialization/src/descriptors.proto index 4449905d8d9..e0f7c0a7a3a 100644 --- a/compiler/frontend/serialization/src/descriptors.proto +++ b/compiler/frontend/serialization/src/descriptors.proto @@ -147,16 +147,24 @@ message Callable { Visibility Modality has_annotations - fun/val/var/constructor - Kind + CallableKind + MemberKind inline - setter::Modality - setter::Visibility - setter::has_annotations + hasGetter + hasSetter */ optional int32 flags = 1; optional string extra_visibility = 2; // for things like java-specific visibilities + /* + isNotDefault + Visibility + Modality + has_annotations + */ + optional int32 getterFlags = 9 /* absent => same as property */; + optional int32 setterFlags = 10 /* absent => same as property */; + repeated TypeParameter typeParameters = 4; optional Type receiverType = 5; 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 707d8aed558..34fda78af9c 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 @@ -24,6 +24,7 @@ import org.jetbrains.jet.lang.descriptors.Modality; import org.jetbrains.jet.lang.descriptors.Visibility; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.descriptors.impl.*; +import org.jetbrains.jet.lang.resolve.DescriptorResolver; import org.jetbrains.jet.lang.types.Variance; import java.util.ArrayList; @@ -118,6 +119,44 @@ public class DescriptorDeserializer { getExpectedThisObject(), local.typeDeserializer.typeOrNull(proto.hasReceiverType() ? proto.getReceiverType() : null) ); + + PropertyGetterDescriptorImpl getter = null; + PropertySetterDescriptorImpl setter = null; + + if (Flags.HAS_GETTER.get(flags)) { + int getterFlags = proto.getGetterFlags(); + Boolean isNotDefault = proto.hasGetterFlags() || Flags.IS_NOT_DEFAULT.get(getterFlags); + if (!isNotDefault) { + getter = DescriptorResolver.createDefaultGetter(property); + } + else { + getter = new PropertyGetterDescriptorImpl( + property, Collections.emptyList(), + modality(Flags.MODALITY.get(getterFlags)), visibility(Flags.VISIBILITY.get(getterFlags)), + isNotDefault, !isNotDefault, property.getKind() + ); + } + getter.initialize(property.getReturnType()); + } + + if (Flags.HAS_SETTER.get(flags)) { + int setterFlags = proto.getSetterFlags(); + Boolean isNotDefault = proto.hasSetterFlags() || Flags.IS_NOT_DEFAULT.get(setterFlags); + if (!isNotDefault) { + setter = DescriptorResolver.createDefaultSetter(property); + } + else { + setter = new PropertySetterDescriptorImpl( + property, getSetterAnnotations(proto, setterFlags), + modality(Flags.MODALITY.get(setterFlags)), visibility(Flags.VISIBILITY.get(setterFlags)), + isNotDefault, !isNotDefault, property.getKind() + ); + setter.initializeDefault(); + } + } + + property.initialize(getter, setter); + return property; } @@ -177,6 +216,11 @@ public class DescriptorDeserializer { : Collections.emptyList(); } + private List getSetterAnnotations(Callable proto, int setterFlags) { + return Flags.HAS_ANNOTATIONS.get(setterFlags) ? annotationDeserializer.loadSetterAnnotations(proto) : Collections + .emptyList(); + } + private static CallableMemberDescriptor.Kind memberKind(Callable.MemberKind memberKind) { switch (memberKind) { case DECLARATION: 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 a845824dbb3..45f75979ee9 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 @@ -132,18 +132,49 @@ public class DescriptorSerializer { public ProtoBuf.Callable.Builder callableProto(@NotNull CallableMemberDescriptor descriptor) { ProtoBuf.Callable.Builder builder = ProtoBuf.Callable.newBuilder(); - // TODO setter flags - // TODO setter annotations - builder.setFlags(Flags.getCallableFlags(hasAnnotations(descriptor), descriptor.getVisibility(), - descriptor.getModality(), - descriptor.getKind(), - callableKind(descriptor), - descriptor instanceof SimpleFunctionDescriptor && - ((SimpleFunctionDescriptor) descriptor).isInline()) - ); - //TODO builder.setExtraVisibility() + boolean hasGetter = false; + boolean hasSetter = false; + if (descriptor instanceof PropertyDescriptor) { + PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor; - //TODO builder.addAnnotations() + int propertyFlags = Flags.getAccessorFlags( + hasAnnotations(propertyDescriptor), + propertyDescriptor.getVisibility(), + propertyDescriptor.getModality(), + true + ); + + PropertyGetterDescriptor getter = propertyDescriptor.getGetter(); + if (getter != null) { + hasGetter = true; + int accessorFlags = getAccessorFlags(getter); + if (accessorFlags != propertyFlags) { + builder.setGetterFlags(accessorFlags); + } + } + + PropertySetterDescriptor setter = propertyDescriptor.getSetter(); + if (setter != null) { + hasGetter = true; + int accessorFlags = getAccessorFlags(setter); + if (accessorFlags != propertyFlags) { + builder.setSetterFlags(accessorFlags); + } + } + } + + builder.setFlags(Flags.getCallableFlags( + hasAnnotations(descriptor), + descriptor.getVisibility(), + descriptor.getModality(), + descriptor.getKind(), + callableKind(descriptor), + descriptor instanceof SimpleFunctionDescriptor && + ((SimpleFunctionDescriptor) descriptor).isInline(), + hasGetter, + hasSetter + )); + //TODO builder.setExtraVisibility() DescriptorSerializer local = createChildSerializer(); @@ -167,6 +198,15 @@ public class DescriptorSerializer { return builder; } + private static int getAccessorFlags(@NotNull PropertyAccessorDescriptor accessor) { + return Flags.getAccessorFlags( + hasAnnotations(accessor), + accessor.getVisibility(), + accessor.getModality(), + !accessor.isDefault() + ); + } + private static ProtoBuf.Callable.CallableKind callableKind(CallableMemberDescriptor descriptor) { if (descriptor instanceof PropertyDescriptor) { PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor; diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java index d91bdbe21f8..4ec2cedf1f3 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java @@ -29,11 +29,18 @@ public class Flags { public static final FlagField MEMBER_KIND = FlagField.after(CALLABLE_KIND, ProtoBuf.Callable.MemberKind.values()); public static final FlagField INLINE = FlagField.booleanAfter(MEMBER_KIND); + public static final FlagField HAS_GETTER = FlagField.booleanAfter(INLINE); + public static final FlagField HAS_SETTER = FlagField.booleanAfter(HAS_GETTER); // Parameters public static final FlagField DECLARES_DEFAULT_VALUE = FlagField.booleanAfter(HAS_ANNOTATIONS); + // Accessors + + // It's important that this flag is negated: "is NOT default" instead of "is default" + public static final FlagField IS_NOT_DEFAULT = FlagField.booleanAfter(MODALITY); + // --- private static int bitWidth(@NotNull E[] enumEntries) { @@ -86,7 +93,9 @@ public class Flags { @NotNull Modality modality, @NotNull CallableMemberDescriptor.Kind memberKind, @NotNull ProtoBuf.Callable.CallableKind callableKind, - boolean inline + boolean inline, + boolean hasGetter, + boolean hasSetter ) { return HAS_ANNOTATIONS.toFlags(hasAnnotations) | MODALITY.toFlags(modality(modality)) @@ -94,6 +103,21 @@ public class Flags { | MEMBER_KIND.toFlags(memberKind(memberKind)) | CALLABLE_KIND.toFlags(callableKind) | INLINE.toFlags(inline) + | HAS_GETTER.toFlags(hasGetter) + | HAS_SETTER.toFlags(hasSetter) + ; + } + + public static int getAccessorFlags( + boolean hasAnnotations, + @NotNull Visibility visibility, + @NotNull Modality modality, + boolean isNotDefault + ) { + return HAS_ANNOTATIONS.toFlags(hasAnnotations) + | MODALITY.toFlags(modality(modality)) + | VISIBILITY.toFlags(visibility(visibility)) + | IS_NOT_DEFAULT.toFlags(isNotDefault) ; } 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 a9a46d143b9..38bed6a8487 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 @@ -4675,6 +4675,14 @@ public final class ProtoBuf { boolean hasExtraVisibility(); String getExtraVisibility(); + // optional int32 getterFlags = 9; + boolean hasGetterFlags(); + int getGetterFlags(); + + // optional int32 setterFlags = 10; + boolean hasSetterFlags(); + int getSetterFlags(); + // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter typeParameters = 4; java.util.List getTypeParametersList(); @@ -5396,6 +5404,26 @@ public final class ProtoBuf { } } + // optional int32 getterFlags = 9; + public static final int GETTERFLAGS_FIELD_NUMBER = 9; + private int getterFlags_; + public boolean hasGetterFlags() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getGetterFlags() { + return getterFlags_; + } + + // optional int32 setterFlags = 10; + public static final int SETTERFLAGS_FIELD_NUMBER = 10; + private int setterFlags_; + public boolean hasSetterFlags() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public int getSetterFlags() { + return setterFlags_; + } + // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter typeParameters = 4; public static final int TYPEPARAMETERS_FIELD_NUMBER = 4; private java.util.List typeParameters_; @@ -5421,7 +5449,7 @@ public final class ProtoBuf { public static final int RECEIVERTYPE_FIELD_NUMBER = 5; private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type receiverType_; public boolean hasReceiverType() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000010) == 0x00000010); } public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getReceiverType() { return receiverType_; @@ -5431,7 +5459,7 @@ public final class ProtoBuf { public static final int NAME_FIELD_NUMBER = 6; private int name_; public boolean hasName() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000020) == 0x00000020); } public int getName() { return name_; @@ -5462,7 +5490,7 @@ public final class ProtoBuf { public static final int RETURNTYPE_FIELD_NUMBER = 8; private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type returnType_; public boolean hasReturnType() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000040) == 0x00000040); } public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getReturnType() { return returnType_; @@ -5471,6 +5499,8 @@ public final class ProtoBuf { private void initFields() { flags_ = 0; extraVisibility_ = ""; + getterFlags_ = 0; + setterFlags_ = 0; typeParameters_ = java.util.Collections.emptyList(); receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); name_ = 0; @@ -5528,18 +5558,24 @@ public final class ProtoBuf { for (int i = 0; i < typeParameters_.size(); i++) { output.writeMessage(4, typeParameters_.get(i)); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeMessage(5, receiverType_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt32(6, name_); } for (int i = 0; i < valueParameters_.size(); i++) { output.writeMessage(7, valueParameters_.get(i)); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeMessage(8, returnType_); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(9, getterFlags_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeInt32(10, setterFlags_); + } } private int memoizedSerializedSize = -1; @@ -5560,11 +5596,11 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, typeParameters_.get(i)); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, receiverType_); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(6, name_); } @@ -5572,10 +5608,18 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeMessageSize(7, valueParameters_.get(i)); } - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(8, returnType_); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(9, getterFlags_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(10, setterFlags_); + } memoizedSerializedSize = size; return size; } @@ -5682,16 +5726,20 @@ public final class ProtoBuf { bitField0_ = (bitField0_ & ~0x00000001); extraVisibility_ = ""; bitField0_ = (bitField0_ & ~0x00000002); - typeParameters_ = java.util.Collections.emptyList(); + getterFlags_ = 0; bitField0_ = (bitField0_ & ~0x00000004); - receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); + setterFlags_ = 0; bitField0_ = (bitField0_ & ~0x00000008); - name_ = 0; + typeParameters_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000010); - valueParameters_ = java.util.Collections.emptyList(); + receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000020); - returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); + name_ = 0; bitField0_ = (bitField0_ & ~0x00000040); + valueParameters_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000100); return this; } @@ -5733,26 +5781,34 @@ public final class ProtoBuf { to_bitField0_ |= 0x00000002; } result.extraVisibility_ = extraVisibility_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - typeParameters_ = java.util.Collections.unmodifiableList(typeParameters_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.typeParameters_ = typeParameters_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } - result.receiverType_ = receiverType_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + result.getterFlags_ = getterFlags_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } + result.setterFlags_ = setterFlags_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + typeParameters_ = java.util.Collections.unmodifiableList(typeParameters_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.typeParameters_ = typeParameters_; + if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + to_bitField0_ |= 0x00000010; + } + result.receiverType_ = receiverType_; + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { + to_bitField0_ |= 0x00000020; + } result.name_ = name_; - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000080) == 0x00000080)) { valueParameters_ = java.util.Collections.unmodifiableList(valueParameters_); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000080); } result.valueParameters_ = valueParameters_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000010; + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + to_bitField0_ |= 0x00000040; } result.returnType_ = returnType_; result.bitField0_ = to_bitField0_; @@ -5767,10 +5823,16 @@ public final class ProtoBuf { if (other.hasExtraVisibility()) { setExtraVisibility(other.getExtraVisibility()); } + if (other.hasGetterFlags()) { + setGetterFlags(other.getGetterFlags()); + } + if (other.hasSetterFlags()) { + setSetterFlags(other.getSetterFlags()); + } if (!other.typeParameters_.isEmpty()) { if (typeParameters_.isEmpty()) { typeParameters_ = other.typeParameters_; - bitField0_ = (bitField0_ & ~0x00000004); + bitField0_ = (bitField0_ & ~0x00000010); } else { ensureTypeParametersIsMutable(); typeParameters_.addAll(other.typeParameters_); @@ -5786,7 +5848,7 @@ public final class ProtoBuf { if (!other.valueParameters_.isEmpty()) { if (valueParameters_.isEmpty()) { valueParameters_ = other.valueParameters_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000080); } else { ensureValueParametersIsMutable(); valueParameters_.addAll(other.valueParameters_); @@ -5876,7 +5938,7 @@ public final class ProtoBuf { break; } case 48: { - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000040; name_ = input.readInt32(); break; } @@ -5895,6 +5957,16 @@ public final class ProtoBuf { setReturnType(subBuilder.buildPartial()); break; } + case 72: { + bitField0_ |= 0x00000004; + getterFlags_ = input.readInt32(); + break; + } + case 80: { + bitField0_ |= 0x00000008; + setterFlags_ = input.readInt32(); + break; + } } } } @@ -5958,13 +6030,55 @@ public final class ProtoBuf { } + // optional int32 getterFlags = 9; + private int getterFlags_ ; + public boolean hasGetterFlags() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public int getGetterFlags() { + return getterFlags_; + } + public Builder setGetterFlags(int value) { + bitField0_ |= 0x00000004; + getterFlags_ = value; + + return this; + } + public Builder clearGetterFlags() { + bitField0_ = (bitField0_ & ~0x00000004); + getterFlags_ = 0; + + return this; + } + + // optional int32 setterFlags = 10; + private int setterFlags_ ; + public boolean hasSetterFlags() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public int getSetterFlags() { + return setterFlags_; + } + public Builder setSetterFlags(int value) { + bitField0_ |= 0x00000008; + setterFlags_ = value; + + return this; + } + public Builder clearSetterFlags() { + bitField0_ = (bitField0_ & ~0x00000008); + setterFlags_ = 0; + + return this; + } + // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter typeParameters = 4; private java.util.List typeParameters_ = java.util.Collections.emptyList(); private void ensureTypeParametersIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { typeParameters_ = new java.util.ArrayList(typeParameters_); - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; } } @@ -6036,7 +6150,7 @@ public final class ProtoBuf { } public Builder clearTypeParameters() { typeParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -6050,7 +6164,7 @@ public final class ProtoBuf { // optional .org.jetbrains.jet.descriptors.serialization.Type receiverType = 5; private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); public boolean hasReceiverType() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000020) == 0x00000020); } public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getReceiverType() { return receiverType_; @@ -6061,18 +6175,18 @@ public final class ProtoBuf { } receiverType_ = value; - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; return this; } public Builder setReceiverType( org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder builderForValue) { receiverType_ = builderForValue.build(); - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; return this; } public Builder mergeReceiverType(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { - if (((bitField0_ & 0x00000008) == 0x00000008) && + 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(); @@ -6080,32 +6194,32 @@ public final class ProtoBuf { receiverType_ = value; } - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; return this; } public Builder clearReceiverType() { receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000020); return this; } // required int32 name = 6; private int name_ ; public boolean hasName() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000040) == 0x00000040); } public int getName() { return name_; } public Builder setName(int value) { - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000040; name_ = value; return this; } public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000040); name_ = 0; return this; @@ -6115,9 +6229,9 @@ public final class ProtoBuf { private java.util.List valueParameters_ = java.util.Collections.emptyList(); private void ensureValueParametersIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { + if (!((bitField0_ & 0x00000080) == 0x00000080)) { valueParameters_ = new java.util.ArrayList(valueParameters_); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000080; } } @@ -6189,7 +6303,7 @@ public final class ProtoBuf { } public Builder clearValueParameters() { valueParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000080); return this; } @@ -6203,7 +6317,7 @@ public final class ProtoBuf { // required .org.jetbrains.jet.descriptors.serialization.Type returnType = 8; private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); public boolean hasReturnType() { - return ((bitField0_ & 0x00000040) == 0x00000040); + return ((bitField0_ & 0x00000100) == 0x00000100); } public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getReturnType() { return returnType_; @@ -6214,18 +6328,18 @@ public final class ProtoBuf { } returnType_ = value; - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000100; return this; } public Builder setReturnType( org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder builderForValue) { returnType_ = builderForValue.build(); - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000100; return this; } public Builder mergeReturnType(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { - if (((bitField0_ & 0x00000040) == 0x00000040) && + 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(); @@ -6233,13 +6347,13 @@ public final class ProtoBuf { returnType_ = value; } - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000100; return this; } public Builder clearReturnType() { returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000100); return this; } 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 f43bff9e936..ac8775318df 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 @@ -24,6 +24,12 @@ public interface AnnotationDeserializer { return notSupported(); } + @NotNull + @Override + public List loadSetterAnnotations(@NotNull ProtoBuf.Callable callableProto) { + return notSupported(); + } + @NotNull @Override public List loadValueParameterAnnotations( @@ -49,4 +55,7 @@ public interface AnnotationDeserializer { List loadValueParameterAnnotations( @NotNull ProtoBuf.Callable.ValueParameter parameterProto ); + + @NotNull + List loadSetterAnnotations(@NotNull ProtoBuf.Callable callableProto); } diff --git a/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java b/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java index bda03d48f7d..86c64e90a45 100644 --- a/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java +++ b/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java @@ -98,6 +98,12 @@ public abstract class AbstractDescriptorSerializationTest extends KotlinTestWith throw new UnsupportedOperationException(); // TODO } + @NotNull + @Override + public List loadSetterAnnotations(@NotNull ProtoBuf.Callable callableProto) { + throw new UnsupportedOperationException(); // TODO + } + @NotNull @Override public List loadValueParameterAnnotations(