Deserialize annotations from package$src files if needed
For top-level members, we now write a FQ name of the package$src class which has the member's annotations, and read the correct file in deserialization
This commit is contained in:
@@ -69,4 +69,7 @@ extend Callable {
|
||||
optional JavaMethodSignature method_signature = 100;
|
||||
|
||||
optional JavaPropertySignature property_signature = 101;
|
||||
|
||||
// For top-level callables, short name of "...Package$src$..." class with the callable's body and annotations
|
||||
optional int32 src_class_name = 102;
|
||||
}
|
||||
|
||||
+13
@@ -9,6 +9,7 @@ public final class JavaProtoBuf {
|
||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||
registry.add(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.methodSignature);
|
||||
registry.add(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.propertySignature);
|
||||
registry.add(org.jetbrains.jet.descriptors.serialization.JavaProtoBuf.srcClassName);
|
||||
}
|
||||
public interface JavaTypeOrBuilder
|
||||
extends com.google.protobuf.MessageLiteOrBuilder {
|
||||
@@ -1979,6 +1980,18 @@ public final class JavaProtoBuf {
|
||||
null,
|
||||
101,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
||||
public static final int SRC_CLASS_NAME_FIELD_NUMBER = 102;
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable,
|
||||
java.lang.Integer> srcClassName = com.google.protobuf.GeneratedMessageLite
|
||||
.newSingularGeneratedExtension(
|
||||
org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
102,
|
||||
com.google.protobuf.WireFormat.FieldType.INT32);
|
||||
|
||||
static {
|
||||
}
|
||||
|
||||
+14
@@ -105,6 +105,12 @@ public class JavaProtoBufUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Name loadSrcClassName(@NotNull ProtoBuf.Callable proto, @NotNull NameResolver nameResolver) {
|
||||
if (!proto.hasExtension(JavaProtoBuf.srcClassName)) return null;
|
||||
return nameResolver.getName(proto.getExtension(JavaProtoBuf.srcClassName));
|
||||
}
|
||||
|
||||
public static void saveMethodSignature(@NotNull ProtoBuf.Callable.Builder proto, @NotNull Method method, @NotNull NameTable nameTable) {
|
||||
proto.setExtension(JavaProtoBuf.methodSignature, new Serializer(nameTable).methodSignature(method));
|
||||
}
|
||||
@@ -122,6 +128,14 @@ public class JavaProtoBufUtil {
|
||||
new Serializer(nameTable).propertySignature(fieldType, fieldName, syntheticMethodName, getter, setter));
|
||||
}
|
||||
|
||||
public static void saveSrcClassName(
|
||||
@NotNull ProtoBuf.Callable.Builder proto,
|
||||
@NotNull Name name,
|
||||
@NotNull NameTable nameTable
|
||||
) {
|
||||
proto.setExtension(JavaProtoBuf.srcClassName, nameTable.getSimpleNameIndex(name));
|
||||
}
|
||||
|
||||
private static class Serializer {
|
||||
private final NameTable nameTable;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user