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
This commit is contained in:
Alexander Udalov
2013-10-09 22:46:51 +04:00
parent 6e45533065
commit 806d264771
9 changed files with 166 additions and 106 deletions
@@ -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) {
@@ -30,7 +30,7 @@ import java.util.*;
public final class MemberMap {
private final Map<FunctionDescriptor, Method> methodForFunction = new HashMap<FunctionDescriptor, Method>();
private final Map<PropertyDescriptor, Pair<Type, String>> fieldForProperty = new HashMap<PropertyDescriptor, Pair<Type, String>>();
private final Map<PropertyDescriptor, String> syntheticMethodNameForProperty = new HashMap<PropertyDescriptor, String>();
private final Map<PropertyDescriptor, Method> syntheticMethodForProperty = new HashMap<PropertyDescriptor, Method>();
private final Map<CallableMemberDescriptor, String> srcClassNameForCallable = new HashMap<CallableMemberDescriptor, String>();
private final Set<PropertyDescriptor> staticFieldInOuterClass = new HashSet<PropertyDescriptor>();
@@ -46,8 +46,8 @@ public final class MemberMap {
result.recordFieldOfProperty(entry.getKey(), entry.getValue().first, entry.getValue().second);
}
for (Map.Entry<PropertyDescriptor, String> entry : map.syntheticMethodNameForProperty.entrySet()) {
result.recordSyntheticMethodNameOfProperty(entry.getKey(), entry.getValue());
for (Map.Entry<PropertyDescriptor, Method> entry : map.syntheticMethodForProperty.entrySet()) {
result.recordSyntheticMethodOfProperty(entry.getKey(), entry.getValue());
}
for (Map.Entry<CallableMemberDescriptor, String> 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();
}
}
@@ -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);
+2 -2
View File
@@ -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
@@ -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");
@@ -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
@@ -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;
@@ -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;
@@ -1945,8 +1945,8 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
boolean hasField();
@@ -1954,29 +1954,29 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature getField();
// optional int32 synthetic_method_name = 2;
// optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
boolean hasSyntheticMethodName();
boolean hasSyntheticMethod();
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
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 {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
public boolean hasField() {
@@ -2130,36 +2138,36 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
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_;
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
public boolean hasSyntheticMethodName() {
public boolean hasSyntheticMethod() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
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 {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
public boolean hasField() {
@@ -2483,8 +2503,8 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
public org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature getField() {
@@ -2494,8 +2514,8 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
public Builder setField(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature value) {
@@ -2511,8 +2531,8 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
public Builder setField(
@@ -2526,8 +2546,8 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
public Builder mergeField(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaFieldSignature value) {
@@ -2546,8 +2566,8 @@ public final class JavaProtoBuf {
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaFieldSignature field = 1;</code>
*
* <pre>
* 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
* </pre>
*/
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();
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
public boolean hasSyntheticMethodName() {
public boolean hasSyntheticMethod() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
public int getSyntheticMethodName() {
return syntheticMethodName_;
public org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature getSyntheticMethod() {
return syntheticMethod_;
}
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
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;
}
/**
* <code>optional int32 synthetic_method_name = 2;</code>
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* 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
* </pre>
*/
public Builder clearSyntheticMethodName() {
public Builder setSyntheticMethod(
org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.Builder builderForValue) {
syntheticMethod_ = builderForValue.build();
bitField0_ |= 0x00000002;
return this;
}
/**
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* Annotations on properties without backing fields are written on a synthetic method with this signature
* </pre>
*/
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;
}
/**
* <code>optional .org.jetbrains.jet.descriptors.serialization.JavaMethodSignature synthetic_method = 2;</code>
*
* <pre>
* Annotations on properties without backing fields are written on a synthetic method with this signature
* </pre>
*/
public Builder clearSyntheticMethod() {
syntheticMethod_ = org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.JavaMethodSignature.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000002);
syntheticMethodName_ = 0;
return this;
}