From 806d264771e8032f893860f12b33fd585056e20f Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 9 Oct 2013 22:46:51 +0400 Subject: [PATCH] Write full synthetic method signature for annotated property This will be needed to support annotated extension properties, since they have the same name but different signatures --- .../jet/codegen/JavaSerializerExtension.java | 14 +- .../org/jetbrains/jet/codegen/MemberMap.java | 16 +- .../jet/codegen/PropertyCodegen.java | 10 +- compiler/testData/cli/wrongAbiVersion.out | 4 +- .../jet/codegen/PropertyGenTest.java | 3 +- .../jet/lang/resolve/java/JvmAbi.java | 13 +- .../AnnotationDescriptorDeserializer.java | 18 +- .../src/java_descriptors.proto | 8 +- .../serialization/JavaProtoBuf.java | 186 ++++++++++++------ 9 files changed, 166 insertions(+), 106 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/JavaSerializerExtension.java b/compiler/backend/src/org/jetbrains/jet/codegen/JavaSerializerExtension.java index 8abc10d13c2..428098941aa 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/JavaSerializerExtension.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/JavaSerializerExtension.java @@ -71,22 +71,22 @@ public class JavaSerializerExtension extends SerializerExtension { Type fieldType; String fieldName; boolean isStaticInOuter; - String syntheticMethodName; + Method syntheticMethod; if (field != null) { fieldType = field.first; fieldName = field.second; isStaticInOuter = memberMap.isStaticFieldInOuterClass(property); - syntheticMethodName = null; + syntheticMethod = null; } else { fieldType = null; fieldName = null; isStaticInOuter = false; - syntheticMethodName = memberMap.getSyntheticMethodNameOfProperty(property); + syntheticMethod = memberMap.getSyntheticMethodOfProperty(property); } JavaProtoBuf.JavaPropertySignature signature = new SignatureSerializer(nameTable) - .propertySignature(fieldType, fieldName, isStaticInOuter, syntheticMethodName, getterMethod, setterMethod); + .propertySignature(fieldType, fieldName, isStaticInOuter, syntheticMethod, getterMethod, setterMethod); proto.setExtension(JavaProtoBuf.propertySignature, signature); } } @@ -129,7 +129,7 @@ public class JavaSerializerExtension extends SerializerExtension { @Nullable Type fieldType, @Nullable String fieldName, boolean isStaticInOuter, - @Nullable String syntheticMethodName, + @Nullable Method syntheticMethod, @Nullable Method getter, @Nullable Method setter ) { @@ -140,8 +140,8 @@ public class JavaSerializerExtension extends SerializerExtension { signature.setField(fieldSignature(fieldType, fieldName, isStaticInOuter)); } - if (syntheticMethodName != null) { - signature.setSyntheticMethodName(nameTable.getSimpleNameIndex(Name.guess(syntheticMethodName))); + if (syntheticMethod != null) { + signature.setSyntheticMethod(methodSignature(syntheticMethod)); } if (getter != null) { diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/MemberMap.java b/compiler/backend/src/org/jetbrains/jet/codegen/MemberMap.java index 78420bf0643..6b85c0d3172 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/MemberMap.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/MemberMap.java @@ -30,7 +30,7 @@ import java.util.*; public final class MemberMap { private final Map methodForFunction = new HashMap(); private final Map> fieldForProperty = new HashMap>(); - private final Map syntheticMethodNameForProperty = new HashMap(); + private final Map syntheticMethodForProperty = new HashMap(); private final Map srcClassNameForCallable = new HashMap(); private final Set staticFieldInOuterClass = new HashSet(); @@ -46,8 +46,8 @@ public final class MemberMap { result.recordFieldOfProperty(entry.getKey(), entry.getValue().first, entry.getValue().second); } - for (Map.Entry entry : map.syntheticMethodNameForProperty.entrySet()) { - result.recordSyntheticMethodNameOfProperty(entry.getKey(), entry.getValue()); + for (Map.Entry entry : map.syntheticMethodForProperty.entrySet()) { + result.recordSyntheticMethodOfProperty(entry.getKey(), entry.getValue()); } for (Map.Entry entry : map.srcClassNameForCallable.entrySet()) { @@ -72,8 +72,8 @@ public final class MemberMap { assert old == null : "Duplicate field for property: " + descriptor + "; " + old; } - public void recordSyntheticMethodNameOfProperty(@NotNull PropertyDescriptor descriptor, @NotNull String name) { - String old = syntheticMethodNameForProperty.put(descriptor, name); + public void recordSyntheticMethodOfProperty(@NotNull PropertyDescriptor descriptor, @NotNull Method method) { + Method old = syntheticMethodForProperty.put(descriptor, method); assert old == null : "Duplicate synthetic method for property: " + descriptor + "; " + old; } @@ -98,8 +98,8 @@ public final class MemberMap { } @Nullable - public String getSyntheticMethodNameOfProperty(@NotNull PropertyDescriptor descriptor) { - return syntheticMethodNameForProperty.get(descriptor); + public Method getSyntheticMethodOfProperty(@NotNull PropertyDescriptor descriptor) { + return syntheticMethodForProperty.get(descriptor); } @Nullable @@ -115,7 +115,7 @@ public final class MemberMap { public String toString() { return "Functions: " + methodForFunction.size() + ", fields: " + fieldForProperty.size() + - ", synthetic methods: " + syntheticMethodNameForProperty.size() + + ", synthetic methods: " + syntheticMethodForProperty.size() + ", src class names: " + srcClassNameForCallable.size(); } } diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java index e8bfc595777..5998d8a4a66 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java @@ -24,6 +24,7 @@ import org.jetbrains.asm4.MethodVisitor; import org.jetbrains.asm4.Opcodes; import org.jetbrains.asm4.Type; import org.jetbrains.asm4.commons.InstructionAdapter; +import org.jetbrains.asm4.commons.Method; import org.jetbrains.jet.codegen.context.CodegenContext; import org.jetbrains.jet.codegen.context.FieldOwnerContext; import org.jetbrains.jet.codegen.context.NamespaceContext; @@ -143,14 +144,15 @@ public class PropertyCodegen extends GenerationStateAware { else if (!propertyDescriptor.getAnnotations().isEmpty()) { // Annotations on properties without backing fields are stored in bytecode on an empty synthetic method. This way they're still // accessible via reflection, and 'deprecated' and 'private' flags prevent this method from being called accidentally - String methodName = JvmAbi.getSyntheticMethodNameForAnnotatedProperty(propertyDescriptor.getName()); + Method method = JvmAbi.getSyntheticMethodSignatureForAnnotatedProperty(propertyDescriptor.getName()); + MethodVisitor mv = v.newMethod(null, ACC_DEPRECATED | ACC_FINAL | ACC_PRIVATE | ACC_STATIC | ACC_SYNTHETIC, - methodName, - JvmAbi.ANNOTATED_PROPERTY_METHOD_SIGNATURE, + method.getName(), + method.getDescriptor(), null, null); - v.getMemberMap().recordSyntheticMethodNameOfProperty(propertyDescriptor, methodName); + v.getMemberMap().recordSyntheticMethodOfProperty(propertyDescriptor, method); AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(propertyDescriptor); mv.visitCode(); mv.visitInsn(Opcodes.RETURN); diff --git a/compiler/testData/cli/wrongAbiVersion.out b/compiler/testData/cli/wrongAbiVersion.out index 0c624de9d2f..8498e9a1374 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 9 -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 9 +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 COMPILATION_ERROR diff --git a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java index c4ac72b8e50..e1a3d016f2e 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java @@ -265,7 +265,8 @@ public class PropertyGenTest extends CodegenTestCase { } } - private static final String TEST_SYNTHETIC_METHOD_NAME = JvmAbi.getSyntheticMethodNameForAnnotatedProperty(Name.identifier("property")); + private static final String TEST_SYNTHETIC_METHOD_NAME = + JvmAbi.getSyntheticMethodSignatureForAnnotatedProperty(Name.identifier("property")).getName(); public void testAnnotatedClassPropertyNoField() { loadFile("properties/annotatedClassPropertyNoField.kt"); 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 6f3cfaa7b99..3f1c18088e8 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 @@ -17,6 +17,8 @@ package org.jetbrains.jet.lang.resolve.java; import org.jetbrains.annotations.NotNull; +import org.jetbrains.asm4.Type; +import org.jetbrains.asm4.commons.Method; import org.jetbrains.jet.lang.resolve.name.FqName; import org.jetbrains.jet.lang.resolve.name.Name; @@ -25,7 +27,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 = 9; + public static final int VERSION = 10; public static final String TRAIT_IMPL_CLASS_NAME = "$TImpl"; public static final String TRAIT_IMPL_SUFFIX = "$" + TRAIT_IMPL_CLASS_NAME; @@ -39,7 +41,6 @@ public final class JvmAbi { public static final String DELEGATED_PROPERTY_NAME_SUFFIX = "$delegate"; public static final String ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX = "$annotations"; - public static final String ANNOTATED_PROPERTY_METHOD_SIGNATURE = "()V"; public static final String INSTANCE_FIELD = "instance$"; public static final String CLASS_OBJECT_FIELD = "object$"; @@ -56,8 +57,12 @@ public final class JvmAbi { } @NotNull - public static String getSyntheticMethodNameForAnnotatedProperty(@NotNull Name propertyName) { - return propertyName.asString() + ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX; + public static Method getSyntheticMethodSignatureForAnnotatedProperty(@NotNull Name propertyName) { + return new Method( + propertyName.asString() + ANNOTATED_PROPERTY_METHOD_NAME_SUFFIX, + Type.VOID_TYPE, + new Type[0] + ); } @NotNull 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 f2ec789cbf0..aad9d30cf54 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 @@ -30,7 +30,6 @@ import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; import org.jetbrains.jet.lang.resolve.constants.EnumValue; import org.jetbrains.jet.lang.resolve.constants.ErrorValue; -import org.jetbrains.jet.lang.resolve.java.JvmAbi; import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames; import org.jetbrains.jet.lang.resolve.java.JvmClassName; import org.jetbrains.jet.lang.resolve.java.PackageClassUtils; @@ -287,23 +286,21 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer @NotNull NameResolver nameResolver, @NotNull AnnotatedCallableKind kind ) { + SignatureDeserializer deserializer = new SignatureDeserializer(nameResolver); switch (kind) { case FUNCTION: if (proto.hasExtension(JavaProtoBuf.methodSignature)) { - JavaProtoBuf.JavaMethodSignature signature = proto.getExtension(JavaProtoBuf.methodSignature); - return new SignatureDeserializer(nameResolver).methodSignature(signature); + return deserializer.methodSignature(proto.getExtension(JavaProtoBuf.methodSignature)); } break; case PROPERTY_GETTER: if (proto.hasExtension(JavaProtoBuf.propertySignature)) { - JavaProtoBuf.JavaPropertySignature propertySignature = proto.getExtension(JavaProtoBuf.propertySignature); - return new SignatureDeserializer(nameResolver).methodSignature(propertySignature.getGetter()); + return deserializer.methodSignature(proto.getExtension(JavaProtoBuf.propertySignature).getGetter()); } break; case PROPERTY_SETTER: if (proto.hasExtension(JavaProtoBuf.propertySignature)) { - JavaProtoBuf.JavaPropertySignature propertySignature = proto.getExtension(JavaProtoBuf.propertySignature); - return new SignatureDeserializer(nameResolver).methodSignature(propertySignature.getSetter()); + return deserializer.methodSignature(proto.getExtension(JavaProtoBuf.propertySignature).getSetter()); } break; case PROPERTY: @@ -312,13 +309,12 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer if (propertySignature.hasField()) { JavaProtoBuf.JavaFieldSignature field = propertySignature.getField(); - String type = new SignatureDeserializer(nameResolver).typeDescriptor(field.getType()); + String type = deserializer.typeDescriptor(field.getType()); Name name = nameResolver.getName(field.getName()); return MemberSignature.fromFieldNameAndDesc(name, type); } - else if (propertySignature.hasSyntheticMethodName()) { - Name name = nameResolver.getName(propertySignature.getSyntheticMethodName()); - return MemberSignature.fromMethodNameAndDesc(name, JvmAbi.ANNOTATED_PROPERTY_METHOD_SIGNATURE); + else if (propertySignature.hasSyntheticMethod()) { + return deserializer.methodSignature(propertySignature.getSyntheticMethod()); } } break; diff --git a/core/serialization.java/src/java_descriptors.proto b/core/serialization.java/src/java_descriptors.proto index 4753b1f53d7..40de1bf98cd 100644 --- a/core/serialization.java/src/java_descriptors.proto +++ b/core/serialization.java/src/java_descriptors.proto @@ -58,12 +58,12 @@ message JavaFieldSignature { } message JavaPropertySignature { - // A property itself is identified either by the field, or by the name of the synthetic method. - // If the property is annotated, then either field or synthetic_method_name should be present + // A property itself is identified either by the field, or by the synthetic method. + // If the property is annotated, then either field or synthetic_method should be present optional JavaFieldSignature field = 1; - // Name of the synthetic method created to store property annotations. Signature is always "()V" - optional int32 synthetic_method_name = 2; + // Annotations on properties without backing fields are written on a synthetic method with this signature + optional JavaMethodSignature synthetic_method = 2; optional JavaMethodSignature getter = 3; optional JavaMethodSignature setter = 4; diff --git a/core/serialization.java/src/org/jetbrains/jet/descriptors/serialization/JavaProtoBuf.java b/core/serialization.java/src/org/jetbrains/jet/descriptors/serialization/JavaProtoBuf.java index 21320ec6762..b356eff5890 100644 --- a/core/serialization.java/src/org/jetbrains/jet/descriptors/serialization/JavaProtoBuf.java +++ b/core/serialization.java/src/org/jetbrains/jet/descriptors/serialization/JavaProtoBuf.java @@ -1945,8 +1945,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-     * A property itself is identified either by the field, or by the name of the synthetic method.
-     * If the property is annotated, then either field or synthetic_method_name should be present
+     * A property itself is identified either by the field, or by the synthetic method.
+     * If the property is annotated, then either field or synthetic_method should be present
      * 
*/ boolean hasField(); @@ -1954,29 +1954,29 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-     * A property itself is identified either by the field, or by the name of the synthetic method.
-     * If the property is annotated, then either field or synthetic_method_name should be present
+     * A property itself is identified either by the field, or by the synthetic method.
+     * If the property is annotated, then either field or synthetic_method should be present
      * 
*/ org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature getField(); - // optional int32 synthetic_method_name = 2; + // optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-     * Name of the synthetic method created to store property annotations. Signature is always "()V"
+     * Annotations on properties without backing fields are written on a synthetic method with this signature
      * 
*/ - boolean hasSyntheticMethodName(); + boolean hasSyntheticMethod(); /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-     * Name of the synthetic method created to store property annotations. Signature is always "()V"
+     * Annotations on properties without backing fields are written on a synthetic method with this signature
      * 
*/ - int getSyntheticMethodName(); + org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature getSyntheticMethod(); // optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature getter = 3; /** @@ -2054,9 +2054,17 @@ public final class JavaProtoBuf { bitField0_ |= 0x00000001; break; } - case 16: { + case 18: { + org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.Builder subBuilder = null; + if (((bitField0_ & 0x00000002) == 0x00000002)) { + subBuilder = syntheticMethod_.toBuilder(); + } + syntheticMethod_ = input.readMessage(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(syntheticMethod_); + syntheticMethod_ = subBuilder.buildPartial(); + } bitField0_ |= 0x00000002; - syntheticMethodName_ = input.readInt32(); break; } case 26: { @@ -2119,8 +2127,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-     * A property itself is identified either by the field, or by the name of the synthetic method.
-     * If the property is annotated, then either field or synthetic_method_name should be present
+     * A property itself is identified either by the field, or by the synthetic method.
+     * If the property is annotated, then either field or synthetic_method should be present
      * 
*/ public boolean hasField() { @@ -2130,36 +2138,36 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-     * A property itself is identified either by the field, or by the name of the synthetic method.
-     * If the property is annotated, then either field or synthetic_method_name should be present
+     * A property itself is identified either by the field, or by the synthetic method.
+     * If the property is annotated, then either field or synthetic_method should be present
      * 
*/ public org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature getField() { return field_; } - // optional int32 synthetic_method_name = 2; - public static final int SYNTHETIC_METHOD_NAME_FIELD_NUMBER = 2; - private int syntheticMethodName_; + // optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; + public static final int SYNTHETIC_METHOD_FIELD_NUMBER = 2; + private org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature syntheticMethod_; /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-     * Name of the synthetic method created to store property annotations. Signature is always "()V"
+     * Annotations on properties without backing fields are written on a synthetic method with this signature
      * 
*/ - public boolean hasSyntheticMethodName() { + public boolean hasSyntheticMethod() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-     * Name of the synthetic method created to store property annotations. Signature is always "()V"
+     * Annotations on properties without backing fields are written on a synthetic method with this signature
      * 
*/ - public int getSyntheticMethodName() { - return syntheticMethodName_; + public org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature getSyntheticMethod() { + return syntheticMethod_; } // optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature getter = 3; @@ -2196,7 +2204,7 @@ public final class JavaProtoBuf { private void initFields() { field_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature.getDefaultInstance(); - syntheticMethodName_ = 0; + syntheticMethod_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance(); getter_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance(); setter_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance(); } @@ -2211,6 +2219,12 @@ public final class JavaProtoBuf { return false; } } + if (hasSyntheticMethod()) { + if (!getSyntheticMethod().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } if (hasGetter()) { if (!getGetter().isInitialized()) { memoizedIsInitialized = 0; @@ -2234,7 +2248,7 @@ public final class JavaProtoBuf { output.writeMessage(1, field_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, syntheticMethodName_); + output.writeMessage(2, syntheticMethod_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeMessage(3, getter_); @@ -2256,7 +2270,7 @@ public final class JavaProtoBuf { } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeInt32Size(2, syntheticMethodName_); + .computeMessageSize(2, syntheticMethod_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream @@ -2359,7 +2373,7 @@ public final class JavaProtoBuf { super.clear(); field_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000001); - syntheticMethodName_ = 0; + syntheticMethod_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000002); getter_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000004); @@ -2395,7 +2409,7 @@ public final class JavaProtoBuf { if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } - result.syntheticMethodName_ = syntheticMethodName_; + result.syntheticMethod_ = syntheticMethod_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } @@ -2413,8 +2427,8 @@ public final class JavaProtoBuf { if (other.hasField()) { mergeField(other.getField()); } - if (other.hasSyntheticMethodName()) { - setSyntheticMethodName(other.getSyntheticMethodName()); + if (other.hasSyntheticMethod()) { + mergeSyntheticMethod(other.getSyntheticMethod()); } if (other.hasGetter()) { mergeGetter(other.getGetter()); @@ -2432,6 +2446,12 @@ public final class JavaProtoBuf { return false; } } + if (hasSyntheticMethod()) { + if (!getSyntheticMethod().isInitialized()) { + + return false; + } + } if (hasGetter()) { if (!getGetter().isInitialized()) { @@ -2472,8 +2492,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-       * A property itself is identified either by the field, or by the name of the synthetic method.
-       * If the property is annotated, then either field or synthetic_method_name should be present
+       * A property itself is identified either by the field, or by the synthetic method.
+       * If the property is annotated, then either field or synthetic_method should be present
        * 
*/ public boolean hasField() { @@ -2483,8 +2503,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-       * A property itself is identified either by the field, or by the name of the synthetic method.
-       * If the property is annotated, then either field or synthetic_method_name should be present
+       * A property itself is identified either by the field, or by the synthetic method.
+       * If the property is annotated, then either field or synthetic_method should be present
        * 
*/ public org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature getField() { @@ -2494,8 +2514,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-       * A property itself is identified either by the field, or by the name of the synthetic method.
-       * If the property is annotated, then either field or synthetic_method_name should be present
+       * A property itself is identified either by the field, or by the synthetic method.
+       * If the property is annotated, then either field or synthetic_method should be present
        * 
*/ public Builder setField(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature value) { @@ -2511,8 +2531,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-       * A property itself is identified either by the field, or by the name of the synthetic method.
-       * If the property is annotated, then either field or synthetic_method_name should be present
+       * A property itself is identified either by the field, or by the synthetic method.
+       * If the property is annotated, then either field or synthetic_method should be present
        * 
*/ public Builder setField( @@ -2526,8 +2546,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-       * A property itself is identified either by the field, or by the name of the synthetic method.
-       * If the property is annotated, then either field or synthetic_method_name should be present
+       * A property itself is identified either by the field, or by the synthetic method.
+       * If the property is annotated, then either field or synthetic_method should be present
        * 
*/ public Builder mergeField(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature value) { @@ -2546,8 +2566,8 @@ public final class JavaProtoBuf { * optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1; * *
-       * A property itself is identified either by the field, or by the name of the synthetic method.
-       * If the property is annotated, then either field or synthetic_method_name should be present
+       * A property itself is identified either by the field, or by the synthetic method.
+       * If the property is annotated, then either field or synthetic_method should be present
        * 
*/ public Builder clearField() { @@ -2557,52 +2577,88 @@ public final class JavaProtoBuf { return this; } - // optional int32 synthetic_method_name = 2; - private int syntheticMethodName_ ; + // optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; + private org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature syntheticMethod_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance(); /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-       * Name of the synthetic method created to store property annotations. Signature is always "()V"
+       * Annotations on properties without backing fields are written on a synthetic method with this signature
        * 
*/ - public boolean hasSyntheticMethodName() { + public boolean hasSyntheticMethod() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-       * Name of the synthetic method created to store property annotations. Signature is always "()V"
+       * Annotations on properties without backing fields are written on a synthetic method with this signature
        * 
*/ - public int getSyntheticMethodName() { - return syntheticMethodName_; + public org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature getSyntheticMethod() { + return syntheticMethod_; } /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-       * Name of the synthetic method created to store property annotations. Signature is always "()V"
+       * Annotations on properties without backing fields are written on a synthetic method with this signature
        * 
*/ - public Builder setSyntheticMethodName(int value) { + public Builder setSyntheticMethod(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature value) { + if (value == null) { + throw new NullPointerException(); + } + syntheticMethod_ = value; + bitField0_ |= 0x00000002; - syntheticMethodName_ = value; - return this; } /** - * optional int32 synthetic_method_name = 2; + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; * *
-       * Name of the synthetic method created to store property annotations. Signature is always "()V"
+       * Annotations on properties without backing fields are written on a synthetic method with this signature
        * 
*/ - public Builder clearSyntheticMethodName() { + public Builder setSyntheticMethod( + org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.Builder builderForValue) { + syntheticMethod_ = builderForValue.build(); + + bitField0_ |= 0x00000002; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; + * + *
+       * Annotations on properties without backing fields are written on a synthetic method with this signature
+       * 
+ */ + public Builder mergeSyntheticMethod(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature value) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + syntheticMethod_ != org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance()) { + syntheticMethod_ = + org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.newBuilder(syntheticMethod_).mergeFrom(value).buildPartial(); + } else { + syntheticMethod_ = value; + } + + bitField0_ |= 0x00000002; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2; + * + *
+       * Annotations on properties without backing fields are written on a synthetic method with this signature
+       * 
+ */ + public Builder clearSyntheticMethod() { + syntheticMethod_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000002); - syntheticMethodName_ = 0; - return this; }