Drop Callable and primary/secondary constructor proto messages
This commit is contained in:
@@ -224,10 +224,10 @@ public class ClosureCodegen extends MemberCodegen<JetElement> {
|
|||||||
DescriptorSerializer serializer =
|
DescriptorSerializer serializer =
|
||||||
DescriptorSerializer.createTopLevel(new JvmSerializerExtension(v.getSerializationBindings(), typeMapper));
|
DescriptorSerializer.createTopLevel(new JvmSerializerExtension(v.getSerializationBindings(), typeMapper));
|
||||||
|
|
||||||
ProtoBuf.Callable callableProto = serializer.callableProto(funDescriptor).build();
|
ProtoBuf.Function functionProto = serializer.functionProto(funDescriptor).build();
|
||||||
|
|
||||||
AnnotationVisitor av = v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_CALLABLE), true);
|
AnnotationVisitor av = v.getVisitor().visitAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_CALLABLE), true);
|
||||||
writeAnnotationData(av, serializer, callableProto);
|
writeAnnotationData(av, serializer, functionProto);
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ public class MultifileClassPartCodegen(
|
|||||||
val serializer = DescriptorSerializer.createTopLevel(JvmSerializerExtension(bindings, state.typeMapper))
|
val serializer = DescriptorSerializer.createTopLevel(JvmSerializerExtension(bindings, state.typeMapper))
|
||||||
val packageProto = serializer.packagePartProto(members).build()
|
val packageProto = serializer.packagePartProto(members).build()
|
||||||
|
|
||||||
if (packageProto.memberCount == 0) return
|
|
||||||
|
|
||||||
val av = v.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_MULTIFILE_CLASS_PART), true)
|
val av = v.newAnnotation(AsmUtil.asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_MULTIFILE_CLASS_PART), true)
|
||||||
AsmUtil.writeAnnotationData(av, serializer, packageProto)
|
AsmUtil.writeAnnotationData(av, serializer, packageProto)
|
||||||
av.visit(JvmAnnotationNames.MULTIFILE_CLASS_NAME_FIELD_NAME, multifileClassType.internalName)
|
av.visit(JvmAnnotationNames.MULTIFILE_CLASS_NAME_FIELD_NAME, multifileClassType.internalName)
|
||||||
|
|||||||
@@ -123,8 +123,6 @@ public class PackagePartCodegen extends MemberCodegen<JetFile> {
|
|||||||
DescriptorSerializer serializer = DescriptorSerializer.createTopLevel(new JvmSerializerExtension(bindings, state.getTypeMapper()));
|
DescriptorSerializer serializer = DescriptorSerializer.createTopLevel(new JvmSerializerExtension(bindings, state.getTypeMapper()));
|
||||||
ProtoBuf.Package packageProto = serializer.packagePartProto(members).build();
|
ProtoBuf.Package packageProto = serializer.packagePartProto(members).build();
|
||||||
|
|
||||||
if (packageProto.getMemberCount() == 0) return;
|
|
||||||
|
|
||||||
AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_FILE_FACADE), true);
|
AnnotationVisitor av = v.newAnnotation(asmDescByFqNameWithoutInnerClasses(JvmAnnotationNames.KOTLIN_FILE_FACADE), true);
|
||||||
writeAnnotationData(av, serializer, packageProto);
|
writeAnnotationData(av, serializer, packageProto);
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
|
|||||||
+1
-8
@@ -64,10 +64,6 @@ public class JvmSerializerExtension extends SerializerExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeCallable(@NotNull CallableMemberDescriptor callable, @NotNull ProtoBuf.Callable.Builder proto) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serializeValueParameter(@NotNull ValueParameterDescriptor descriptor, @NotNull ProtoBuf.ValueParameter.Builder proto) {
|
public void serializeValueParameter(@NotNull ValueParameterDescriptor descriptor, @NotNull ProtoBuf.ValueParameter.Builder proto) {
|
||||||
Integer index = bindings.get(INDEX_FOR_VALUE_PARAMETER, descriptor);
|
Integer index = bindings.get(INDEX_FOR_VALUE_PARAMETER, descriptor);
|
||||||
@@ -175,10 +171,7 @@ public class JvmSerializerExtension extends SerializerExtension {
|
|||||||
if (name == null) return;
|
if (name == null) return;
|
||||||
|
|
||||||
int index = stringTable.getStringIndex(name);
|
int index = stringTable.getStringIndex(name);
|
||||||
if (proto instanceof ProtoBuf.Callable.Builder) {
|
if (proto instanceof ProtoBuf.Function.Builder) {
|
||||||
((ProtoBuf.Callable.Builder) proto).setExtension(JvmProtoBuf.oldImplClassName, index);
|
|
||||||
}
|
|
||||||
else if (proto instanceof ProtoBuf.Function.Builder) {
|
|
||||||
((ProtoBuf.Function.Builder) proto).setExtension(JvmProtoBuf.methodImplClassName, index);
|
((ProtoBuf.Function.Builder) proto).setExtension(JvmProtoBuf.methodImplClassName, index);
|
||||||
}
|
}
|
||||||
else if (proto instanceof ProtoBuf.Property.Builder) {
|
else if (proto instanceof ProtoBuf.Property.Builder) {
|
||||||
|
|||||||
-12
@@ -44,18 +44,6 @@ public class BuiltInsSerializerExtension : SerializerExtension() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun serializeCallable(callable: CallableMemberDescriptor, proto: ProtoBuf.Callable.Builder) {
|
|
||||||
for (annotation in callable.annotations) {
|
|
||||||
proto.addExtension(BuiltInsProtoBuf.oldCallableAnnotation, annotationSerializer.serializeAnnotation(annotation))
|
|
||||||
}
|
|
||||||
val propertyDescriptor = callable as? PropertyDescriptor ?: return
|
|
||||||
val compileTimeConstant = propertyDescriptor.compileTimeInitializer
|
|
||||||
if (compileTimeConstant != null && compileTimeConstant !is NullValue) {
|
|
||||||
val valueProto = annotationSerializer.valueProto(compileTimeConstant)
|
|
||||||
proto.setExtension(BuiltInsProtoBuf.oldCompileTimeValue, valueProto.build())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun serializeConstructor(descriptor: ConstructorDescriptor, proto: ProtoBuf.Constructor.Builder) {
|
override fun serializeConstructor(descriptor: ConstructorDescriptor, proto: ProtoBuf.Constructor.Builder) {
|
||||||
for (annotation in descriptor.annotations) {
|
for (annotation in descriptor.annotations) {
|
||||||
proto.addExtension(BuiltInsProtoBuf.constructorAnnotation, annotationSerializer.serializeAnnotation(annotation))
|
proto.addExtension(BuiltInsProtoBuf.constructorAnnotation, annotationSerializer.serializeAnnotation(annotation))
|
||||||
|
|||||||
-141
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
|||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.descriptors.*;
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotated;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotated;
|
||||||
import org.jetbrains.kotlin.name.Name;
|
import org.jetbrains.kotlin.name.Name;
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorFactory;
|
|
||||||
import org.jetbrains.kotlin.resolve.MemberComparator;
|
import org.jetbrains.kotlin.resolve.MemberComparator;
|
||||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||||
import org.jetbrains.kotlin.resolve.constants.NullValue;
|
import org.jetbrains.kotlin.resolve.constants.NullValue;
|
||||||
@@ -38,7 +37,6 @@ import java.io.IOException;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry;
|
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isEnumEntry;
|
||||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getSecondaryConstructors;
|
|
||||||
|
|
||||||
public class DescriptorSerializer {
|
public class DescriptorSerializer {
|
||||||
|
|
||||||
@@ -117,31 +115,14 @@ public class DescriptorSerializer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstructorDescriptor primaryConstructor = classDescriptor.getUnsubstitutedPrimaryConstructor();
|
|
||||||
if (primaryConstructor != null) {
|
|
||||||
if (DescriptorFactory.isDefaultPrimaryConstructor(primaryConstructor)) {
|
|
||||||
builder.setPrimaryConstructor(ProtoBuf.Class.PrimaryConstructor.getDefaultInstance());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ProtoBuf.Class.PrimaryConstructor.Builder constructorBuilder = ProtoBuf.Class.PrimaryConstructor.newBuilder();
|
|
||||||
constructorBuilder.setData(callableProto(primaryConstructor));
|
|
||||||
builder.setPrimaryConstructor(constructorBuilder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ConstructorDescriptor descriptor : classDescriptor.getConstructors()) {
|
for (ConstructorDescriptor descriptor : classDescriptor.getConstructors()) {
|
||||||
builder.addConstructor(constructorProto(descriptor));
|
builder.addConstructor(constructorProto(descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ConstructorDescriptor constructorDescriptor : getSecondaryConstructors(classDescriptor)) {
|
|
||||||
builder.addSecondaryConstructor(callableProto(constructorDescriptor));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (DeclarationDescriptor descriptor : sort(classDescriptor.getDefaultType().getMemberScope().getAllDescriptors())) {
|
for (DeclarationDescriptor descriptor : sort(classDescriptor.getDefaultType().getMemberScope().getAllDescriptors())) {
|
||||||
if (descriptor instanceof CallableMemberDescriptor) {
|
if (descriptor instanceof CallableMemberDescriptor) {
|
||||||
CallableMemberDescriptor member = (CallableMemberDescriptor) descriptor;
|
CallableMemberDescriptor member = (CallableMemberDescriptor) descriptor;
|
||||||
if (member.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) continue;
|
if (member.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) continue;
|
||||||
builder.addMember(callableProto(member));
|
|
||||||
|
|
||||||
if (descriptor instanceof PropertyDescriptor) {
|
if (descriptor instanceof PropertyDescriptor) {
|
||||||
builder.addProperty(propertyProto((PropertyDescriptor) descriptor));
|
builder.addProperty(propertyProto((PropertyDescriptor) descriptor));
|
||||||
@@ -309,108 +290,6 @@ public class DescriptorSerializer {
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public ProtoBuf.Callable.Builder callableProto(@NotNull CallableMemberDescriptor descriptor) {
|
|
||||||
ProtoBuf.Callable.Builder builder = ProtoBuf.Callable.newBuilder();
|
|
||||||
|
|
||||||
DescriptorSerializer local = createChildSerializer();
|
|
||||||
|
|
||||||
boolean hasGetter = false;
|
|
||||||
boolean hasSetter = false;
|
|
||||||
boolean hasConstant = false;
|
|
||||||
boolean lateInit = false;
|
|
||||||
boolean isConst = false;
|
|
||||||
boolean isOperator = false;
|
|
||||||
boolean isInfix = false;
|
|
||||||
|
|
||||||
if (descriptor instanceof FunctionDescriptor) {
|
|
||||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) descriptor;
|
|
||||||
isOperator = functionDescriptor.isOperator();
|
|
||||||
isInfix = functionDescriptor.isInfix();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (descriptor instanceof PropertyDescriptor) {
|
|
||||||
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
|
|
||||||
lateInit = propertyDescriptor.isLateInit();
|
|
||||||
isConst = propertyDescriptor.isConst();
|
|
||||||
|
|
||||||
int propertyFlags = Flags.getAccessorFlags(
|
|
||||||
hasAnnotations(propertyDescriptor),
|
|
||||||
propertyDescriptor.getVisibility(),
|
|
||||||
propertyDescriptor.getModality(),
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
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) {
|
|
||||||
hasSetter = true;
|
|
||||||
int accessorFlags = getAccessorFlags(setter);
|
|
||||||
if (accessorFlags != propertyFlags) {
|
|
||||||
builder.setSetterFlags(accessorFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!setter.isDefault()) {
|
|
||||||
for (ValueParameterDescriptor valueParameterDescriptor : setter.getValueParameters()) {
|
|
||||||
builder.addValueParameter(local.valueParameter(valueParameterDescriptor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ConstantValue<?> compileTimeConstant = propertyDescriptor.getCompileTimeInitializer();
|
|
||||||
hasConstant = !(compileTimeConstant == null || compileTimeConstant instanceof NullValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean hasAnnotations = (descriptor instanceof PropertyDescriptor)
|
|
||||||
? !descriptor.getAnnotations().getAllAnnotations().isEmpty()
|
|
||||||
: hasAnnotations(descriptor);
|
|
||||||
|
|
||||||
builder.setFlags(Flags.getCallableFlags(
|
|
||||||
hasAnnotations,
|
|
||||||
descriptor.getVisibility(),
|
|
||||||
descriptor.getModality(),
|
|
||||||
descriptor.getKind(),
|
|
||||||
callableKind(descriptor),
|
|
||||||
hasGetter,
|
|
||||||
hasSetter,
|
|
||||||
hasConstant,
|
|
||||||
lateInit,
|
|
||||||
isConst,
|
|
||||||
isOperator,
|
|
||||||
isInfix
|
|
||||||
));
|
|
||||||
|
|
||||||
for (TypeParameterDescriptor typeParameterDescriptor : descriptor.getTypeParameters()) {
|
|
||||||
builder.addTypeParameter(local.typeParameter(typeParameterDescriptor));
|
|
||||||
}
|
|
||||||
|
|
||||||
ReceiverParameterDescriptor receiverParameter = descriptor.getExtensionReceiverParameter();
|
|
||||||
if (receiverParameter != null) {
|
|
||||||
builder.setReceiverType(local.type(receiverParameter.getType()));
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.setName(getSimpleNameIndex(descriptor.getName()));
|
|
||||||
|
|
||||||
for (ValueParameterDescriptor valueParameterDescriptor : descriptor.getValueParameters()) {
|
|
||||||
builder.addValueParameter(local.valueParameter(valueParameterDescriptor));
|
|
||||||
}
|
|
||||||
|
|
||||||
//noinspection ConstantConditions
|
|
||||||
builder.setReturnType(local.type(descriptor.getReturnType()));
|
|
||||||
|
|
||||||
extension.serializeCallable(descriptor, builder);
|
|
||||||
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getAccessorFlags(@NotNull PropertyAccessorDescriptor accessor) {
|
private static int getAccessorFlags(@NotNull PropertyAccessorDescriptor accessor) {
|
||||||
return Flags.getAccessorFlags(
|
return Flags.getAccessorFlags(
|
||||||
hasAnnotations(accessor),
|
hasAnnotations(accessor),
|
||||||
@@ -420,18 +299,6 @@ public class DescriptorSerializer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private static ProtoBuf.CallableKind callableKind(@NotNull CallableMemberDescriptor descriptor) {
|
|
||||||
if (descriptor instanceof PropertyDescriptor) {
|
|
||||||
return ((PropertyDescriptor) descriptor).isVar() ? ProtoBuf.CallableKind.VAR : ProtoBuf.CallableKind.VAL;
|
|
||||||
}
|
|
||||||
if (descriptor instanceof ConstructorDescriptor) {
|
|
||||||
return ProtoBuf.CallableKind.CONSTRUCTOR;
|
|
||||||
}
|
|
||||||
assert descriptor instanceof FunctionDescriptor : "Unknown descriptor class: " + descriptor.getClass();
|
|
||||||
return ProtoBuf.CallableKind.FUN;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private ProtoBuf.ValueParameter.Builder valueParameter(@NotNull ValueParameterDescriptor descriptor) {
|
private ProtoBuf.ValueParameter.Builder valueParameter(@NotNull ValueParameterDescriptor descriptor) {
|
||||||
ProtoBuf.ValueParameter.Builder builder = ProtoBuf.ValueParameter.newBuilder();
|
ProtoBuf.ValueParameter.Builder builder = ProtoBuf.ValueParameter.newBuilder();
|
||||||
@@ -577,10 +444,6 @@ public class DescriptorSerializer {
|
|||||||
for (DeclarationDescriptor declaration : sort(members)) {
|
for (DeclarationDescriptor declaration : sort(members)) {
|
||||||
if (skip != null && skip.invoke(declaration)) continue;
|
if (skip != null && skip.invoke(declaration)) continue;
|
||||||
|
|
||||||
if (declaration instanceof PropertyDescriptor || declaration instanceof FunctionDescriptor) {
|
|
||||||
builder.addMember(callableProto((CallableMemberDescriptor) declaration));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (declaration instanceof PropertyDescriptor) {
|
if (declaration instanceof PropertyDescriptor) {
|
||||||
builder.addProperty(propertyProto((PropertyDescriptor) declaration));
|
builder.addProperty(propertyProto((PropertyDescriptor) declaration));
|
||||||
}
|
}
|
||||||
@@ -599,10 +462,6 @@ public class DescriptorSerializer {
|
|||||||
ProtoBuf.Package.Builder builder = ProtoBuf.Package.newBuilder();
|
ProtoBuf.Package.Builder builder = ProtoBuf.Package.newBuilder();
|
||||||
|
|
||||||
for (DeclarationDescriptor declaration : sort(members)) {
|
for (DeclarationDescriptor declaration : sort(members)) {
|
||||||
if (declaration instanceof PropertyDescriptor || declaration instanceof FunctionDescriptor) {
|
|
||||||
builder.addMember(callableProto((CallableMemberDescriptor) declaration));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (declaration instanceof PropertyDescriptor) {
|
if (declaration instanceof PropertyDescriptor) {
|
||||||
builder.addProperty(propertyProto((PropertyDescriptor) declaration));
|
builder.addProperty(propertyProto((PropertyDescriptor) declaration));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,6 @@ public abstract class SerializerExtension {
|
|||||||
public void serializeProperty(@NotNull PropertyDescriptor descriptor, @NotNull ProtoBuf.Property.Builder proto) {
|
public void serializeProperty(@NotNull PropertyDescriptor descriptor, @NotNull ProtoBuf.Property.Builder proto) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serializeCallable(@NotNull CallableMemberDescriptor callable, @NotNull ProtoBuf.Callable.Builder proto) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void serializeValueParameter(@NotNull ValueParameterDescriptor descriptor, @NotNull ProtoBuf.ValueParameter.Builder proto) {
|
public void serializeValueParameter(@NotNull ValueParameterDescriptor descriptor, @NotNull ProtoBuf.ValueParameter.Builder proto) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,11 @@ public class KotlinClassAnnotationTest extends CodegenTestCase {
|
|||||||
assertNotNull(strings);
|
assertNotNull(strings);
|
||||||
ClassData classData = JvmProtoBufUtil.readClassDataFrom(data, strings);
|
ClassData classData = JvmProtoBufUtil.readClassDataFrom(data, strings);
|
||||||
|
|
||||||
Set<String> callableNames = collectCallableNames(classData.getClassProto().getMemberList(), classData.getNameResolver());
|
Set<String> callableNames = collectCallableNames(
|
||||||
|
classData.getClassProto().getFunctionList(),
|
||||||
|
classData.getClassProto().getPropertyList(),
|
||||||
|
classData.getNameResolver()
|
||||||
|
);
|
||||||
assertSameElements(Arrays.asList("foo", "bar"), callableNames);
|
assertSameElements(Arrays.asList("foo", "bar"), callableNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,11 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
|||||||
assertNotNull(strings);
|
assertNotNull(strings);
|
||||||
PackageData packageData = JvmProtoBufUtil.readPackageDataFrom(data, strings);
|
PackageData packageData = JvmProtoBufUtil.readPackageDataFrom(data, strings);
|
||||||
|
|
||||||
Set<String> callableNames = collectCallableNames(packageData.getPackageProto().getMemberList(), packageData.getNameResolver());
|
Set<String> callableNames = collectCallableNames(
|
||||||
|
packageData.getPackageProto().getFunctionList(),
|
||||||
|
packageData.getPackageProto().getPropertyList(),
|
||||||
|
packageData.getNameResolver()
|
||||||
|
);
|
||||||
assertEmpty(callableNames);
|
assertEmpty(callableNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,15 +94,26 @@ public class KotlinPackageAnnotationTest extends CodegenTestCase {
|
|||||||
assertNotNull(strings);
|
assertNotNull(strings);
|
||||||
PackageData packageData = JvmProtoBufUtil.readPackageDataFrom(data, strings);
|
PackageData packageData = JvmProtoBufUtil.readPackageDataFrom(data, strings);
|
||||||
|
|
||||||
Set<String> callableNames = collectCallableNames(packageData.getPackageProto().getMemberList(), packageData.getNameResolver());
|
Set<String> callableNames = collectCallableNames(
|
||||||
|
packageData.getPackageProto().getFunctionList(),
|
||||||
|
packageData.getPackageProto().getPropertyList(),
|
||||||
|
packageData.getNameResolver()
|
||||||
|
);
|
||||||
assertSameElements(callableNames, Arrays.asList("foo", "bar"));
|
assertSameElements(callableNames, Arrays.asList("foo", "bar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static Set<String> collectCallableNames(@NotNull List<ProtoBuf.Callable> members, @NotNull NameResolver nameResolver) {
|
public static Set<String> collectCallableNames(
|
||||||
|
@NotNull List<ProtoBuf.Function> functions,
|
||||||
|
@NotNull List<ProtoBuf.Property> properties,
|
||||||
|
@NotNull NameResolver nameResolver
|
||||||
|
) {
|
||||||
Set<String> callableNames = new HashSet<String>();
|
Set<String> callableNames = new HashSet<String>();
|
||||||
for (ProtoBuf.Callable callable : members) {
|
for (ProtoBuf.Function function : functions) {
|
||||||
callableNames.add(nameResolver.getName(callable.getName()).asString());
|
callableNames.add(nameResolver.getName(function.getName()).asString());
|
||||||
|
}
|
||||||
|
for (ProtoBuf.Property property : properties) {
|
||||||
|
callableNames.add(nameResolver.getName(property.getName()).asString());
|
||||||
}
|
}
|
||||||
return callableNames;
|
return callableNames;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+27
-59
@@ -9,8 +9,6 @@ public final class DebugBuiltInsProtoBuf {
|
|||||||
com.google.protobuf.ExtensionRegistry registry) {
|
com.google.protobuf.ExtensionRegistry registry) {
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.className);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.className);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.classAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.classAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.oldCallableAnnotation);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.oldCompileTimeValue);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
|
||||||
@@ -40,28 +38,6 @@ public final class DebugBuiltInsProtoBuf {
|
|||||||
.newFileScopedGeneratedExtension(
|
.newFileScopedGeneratedExtension(
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||||
public static final int OLD_CALLABLE_ANNOTATION_FIELD_NUMBER = 150;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable,
|
|
||||||
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> oldCallableAnnotation = com.google.protobuf.GeneratedMessage
|
|
||||||
.newFileScopedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
|
||||||
public static final int OLD_COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value> oldCompileTimeValue = com.google.protobuf.GeneratedMessage
|
|
||||||
.newFileScopedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.class,
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
|
|
||||||
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
|
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
|
||||||
/**
|
/**
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
||||||
@@ -145,33 +121,27 @@ public final class DebugBuiltInsProtoBuf {
|
|||||||
"e\030\226\001 \003(\005B\002\020\001:t\n\020class_annotation\022).org.j" +
|
"e\030\226\001 \003(\005B\002\020\001:t\n\020class_annotation\022).org.j" +
|
||||||
"etbrains.kotlin.serialization.Class\030\226\001 \003" +
|
"etbrains.kotlin.serialization.Class\030\226\001 \003" +
|
||||||
"(\0132..org.jetbrains.kotlin.serialization." +
|
"(\0132..org.jetbrains.kotlin.serialization." +
|
||||||
"Annotation:~\n\027old_callable_annotation\022,." +
|
"Annotation:\200\001\n\026constructor_annotation\022/." +
|
||||||
"org.jetbrains.kotlin.serialization.Calla",
|
"org.jetbrains.kotlin.serialization.Const",
|
||||||
"ble\030\226\001 \003(\0132..org.jetbrains.kotlin.serial" +
|
"ructor\030\226\001 \003(\0132..org.jetbrains.kotlin.ser" +
|
||||||
"ization.Annotation:\214\001\n\026old_compile_time_" +
|
"ialization.Annotation:z\n\023function_annota" +
|
||||||
"value\022,.org.jetbrains.kotlin.serializati" +
|
"tion\022,.org.jetbrains.kotlin.serializatio" +
|
||||||
"on.Callable\030\227\001 \001(\0132=.org.jetbrains.kotli" +
|
"n.Function\030\226\001 \003(\0132..org.jetbrains.kotlin" +
|
||||||
"n.serialization.Annotation.Argument.Valu" +
|
".serialization.Annotation:z\n\023property_an" +
|
||||||
"e:\200\001\n\026constructor_annotation\022/.org.jetbr" +
|
"notation\022,.org.jetbrains.kotlin.serializ" +
|
||||||
"ains.kotlin.serialization.Constructor\030\226\001" +
|
"ation.Property\030\226\001 \003(\0132..org.jetbrains.ko" +
|
||||||
" \003(\0132..org.jetbrains.kotlin.serializatio" +
|
"tlin.serialization.Annotation:\210\001\n\022compil" +
|
||||||
"n.Annotation:z\n\023function_annotation\022,.or" +
|
"e_time_value\022,.org.jetbrains.kotlin.seri" +
|
||||||
"g.jetbrains.kotlin.serialization.Functio",
|
"alization.Property\030\227\001 \001(\0132=.org.jetbrain",
|
||||||
"n\030\226\001 \003(\0132..org.jetbrains.kotlin.serializ" +
|
"s.kotlin.serialization.Annotation.Argume" +
|
||||||
"ation.Annotation:z\n\023property_annotation\022" +
|
"nt.Value:\201\001\n\024parameter_annotation\0222.org." +
|
||||||
",.org.jetbrains.kotlin.serialization.Pro" +
|
"jetbrains.kotlin.serialization.ValuePara" +
|
||||||
"perty\030\226\001 \003(\0132..org.jetbrains.kotlin.seri" +
|
"meter\030\226\001 \003(\0132..org.jetbrains.kotlin.seri" +
|
||||||
"alization.Annotation:\210\001\n\022compile_time_va" +
|
"alization.Annotation:r\n\017type_annotation\022" +
|
||||||
"lue\022,.org.jetbrains.kotlin.serialization" +
|
"(.org.jetbrains.kotlin.serialization.Typ" +
|
||||||
".Property\030\227\001 \001(\0132=.org.jetbrains.kotlin." +
|
"e\030\226\001 \003(\0132..org.jetbrains.kotlin.serializ" +
|
||||||
"serialization.Annotation.Argument.Value:" +
|
"ation.AnnotationB\027B\025DebugBuiltInsProtoBu" +
|
||||||
"\201\001\n\024parameter_annotation\0222.org.jetbrains" +
|
"f"
|
||||||
".kotlin.serialization.ValueParameter\030\226\001 ",
|
|
||||||
"\003(\0132..org.jetbrains.kotlin.serialization" +
|
|
||||||
".Annotation:r\n\017type_annotation\022(.org.jet" +
|
|
||||||
"brains.kotlin.serialization.Type\030\226\001 \003(\0132" +
|
|
||||||
"..org.jetbrains.kotlin.serialization.Ann" +
|
|
||||||
"otationB\027B\025DebugBuiltInsProtoBuf"
|
|
||||||
};
|
};
|
||||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||||
@@ -180,14 +150,12 @@ public final class DebugBuiltInsProtoBuf {
|
|||||||
descriptor = root;
|
descriptor = root;
|
||||||
className.internalInit(descriptor.getExtensions().get(0));
|
className.internalInit(descriptor.getExtensions().get(0));
|
||||||
classAnnotation.internalInit(descriptor.getExtensions().get(1));
|
classAnnotation.internalInit(descriptor.getExtensions().get(1));
|
||||||
oldCallableAnnotation.internalInit(descriptor.getExtensions().get(2));
|
constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
|
||||||
oldCompileTimeValue.internalInit(descriptor.getExtensions().get(3));
|
functionAnnotation.internalInit(descriptor.getExtensions().get(3));
|
||||||
constructorAnnotation.internalInit(descriptor.getExtensions().get(4));
|
propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
|
||||||
functionAnnotation.internalInit(descriptor.getExtensions().get(5));
|
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
|
||||||
propertyAnnotation.internalInit(descriptor.getExtensions().get(6));
|
parameterAnnotation.internalInit(descriptor.getExtensions().get(6));
|
||||||
compileTimeValue.internalInit(descriptor.getExtensions().get(7));
|
typeAnnotation.internalInit(descriptor.getExtensions().get(7));
|
||||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(8));
|
|
||||||
typeAnnotation.internalInit(descriptor.getExtensions().get(9));
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ public final class DebugJsProtoBuf {
|
|||||||
public static void registerAllExtensions(
|
public static void registerAllExtensions(
|
||||||
com.google.protobuf.ExtensionRegistry registry) {
|
com.google.protobuf.ExtensionRegistry registry) {
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.classAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.classAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.oldCallableAnnotation);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.oldCompileTimeValue);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.constructorAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.constructorAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.functionAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.functionAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.propertyAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.DebugJsProtoBuf.propertyAnnotation);
|
||||||
@@ -1816,28 +1814,6 @@ public final class DebugJsProtoBuf {
|
|||||||
.newFileScopedGeneratedExtension(
|
.newFileScopedGeneratedExtension(
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||||
public static final int OLD_CALLABLE_ANNOTATION_FIELD_NUMBER = 130;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable,
|
|
||||||
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> oldCallableAnnotation = com.google.protobuf.GeneratedMessage
|
|
||||||
.newFileScopedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
|
|
||||||
public static final int OLD_COMPILE_TIME_VALUE_FIELD_NUMBER = 131;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value> oldCompileTimeValue = com.google.protobuf.GeneratedMessage
|
|
||||||
.newFileScopedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.class,
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
|
|
||||||
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 130;
|
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 130;
|
||||||
/**
|
/**
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
||||||
@@ -1938,33 +1914,26 @@ public final class DebugJsProtoBuf {
|
|||||||
"ent\030\002 \002(\014:t\n\020class_annotation\022).org.jetb" +
|
"ent\030\002 \002(\014:t\n\020class_annotation\022).org.jetb" +
|
||||||
"rains.kotlin.serialization.Class\030\202\001 \003(\0132" +
|
"rains.kotlin.serialization.Class\030\202\001 \003(\0132" +
|
||||||
"..org.jetbrains.kotlin.serialization.Ann",
|
"..org.jetbrains.kotlin.serialization.Ann",
|
||||||
"otation:~\n\027old_callable_annotation\022,.org" +
|
"otation:\200\001\n\026constructor_annotation\022/.org" +
|
||||||
".jetbrains.kotlin.serialization.Callable" +
|
".jetbrains.kotlin.serialization.Construc" +
|
||||||
"\030\202\001 \003(\0132..org.jetbrains.kotlin.serializa" +
|
"tor\030\202\001 \003(\0132..org.jetbrains.kotlin.serial" +
|
||||||
"tion.Annotation:\214\001\n\026old_compile_time_val" +
|
"ization.Annotation:z\n\023function_annotatio" +
|
||||||
"ue\022,.org.jetbrains.kotlin.serialization." +
|
"n\022,.org.jetbrains.kotlin.serialization.F" +
|
||||||
"Callable\030\203\001 \001(\0132=.org.jetbrains.kotlin.s" +
|
"unction\030\202\001 \003(\0132..org.jetbrains.kotlin.se" +
|
||||||
"erialization.Annotation.Argument.Value:\200" +
|
"rialization.Annotation:z\n\023property_annot" +
|
||||||
"\001\n\026constructor_annotation\022/.org.jetbrain" +
|
"ation\022,.org.jetbrains.kotlin.serializati" +
|
||||||
"s.kotlin.serialization.Constructor\030\202\001 \003(" +
|
"on.Property\030\202\001 \003(\0132..org.jetbrains.kotli" +
|
||||||
"\0132..org.jetbrains.kotlin.serialization.A",
|
"n.serialization.Annotation:\210\001\n\022compile_t",
|
||||||
"nnotation:z\n\023function_annotation\022,.org.j" +
|
"ime_value\022,.org.jetbrains.kotlin.seriali" +
|
||||||
"etbrains.kotlin.serialization.Function\030\202" +
|
"zation.Property\030\203\001 \001(\0132=.org.jetbrains.k" +
|
||||||
|
"otlin.serialization.Annotation.Argument." +
|
||||||
|
"Value:\201\001\n\024parameter_annotation\0222.org.jet" +
|
||||||
|
"brains.kotlin.serialization.ValueParamet" +
|
||||||
|
"er\030\202\001 \003(\0132..org.jetbrains.kotlin.seriali" +
|
||||||
|
"zation.Annotation:r\n\017type_annotation\022(.o" +
|
||||||
|
"rg.jetbrains.kotlin.serialization.Type\030\202" +
|
||||||
"\001 \003(\0132..org.jetbrains.kotlin.serializati" +
|
"\001 \003(\0132..org.jetbrains.kotlin.serializati" +
|
||||||
"on.Annotation:z\n\023property_annotation\022,.o" +
|
"on.AnnotationB\021B\017DebugJsProtoBuf"
|
||||||
"rg.jetbrains.kotlin.serialization.Proper" +
|
|
||||||
"ty\030\202\001 \003(\0132..org.jetbrains.kotlin.seriali" +
|
|
||||||
"zation.Annotation:\210\001\n\022compile_time_value" +
|
|
||||||
"\022,.org.jetbrains.kotlin.serialization.Pr" +
|
|
||||||
"operty\030\203\001 \001(\0132=.org.jetbrains.kotlin.ser" +
|
|
||||||
"ialization.Annotation.Argument.Value:\201\001\n",
|
|
||||||
"\024parameter_annotation\0222.org.jetbrains.ko" +
|
|
||||||
"tlin.serialization.ValueParameter\030\202\001 \003(\013" +
|
|
||||||
"2..org.jetbrains.kotlin.serialization.An" +
|
|
||||||
"notation:r\n\017type_annotation\022(.org.jetbra" +
|
|
||||||
"ins.kotlin.serialization.Type\030\202\001 \003(\0132..o" +
|
|
||||||
"rg.jetbrains.kotlin.serialization.Annota" +
|
|
||||||
"tionB\021B\017DebugJsProtoBuf"
|
|
||||||
};
|
};
|
||||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||||
@@ -1990,14 +1959,12 @@ public final class DebugJsProtoBuf {
|
|||||||
internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor,
|
internal_static_org_jetbrains_kotlin_serialization_js_Library_FileEntry_descriptor,
|
||||||
new java.lang.String[] { "Path", "Content", });
|
new java.lang.String[] { "Path", "Content", });
|
||||||
classAnnotation.internalInit(descriptor.getExtensions().get(0));
|
classAnnotation.internalInit(descriptor.getExtensions().get(0));
|
||||||
oldCallableAnnotation.internalInit(descriptor.getExtensions().get(1));
|
constructorAnnotation.internalInit(descriptor.getExtensions().get(1));
|
||||||
oldCompileTimeValue.internalInit(descriptor.getExtensions().get(2));
|
functionAnnotation.internalInit(descriptor.getExtensions().get(2));
|
||||||
constructorAnnotation.internalInit(descriptor.getExtensions().get(3));
|
propertyAnnotation.internalInit(descriptor.getExtensions().get(3));
|
||||||
functionAnnotation.internalInit(descriptor.getExtensions().get(4));
|
compileTimeValue.internalInit(descriptor.getExtensions().get(4));
|
||||||
propertyAnnotation.internalInit(descriptor.getExtensions().get(5));
|
parameterAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||||
compileTimeValue.internalInit(descriptor.getExtensions().get(6));
|
typeAnnotation.internalInit(descriptor.getExtensions().get(6));
|
||||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(7));
|
|
||||||
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ public final class DebugJvmProtoBuf {
|
|||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.methodImplClassName);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.methodImplClassName);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.propertySignature);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.propertySignature);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.propertyImplClassName);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.propertyImplClassName);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.oldMethodSignature);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.oldPropertySignature);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.oldImplClassName);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.typeAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.typeAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.isRaw);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.isRaw);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.index);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.index);
|
||||||
@@ -4581,39 +4578,6 @@ public final class DebugJvmProtoBuf {
|
|||||||
.newFileScopedGeneratedExtension(
|
.newFileScopedGeneratedExtension(
|
||||||
java.lang.Integer.class,
|
java.lang.Integer.class,
|
||||||
null);
|
null);
|
||||||
public static final int OLD_METHOD_SIGNATURE_FIELD_NUMBER = 100;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmMethodSignature> oldMethodSignature = com.google.protobuf.GeneratedMessage
|
|
||||||
.newFileScopedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmMethodSignature.class,
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance());
|
|
||||||
public static final int OLD_PROPERTY_SIGNATURE_FIELD_NUMBER = 101;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmPropertySignature> oldPropertySignature = com.google.protobuf.GeneratedMessage
|
|
||||||
.newFileScopedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmPropertySignature.class,
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmPropertySignature.getDefaultInstance());
|
|
||||||
public static final int OLD_IMPL_CLASS_NAME_FIELD_NUMBER = 102;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Callable,
|
|
||||||
java.lang.Integer> oldImplClassName = com.google.protobuf.GeneratedMessage
|
|
||||||
.newFileScopedGeneratedExtension(
|
|
||||||
java.lang.Integer.class,
|
|
||||||
null);
|
|
||||||
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 100;
|
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 100;
|
||||||
/**
|
/**
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
|
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
|
||||||
@@ -4734,25 +4698,16 @@ public final class DebugJvmProtoBuf {
|
|||||||
"serialization.jvm.JvmPropertySignature:T",
|
"serialization.jvm.JvmPropertySignature:T",
|
||||||
"\n\030property_impl_class_name\022,.org.jetbrai" +
|
"\n\030property_impl_class_name\022,.org.jetbrai" +
|
||||||
"ns.kotlin.serialization.Property\030e \001(\005B\004" +
|
"ns.kotlin.serialization.Property\030e \001(\005B\004" +
|
||||||
"\230\265\030\001:\206\001\n\024old_method_signature\022,.org.jetb" +
|
"\230\265\030\001:q\n\017type_annotation\022(.org.jetbrains." +
|
||||||
"rains.kotlin.serialization.Callable\030d \001(" +
|
"kotlin.serialization.Type\030d \003(\0132..org.je" +
|
||||||
"\0132:.org.jetbrains.kotlin.serialization.j" +
|
"tbrains.kotlin.serialization.Annotation:" +
|
||||||
"vm.JvmMethodSignature:\212\001\n\026old_property_s" +
|
"8\n\006is_raw\022(.org.jetbrains.kotlin.seriali" +
|
||||||
"ignature\022,.org.jetbrains.kotlin.serializ" +
|
"zation.Type\030e \001(\010:A\n\005index\0222.org.jetbrai" +
|
||||||
"ation.Callable\030e \001(\0132<.org.jetbrains.kot" +
|
"ns.kotlin.serialization.ValueParameter\030d" +
|
||||||
"lin.serialization.jvm.JvmPropertySignatu" +
|
" \001(\005:s\n\020class_annotation\022).org.jetbrains" +
|
||||||
"re:O\n\023old_impl_class_name\022,.org.jetbrain",
|
".kotlin.serialization.Class\030d \003(\0132..org.",
|
||||||
"s.kotlin.serialization.Callable\030f \001(\005B\004\210" +
|
"jetbrains.kotlin.serialization.Annotatio" +
|
||||||
"\265\030\001:q\n\017type_annotation\022(.org.jetbrains.k" +
|
"nB\022B\020DebugJvmProtoBuf"
|
||||||
"otlin.serialization.Type\030d \003(\0132..org.jet" +
|
|
||||||
"brains.kotlin.serialization.Annotation:8" +
|
|
||||||
"\n\006is_raw\022(.org.jetbrains.kotlin.serializ" +
|
|
||||||
"ation.Type\030e \001(\010:A\n\005index\0222.org.jetbrain" +
|
|
||||||
"s.kotlin.serialization.ValueParameter\030d " +
|
|
||||||
"\001(\005:s\n\020class_annotation\022).org.jetbrains." +
|
|
||||||
"kotlin.serialization.Class\030d \003(\0132..org.j" +
|
|
||||||
"etbrains.kotlin.serialization.Annotation",
|
|
||||||
"B\022B\020DebugJvmProtoBuf"
|
|
||||||
};
|
};
|
||||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||||
@@ -4794,13 +4749,10 @@ public final class DebugJvmProtoBuf {
|
|||||||
methodImplClassName.internalInit(descriptor.getExtensions().get(2));
|
methodImplClassName.internalInit(descriptor.getExtensions().get(2));
|
||||||
propertySignature.internalInit(descriptor.getExtensions().get(3));
|
propertySignature.internalInit(descriptor.getExtensions().get(3));
|
||||||
propertyImplClassName.internalInit(descriptor.getExtensions().get(4));
|
propertyImplClassName.internalInit(descriptor.getExtensions().get(4));
|
||||||
oldMethodSignature.internalInit(descriptor.getExtensions().get(5));
|
typeAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||||
oldPropertySignature.internalInit(descriptor.getExtensions().get(6));
|
isRaw.internalInit(descriptor.getExtensions().get(6));
|
||||||
oldImplClassName.internalInit(descriptor.getExtensions().get(7));
|
index.internalInit(descriptor.getExtensions().get(7));
|
||||||
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
|
classAnnotation.internalInit(descriptor.getExtensions().get(8));
|
||||||
isRaw.internalInit(descriptor.getExtensions().get(9));
|
|
||||||
index.internalInit(descriptor.getExtensions().get(10));
|
|
||||||
classAnnotation.internalInit(descriptor.getExtensions().get(11));
|
|
||||||
com.google.protobuf.ExtensionRegistry registry =
|
com.google.protobuf.ExtensionRegistry registry =
|
||||||
com.google.protobuf.ExtensionRegistry.newInstance();
|
com.google.protobuf.ExtensionRegistry.newInstance();
|
||||||
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
||||||
@@ -4809,7 +4761,6 @@ public final class DebugJvmProtoBuf {
|
|||||||
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable);
|
|
||||||
return registry;
|
return registry;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -111,13 +111,6 @@ extend Property {
|
|||||||
optional int32 property_impl_class_name = 101 [(string_id_in_table) = true];
|
optional int32 property_impl_class_name = 101 [(string_id_in_table) = true];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: drop
|
|
||||||
extend Callable {
|
|
||||||
optional JvmMethodSignature old_method_signature = 100;
|
|
||||||
optional JvmPropertySignature old_property_signature = 101;
|
|
||||||
optional int32 old_impl_class_name = 102 [(name_id_in_table) = true];
|
|
||||||
}
|
|
||||||
|
|
||||||
extend Type {
|
extend Type {
|
||||||
repeated Annotation type_annotation = 100;
|
repeated Annotation type_annotation = 100;
|
||||||
optional bool is_raw = 101;
|
optional bool is_raw = 101;
|
||||||
|
|||||||
+5
-51
@@ -104,25 +104,6 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
|
|||||||
|
|
||||||
loadPropertyAnnotations(propertyAnnotations, fieldAnnotations)
|
loadPropertyAnnotations(propertyAnnotations, fieldAnnotations)
|
||||||
}
|
}
|
||||||
is ProtoBuf.Callable -> {
|
|
||||||
val nameResolver = container.nameResolver
|
|
||||||
if (kind == AnnotatedCallableKind.PROPERTY) {
|
|
||||||
val syntheticFunctionSignature = getPropertySignature(proto, nameResolver, synthetic = true)
|
|
||||||
val fieldSignature = getPropertySignature(proto, nameResolver, field = true)
|
|
||||||
|
|
||||||
val propertyAnnotations = syntheticFunctionSignature?.let { sig ->
|
|
||||||
findClassAndLoadMemberAnnotations(container, proto, sig)
|
|
||||||
} ?: listOf()
|
|
||||||
|
|
||||||
val fieldAnnotations = fieldSignature?.let { sig ->
|
|
||||||
findClassAndLoadMemberAnnotations(container, proto, sig, isStaticFieldInOuter(proto))
|
|
||||||
} ?: listOf()
|
|
||||||
|
|
||||||
return loadPropertyAnnotations(propertyAnnotations, fieldAnnotations)
|
|
||||||
}
|
|
||||||
val signature = getCallableSignature(proto, nameResolver, kind) ?: return emptyList()
|
|
||||||
transformAnnotations(findClassAndLoadMemberAnnotations(container, proto, signature))
|
|
||||||
}
|
|
||||||
else -> emptyList()
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,19 +212,13 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
|
|||||||
nameResolver.getName(proto.getExtension(methodImplClassName))
|
nameResolver.getName(proto.getExtension(methodImplClassName))
|
||||||
proto is ProtoBuf.Property && proto.hasExtension(propertyImplClassName) ->
|
proto is ProtoBuf.Property && proto.hasExtension(propertyImplClassName) ->
|
||||||
nameResolver.getName(proto.getExtension(propertyImplClassName))
|
nameResolver.getName(proto.getExtension(propertyImplClassName))
|
||||||
proto is ProtoBuf.Callable && proto.hasExtension(oldImplClassName) ->
|
|
||||||
nameResolver.getName(proto.getExtension(oldImplClassName))
|
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isStaticFieldInOuter(proto: MessageLite): Boolean =
|
private fun isStaticFieldInOuter(proto: MessageLite): Boolean =
|
||||||
when {
|
if (proto is ProtoBuf.Property && proto.hasExtension(propertySignature))
|
||||||
proto is ProtoBuf.Property && proto.hasExtension(propertySignature) ->
|
proto.getExtension(propertySignature).let { it.hasField() && it.field.isStaticInOuter }
|
||||||
proto.getExtension(propertySignature).let { it.hasField() && it.field.isStaticInOuter }
|
else false
|
||||||
proto is ProtoBuf.Callable && proto.hasExtension(oldPropertySignature) ->
|
|
||||||
proto.getExtension(oldPropertySignature).let { it.hasField() && it.field.isStaticInOuter }
|
|
||||||
else -> false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun loadAnnotationsAndInitializers(kotlinClass: KotlinJvmBinaryClass): Storage<A, C> {
|
private fun loadAnnotationsAndInitializers(kotlinClass: KotlinJvmBinaryClass): Storage<A, C> {
|
||||||
val memberAnnotations = HashMap<MemberSignature, MutableList<A>>()
|
val memberAnnotations = HashMap<MemberSignature, MutableList<A>>()
|
||||||
@@ -300,16 +275,13 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getPropertySignature(
|
private fun getPropertySignature(
|
||||||
proto: MessageLite,
|
proto: ProtoBuf.Property,
|
||||||
nameResolver: NameResolver,
|
nameResolver: NameResolver,
|
||||||
field: Boolean = false,
|
field: Boolean = false,
|
||||||
synthetic: Boolean = false
|
synthetic: Boolean = false
|
||||||
): MemberSignature? {
|
): MemberSignature? {
|
||||||
val signature =
|
val signature =
|
||||||
if (proto is ProtoBuf.Property && proto.hasExtension(propertySignature))
|
if (proto.hasExtension(propertySignature)) proto.getExtension(propertySignature)
|
||||||
proto.getExtension(propertySignature)
|
|
||||||
else if (proto is ProtoBuf.Callable && proto.hasExtension(oldPropertySignature))
|
|
||||||
proto.getExtension(oldPropertySignature)
|
|
||||||
else return null
|
else return null
|
||||||
|
|
||||||
if (field && signature.hasField()) {
|
if (field && signature.hasField()) {
|
||||||
@@ -339,24 +311,6 @@ public abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proto is ProtoBuf.Callable -> {
|
|
||||||
when (kind) {
|
|
||||||
AnnotatedCallableKind.FUNCTION ->
|
|
||||||
if (proto.hasExtension(oldMethodSignature))
|
|
||||||
MemberSignature.fromMethod(nameResolver, proto.getExtension(oldMethodSignature))
|
|
||||||
else null
|
|
||||||
AnnotatedCallableKind.PROPERTY_GETTER ->
|
|
||||||
if (proto.hasExtension(oldPropertySignature))
|
|
||||||
MemberSignature.fromMethod(nameResolver, proto.getExtension(oldPropertySignature).getter)
|
|
||||||
else null
|
|
||||||
AnnotatedCallableKind.PROPERTY_SETTER ->
|
|
||||||
if (proto.hasExtension(oldPropertySignature))
|
|
||||||
MemberSignature.fromMethod(nameResolver, proto.getExtension(oldPropertySignature).setter)
|
|
||||||
else null
|
|
||||||
AnnotatedCallableKind.PROPERTY ->
|
|
||||||
getPropertySignature(proto, nameResolver, true, true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-48
@@ -12,9 +12,6 @@ public final class JvmProtoBuf {
|
|||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.methodImplClassName);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.methodImplClassName);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.propertySignature);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.propertySignature);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.propertyImplClassName);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.propertyImplClassName);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.oldMethodSignature);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.oldPropertySignature);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.oldImplClassName);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.typeAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.typeAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.isRaw);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.isRaw);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.index);
|
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.index);
|
||||||
@@ -3788,51 +3785,6 @@ public final class JvmProtoBuf {
|
|||||||
null,
|
null,
|
||||||
101,
|
101,
|
||||||
com.google.protobuf.WireFormat.FieldType.INT32);
|
com.google.protobuf.WireFormat.FieldType.INT32);
|
||||||
public static final int OLD_METHOD_SIGNATURE_FIELD_NUMBER = 100;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.JvmMethodSignature> oldMethodSignature = com.google.protobuf.GeneratedMessageLite
|
|
||||||
.newSingularGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.JvmMethodSignature.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.JvmMethodSignature.getDefaultInstance(),
|
|
||||||
null,
|
|
||||||
100,
|
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
|
||||||
public static final int OLD_PROPERTY_SIGNATURE_FIELD_NUMBER = 101;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.JvmPropertySignature> oldPropertySignature = com.google.protobuf.GeneratedMessageLite
|
|
||||||
.newSingularGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.JvmPropertySignature.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.JvmPropertySignature.getDefaultInstance(),
|
|
||||||
null,
|
|
||||||
101,
|
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
|
||||||
public static final int OLD_IMPL_CLASS_NAME_FIELD_NUMBER = 102;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable,
|
|
||||||
java.lang.Integer> oldImplClassName = com.google.protobuf.GeneratedMessageLite
|
|
||||||
.newSingularGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
|
||||||
0,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
102,
|
|
||||||
com.google.protobuf.WireFormat.FieldType.INT32);
|
|
||||||
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 100;
|
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 100;
|
||||||
/**
|
/**
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
|
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
|
||||||
|
|||||||
+6
-3
@@ -44,9 +44,12 @@ class BuiltInsAnnotationAndConstantLoader(
|
|||||||
proto: MessageLite,
|
proto: MessageLite,
|
||||||
kind: AnnotatedCallableKind
|
kind: AnnotatedCallableKind
|
||||||
): List<AnnotationWithTarget> {
|
): List<AnnotationWithTarget> {
|
||||||
proto as ProtoBuf.Callable // TODO
|
val annotations = when (proto) {
|
||||||
|
is ProtoBuf.Constructor -> proto.getExtension(BuiltInsProtoBuf.constructorAnnotation)
|
||||||
val annotations = proto.getExtension(BuiltInsProtoBuf.oldCallableAnnotation).orEmpty()
|
is ProtoBuf.Function -> proto.getExtension(BuiltInsProtoBuf.functionAnnotation)
|
||||||
|
is ProtoBuf.Property -> proto.getExtension(BuiltInsProtoBuf.propertyAnnotation)
|
||||||
|
else -> error("Unknown message: $proto")
|
||||||
|
}.orEmpty()
|
||||||
return annotations.map { proto -> AnnotationWithTarget(deserializer.deserializeAnnotation(proto, container.nameResolver), null) }
|
return annotations.map { proto -> AnnotationWithTarget(deserializer.deserializeAnnotation(proto, container.nameResolver), null) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,10 +110,6 @@ public class DescriptorFactory {
|
|||||||
return new DefaultConstructorDescriptor(containingClass, source);
|
return new DefaultConstructorDescriptor(containingClass, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDefaultPrimaryConstructor(@NotNull ConstructorDescriptor constructor) {
|
|
||||||
return constructor instanceof DefaultConstructorDescriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static SimpleFunctionDescriptor createEnumValuesMethod(@NotNull ClassDescriptor enumClass) {
|
public static SimpleFunctionDescriptor createEnumValuesMethod(@NotNull ClassDescriptor enumClass) {
|
||||||
SimpleFunctionDescriptorImpl values =
|
SimpleFunctionDescriptorImpl values =
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ extend Class {
|
|||||||
repeated Annotation class_annotation = 150;
|
repeated Annotation class_annotation = 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
extend Callable {
|
|
||||||
repeated Annotation old_callable_annotation = 150;
|
|
||||||
optional Annotation.Argument.Value old_compile_time_value = 151;
|
|
||||||
}
|
|
||||||
|
|
||||||
extend Constructor {
|
extend Constructor {
|
||||||
repeated Annotation constructor_annotation = 150;
|
repeated Annotation constructor_annotation = 150;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,28 +177,12 @@ message Class {
|
|||||||
repeated Function function = 9;
|
repeated Function function = 9;
|
||||||
repeated Property property = 10;
|
repeated Property property = 10;
|
||||||
|
|
||||||
repeated Callable member = 11;
|
|
||||||
|
|
||||||
repeated int32 enum_entry = 12 [packed = true, (name_id_in_table) = true];
|
repeated int32 enum_entry = 12 [packed = true, (name_id_in_table) = true];
|
||||||
|
|
||||||
message PrimaryConstructor {
|
|
||||||
// If this field is present, it contains serialized data for the primary constructor.
|
|
||||||
// Otherwise it's default and can be created manually upon deserialization
|
|
||||||
// Note: currently only objects have default primary constructor
|
|
||||||
optional Callable data = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This field is present if and only if the class has a primary constructor
|
|
||||||
optional PrimaryConstructor primary_constructor = 13;
|
|
||||||
repeated Callable secondary_constructor = 14;
|
|
||||||
|
|
||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Package {
|
message Package {
|
||||||
repeated Callable member = 1;
|
|
||||||
|
|
||||||
repeated Constructor constructor = 2;
|
|
||||||
repeated Function function = 3;
|
repeated Function function = 3;
|
||||||
repeated Property property = 4;
|
repeated Property property = 4;
|
||||||
|
|
||||||
@@ -279,46 +263,6 @@ message Property {
|
|||||||
extensions 100 to 199;
|
extensions 100 to 199;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Callable {
|
|
||||||
/*
|
|
||||||
Visibility
|
|
||||||
Modality
|
|
||||||
hasAnnotations
|
|
||||||
CallableKind
|
|
||||||
MemberKind
|
|
||||||
hasGetter
|
|
||||||
hasSetter
|
|
||||||
hasConstant
|
|
||||||
isConst
|
|
||||||
lateinit
|
|
||||||
isOperator
|
|
||||||
isInfix
|
|
||||||
*/
|
|
||||||
optional int32 flags = 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
isNotDefault
|
|
||||||
Visibility
|
|
||||||
Modality
|
|
||||||
hasAnnotations
|
|
||||||
*/
|
|
||||||
optional int32 getter_flags = 9 /* absent => same as property */;
|
|
||||||
optional int32 setter_flags = 10 /* absent => same as property */;
|
|
||||||
|
|
||||||
repeated TypeParameter type_parameter = 4;
|
|
||||||
|
|
||||||
optional Type receiver_type = 5;
|
|
||||||
|
|
||||||
required int32 name = 6 [(name_id_in_table) = true];
|
|
||||||
|
|
||||||
// Value parameters for functions and constructors, or setter value parameter for properties
|
|
||||||
repeated ValueParameter value_parameter = 7;
|
|
||||||
|
|
||||||
required Type return_type = 8;
|
|
||||||
|
|
||||||
extensions 100 to 199;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ValueParameter {
|
message ValueParameter {
|
||||||
/*
|
/*
|
||||||
declaresDefault
|
declaresDefault
|
||||||
@@ -353,14 +297,6 @@ enum Visibility {
|
|||||||
LOCAL = 0x05;
|
LOCAL = 0x05;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum CallableKind {
|
|
||||||
// 2 bits
|
|
||||||
FUN = 0;
|
|
||||||
VAL = 1;
|
|
||||||
VAR = 2;
|
|
||||||
CONSTRUCTOR = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum MemberKind {
|
enum MemberKind {
|
||||||
// 2 bits
|
// 2 bits
|
||||||
DECLARATION = 0;
|
DECLARATION = 0;
|
||||||
|
|||||||
@@ -36,8 +36,11 @@ public class Flags {
|
|||||||
|
|
||||||
// Callables
|
// Callables
|
||||||
|
|
||||||
public static final FlagField<ProtoBuf.CallableKind> CALLABLE_KIND = FlagField.after(MODALITY, ProtoBuf.CallableKind.values());
|
// TODO: use these flags
|
||||||
public static final FlagField<ProtoBuf.MemberKind> MEMBER_KIND = FlagField.after(CALLABLE_KIND, ProtoBuf.MemberKind.values());
|
public static final FlagField<Boolean> RESERVED_1 = FlagField.booleanAfter(MODALITY);
|
||||||
|
public static final FlagField<Boolean> RESERVED_2 = FlagField.booleanAfter(RESERVED_1);
|
||||||
|
|
||||||
|
public static final FlagField<ProtoBuf.MemberKind> MEMBER_KIND = FlagField.after(RESERVED_2, ProtoBuf.MemberKind.values());
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@@ -57,16 +60,6 @@ public class Flags {
|
|||||||
public static final FlagField<Boolean> LATE_INIT = FlagField.booleanAfter(IS_CONST);
|
public static final FlagField<Boolean> LATE_INIT = FlagField.booleanAfter(IS_CONST);
|
||||||
public static final FlagField<Boolean> HAS_CONSTANT = FlagField.booleanAfter(LATE_INIT);
|
public static final FlagField<Boolean> HAS_CONSTANT = FlagField.booleanAfter(LATE_INIT);
|
||||||
|
|
||||||
// Old callables. TODO: delete
|
|
||||||
|
|
||||||
public static final FlagField<Boolean> OLD_HAS_GETTER = FlagField.booleanAfter(MEMBER_KIND);
|
|
||||||
public static final FlagField<Boolean> OLD_HAS_SETTER = FlagField.booleanAfter(OLD_HAS_GETTER);
|
|
||||||
public static final FlagField<Boolean> OLD_HAS_CONSTANT = FlagField.booleanAfter(OLD_HAS_SETTER);
|
|
||||||
public static final FlagField<Boolean> OLD_IS_CONST = FlagField.booleanAfter(OLD_HAS_CONSTANT);
|
|
||||||
public static final FlagField<Boolean> OLD_LATE_INIT = FlagField.booleanAfter(OLD_IS_CONST);
|
|
||||||
public static final FlagField<Boolean> OLD_IS_OPERATOR = FlagField.booleanAfter(OLD_LATE_INIT);
|
|
||||||
public static final FlagField<Boolean> OLD_IS_INFIX = FlagField.booleanAfter(OLD_IS_OPERATOR);
|
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
|
|
||||||
public static final FlagField<Boolean> DECLARES_DEFAULT_VALUE = FlagField.booleanAfter(HAS_ANNOTATIONS);
|
public static final FlagField<Boolean> DECLARES_DEFAULT_VALUE = FlagField.booleanAfter(HAS_ANNOTATIONS);
|
||||||
@@ -123,35 +116,6 @@ public class Flags {
|
|||||||
throw new IllegalArgumentException("Unknown class kind: " + kind);
|
throw new IllegalArgumentException("Unknown class kind: " + kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCallableFlags(
|
|
||||||
boolean hasAnnotations,
|
|
||||||
@NotNull Visibility visibility,
|
|
||||||
@NotNull Modality modality,
|
|
||||||
@NotNull CallableMemberDescriptor.Kind memberKind,
|
|
||||||
@NotNull ProtoBuf.CallableKind callableKind,
|
|
||||||
boolean hasGetter,
|
|
||||||
boolean hasSetter,
|
|
||||||
boolean hasConstant,
|
|
||||||
boolean lateInit,
|
|
||||||
boolean isConst,
|
|
||||||
boolean isOperator,
|
|
||||||
boolean isInfix
|
|
||||||
) {
|
|
||||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
|
||||||
| MODALITY.toFlags(modality(modality))
|
|
||||||
| VISIBILITY.toFlags(visibility(visibility))
|
|
||||||
| MEMBER_KIND.toFlags(memberKind(memberKind))
|
|
||||||
| CALLABLE_KIND.toFlags(callableKind)
|
|
||||||
| OLD_HAS_GETTER.toFlags(hasGetter)
|
|
||||||
| OLD_HAS_SETTER.toFlags(hasSetter)
|
|
||||||
| OLD_HAS_CONSTANT.toFlags(hasConstant)
|
|
||||||
| OLD_LATE_INIT.toFlags(lateInit)
|
|
||||||
| OLD_IS_CONST.toFlags(isConst)
|
|
||||||
| OLD_IS_OPERATOR.toFlags(isOperator)
|
|
||||||
| OLD_IS_INFIX.toFlags(isInfix)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getConstructorFlags(
|
public static int getConstructorFlags(
|
||||||
boolean hasAnnotations,
|
boolean hasAnnotations,
|
||||||
@NotNull Visibility visibility,
|
@NotNull Visibility visibility,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
-32
@@ -9,8 +9,6 @@ public final class BuiltInsProtoBuf {
|
|||||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.className);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.className);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.classAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.classAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.oldCallableAnnotation);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.oldCompileTimeValue);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.constructorAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.constructorAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.functionAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.functionAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.propertyAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf.propertyAnnotation);
|
||||||
@@ -48,36 +46,6 @@ public final class BuiltInsProtoBuf {
|
|||||||
150,
|
150,
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||||
false);
|
false);
|
||||||
public static final int OLD_CALLABLE_ANNOTATION_FIELD_NUMBER = 150;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable,
|
|
||||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>> oldCallableAnnotation = com.google.protobuf.GeneratedMessageLite
|
|
||||||
.newRepeatedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.getDefaultInstance(),
|
|
||||||
null,
|
|
||||||
150,
|
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
|
||||||
false);
|
|
||||||
public static final int OLD_COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value> oldCompileTimeValue = com.google.protobuf.GeneratedMessageLite
|
|
||||||
.newSingularGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value.getDefaultInstance(),
|
|
||||||
null,
|
|
||||||
151,
|
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
|
||||||
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
|
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
|
||||||
/**
|
/**
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
||||||
|
|||||||
+8
-8
@@ -39,18 +39,18 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
getAnnotations(proto, flags, AnnotatedCallableKind.PROPERTY),
|
getAnnotations(proto, flags, AnnotatedCallableKind.PROPERTY),
|
||||||
Deserialization.modality(Flags.MODALITY.get(flags)),
|
Deserialization.modality(Flags.MODALITY.get(flags)),
|
||||||
Deserialization.visibility(Flags.VISIBILITY.get(flags)),
|
Deserialization.visibility(Flags.VISIBILITY.get(flags)),
|
||||||
Flags.CALLABLE_KIND.get(flags) == ProtoBuf.CallableKind.VAR,
|
Flags.IS_VAR.get(flags),
|
||||||
c.nameResolver.getName(proto.getName()),
|
c.nameResolver.getName(proto.getName()),
|
||||||
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)),
|
Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)),
|
||||||
proto,
|
proto,
|
||||||
c.nameResolver,
|
c.nameResolver,
|
||||||
Flags.OLD_LATE_INIT.get(flags),
|
Flags.LATE_INIT.get(flags),
|
||||||
Flags.OLD_IS_CONST.get(flags)
|
Flags.IS_CONST.get(flags)
|
||||||
)
|
)
|
||||||
|
|
||||||
val local = c.childContext(property, proto.getTypeParameterList())
|
val local = c.childContext(property, proto.getTypeParameterList())
|
||||||
|
|
||||||
val hasGetter = Flags.OLD_HAS_GETTER.get(flags)
|
val hasGetter = Flags.HAS_GETTER.get(flags)
|
||||||
val receiverAnnotations = if (hasGetter && proto.hasReceiverType())
|
val receiverAnnotations = if (hasGetter && proto.hasReceiverType())
|
||||||
getReceiverParameterAnnotations(proto, AnnotatedCallableKind.PROPERTY_GETTER)
|
getReceiverParameterAnnotations(proto, AnnotatedCallableKind.PROPERTY_GETTER)
|
||||||
else
|
else
|
||||||
@@ -87,7 +87,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
val setter = if (Flags.OLD_HAS_SETTER.get(flags)) {
|
val setter = if (Flags.HAS_SETTER.get(flags)) {
|
||||||
val setterFlags = proto.getSetterFlags()
|
val setterFlags = proto.getSetterFlags()
|
||||||
val isNotDefault = proto.hasSetterFlags() && Flags.IS_NOT_DEFAULT.get(setterFlags)
|
val isNotDefault = proto.hasSetterFlags() && Flags.IS_NOT_DEFAULT.get(setterFlags)
|
||||||
if (isNotDefault) {
|
if (isNotDefault) {
|
||||||
@@ -115,7 +115,7 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Flags.OLD_HAS_CONSTANT.get(flags)) {
|
if (Flags.HAS_CONSTANT.get(flags)) {
|
||||||
property.setCompileTimeInitializer(
|
property.setCompileTimeInitializer(
|
||||||
c.storageManager.createNullableLazyValue {
|
c.storageManager.createNullableLazyValue {
|
||||||
val container = c.containingDeclaration.asProtoContainer()!!
|
val container = c.containingDeclaration.asProtoContainer()!!
|
||||||
@@ -145,8 +145,8 @@ public class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
Deserialization.modality(Flags.MODALITY.get(proto.flags)),
|
Deserialization.modality(Flags.MODALITY.get(proto.flags)),
|
||||||
Deserialization.visibility(Flags.VISIBILITY.get(proto.flags))
|
Deserialization.visibility(Flags.VISIBILITY.get(proto.flags))
|
||||||
)
|
)
|
||||||
function.isOperator = Flags.OLD_IS_OPERATOR.get(proto.flags)
|
function.isOperator = Flags.IS_OPERATOR.get(proto.flags)
|
||||||
function.isInfix = Flags.OLD_IS_INFIX.get(proto.flags)
|
function.isInfix = Flags.IS_INFIX.get(proto.flags)
|
||||||
return function
|
return function
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -322,7 +322,8 @@ public class DeserializedClassDescriptor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val nameResolver = c.nameResolver
|
val nameResolver = c.nameResolver
|
||||||
return classProto.getMemberList().mapTo(result) { nameResolver.getName(it.getName()) }
|
return classProto.functionList.mapTo(result) { nameResolver.getName(it.name) } +
|
||||||
|
classProto.propertyList.mapTo(result) { nameResolver.getName(it.name) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun all(): Collection<ClassDescriptor> {
|
fun all(): Collection<ClassDescriptor> {
|
||||||
|
|||||||
@@ -35,10 +35,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
private val classIds = Interner<ClassId>()
|
private val classIds = Interner<ClassId>()
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
open fun checkEquals(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
||||||
if (!checkEqualsPackageMember(old, new)) return false
|
|
||||||
|
|
||||||
if (!checkEqualsPackageConstructor(old, new)) return false
|
|
||||||
|
|
||||||
if (!checkEqualsPackageFunction(old, new)) return false
|
if (!checkEqualsPackageFunction(old, new)) return false
|
||||||
|
|
||||||
if (!checkEqualsPackageProperty(old, new)) return false
|
if (!checkEqualsPackageProperty(old, new)) return false
|
||||||
@@ -46,8 +42,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
public enum class ProtoBufPackageKind {
|
public enum class ProtoBufPackageKind {
|
||||||
MEMBER_LIST,
|
|
||||||
CONSTRUCTOR_LIST,
|
|
||||||
FUNCTION_LIST,
|
FUNCTION_LIST,
|
||||||
PROPERTY_LIST
|
PROPERTY_LIST
|
||||||
}
|
}
|
||||||
@@ -55,10 +49,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
public fun difference(old: ProtoBuf.Package, new: ProtoBuf.Package): EnumSet<ProtoBufPackageKind> {
|
public fun difference(old: ProtoBuf.Package, new: ProtoBuf.Package): EnumSet<ProtoBufPackageKind> {
|
||||||
val result = EnumSet.noneOf(ProtoBufPackageKind::class.java)
|
val result = EnumSet.noneOf(ProtoBufPackageKind::class.java)
|
||||||
|
|
||||||
if (!checkEqualsPackageMember(old, new)) result.add(ProtoBufPackageKind.MEMBER_LIST)
|
|
||||||
|
|
||||||
if (!checkEqualsPackageConstructor(old, new)) result.add(ProtoBufPackageKind.CONSTRUCTOR_LIST)
|
|
||||||
|
|
||||||
if (!checkEqualsPackageFunction(old, new)) result.add(ProtoBufPackageKind.FUNCTION_LIST)
|
if (!checkEqualsPackageFunction(old, new)) result.add(ProtoBufPackageKind.FUNCTION_LIST)
|
||||||
|
|
||||||
if (!checkEqualsPackageProperty(old, new)) result.add(ProtoBufPackageKind.PROPERTY_LIST)
|
if (!checkEqualsPackageProperty(old, new)) result.add(ProtoBufPackageKind.PROPERTY_LIST)
|
||||||
@@ -91,17 +81,8 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
|
|
||||||
if (!checkEqualsClassProperty(old, new)) return false
|
if (!checkEqualsClassProperty(old, new)) return false
|
||||||
|
|
||||||
if (!checkEqualsClassMember(old, new)) return false
|
|
||||||
|
|
||||||
if (!checkEqualsClassEnumEntry(old, new)) return false
|
if (!checkEqualsClassEnumEntry(old, new)) return false
|
||||||
|
|
||||||
if (old.hasPrimaryConstructor() != new.hasPrimaryConstructor()) return false
|
|
||||||
if (old.hasPrimaryConstructor()) {
|
|
||||||
if (!checkEquals(old.primaryConstructor, new.primaryConstructor)) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkEqualsClassSecondaryConstructor(old, new)) return false
|
|
||||||
|
|
||||||
if (old.getExtensionCount(JvmProtoBuf.classAnnotation) != new.getExtensionCount(JvmProtoBuf.classAnnotation)) return false
|
if (old.getExtensionCount(JvmProtoBuf.classAnnotation) != new.getExtensionCount(JvmProtoBuf.classAnnotation)) return false
|
||||||
|
|
||||||
for(i in 0..old.getExtensionCount(JvmProtoBuf.classAnnotation) - 1) {
|
for(i in 0..old.getExtensionCount(JvmProtoBuf.classAnnotation) - 1) {
|
||||||
@@ -120,10 +101,7 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
CONSTRUCTOR_LIST,
|
CONSTRUCTOR_LIST,
|
||||||
FUNCTION_LIST,
|
FUNCTION_LIST,
|
||||||
PROPERTY_LIST,
|
PROPERTY_LIST,
|
||||||
MEMBER_LIST,
|
|
||||||
ENUM_ENTRY_LIST,
|
ENUM_ENTRY_LIST,
|
||||||
PRIMARY_CONSTRUCTOR,
|
|
||||||
SECONDARY_CONSTRUCTOR_LIST,
|
|
||||||
CLASS_ANNOTATION_LIST
|
CLASS_ANNOTATION_LIST
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,17 +132,8 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
|
|
||||||
if (!checkEqualsClassProperty(old, new)) result.add(ProtoBufClassKind.PROPERTY_LIST)
|
if (!checkEqualsClassProperty(old, new)) result.add(ProtoBufClassKind.PROPERTY_LIST)
|
||||||
|
|
||||||
if (!checkEqualsClassMember(old, new)) result.add(ProtoBufClassKind.MEMBER_LIST)
|
|
||||||
|
|
||||||
if (!checkEqualsClassEnumEntry(old, new)) result.add(ProtoBufClassKind.ENUM_ENTRY_LIST)
|
if (!checkEqualsClassEnumEntry(old, new)) result.add(ProtoBufClassKind.ENUM_ENTRY_LIST)
|
||||||
|
|
||||||
if (old.hasPrimaryConstructor() != new.hasPrimaryConstructor()) result.add(ProtoBufClassKind.PRIMARY_CONSTRUCTOR)
|
|
||||||
if (old.hasPrimaryConstructor()) {
|
|
||||||
if (!checkEquals(old.primaryConstructor, new.primaryConstructor)) result.add(ProtoBufClassKind.PRIMARY_CONSTRUCTOR)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkEqualsClassSecondaryConstructor(old, new)) result.add(ProtoBufClassKind.SECONDARY_CONSTRUCTOR_LIST)
|
|
||||||
|
|
||||||
if (old.getExtensionCount(JvmProtoBuf.classAnnotation) != new.getExtensionCount(JvmProtoBuf.classAnnotation)) result.add(ProtoBufClassKind.CLASS_ANNOTATION_LIST)
|
if (old.getExtensionCount(JvmProtoBuf.classAnnotation) != new.getExtensionCount(JvmProtoBuf.classAnnotation)) result.add(ProtoBufClassKind.CLASS_ANNOTATION_LIST)
|
||||||
|
|
||||||
for(i in 0..old.getExtensionCount(JvmProtoBuf.classAnnotation) - 1) {
|
for(i in 0..old.getExtensionCount(JvmProtoBuf.classAnnotation) - 1) {
|
||||||
@@ -174,69 +143,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.Callable, new: ProtoBuf.Callable): Boolean {
|
|
||||||
if (old.hasFlags() != new.hasFlags()) return false
|
|
||||||
if (old.hasFlags()) {
|
|
||||||
if (old.flags != new.flags) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (old.hasGetterFlags() != new.hasGetterFlags()) return false
|
|
||||||
if (old.hasGetterFlags()) {
|
|
||||||
if (old.getterFlags != new.getterFlags) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (old.hasSetterFlags() != new.hasSetterFlags()) return false
|
|
||||||
if (old.hasSetterFlags()) {
|
|
||||||
if (old.setterFlags != new.setterFlags) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkEqualsCallableTypeParameter(old, new)) return false
|
|
||||||
|
|
||||||
if (old.hasReceiverType() != new.hasReceiverType()) return false
|
|
||||||
if (old.hasReceiverType()) {
|
|
||||||
if (!checkEquals(old.receiverType, new.receiverType)) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkStringEquals(old.name, new.name)) return false
|
|
||||||
|
|
||||||
if (!checkEqualsCallableValueParameter(old, new)) return false
|
|
||||||
|
|
||||||
if (!checkEquals(old.returnType, new.returnType)) return false
|
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.oldMethodSignature) != new.hasExtension(JvmProtoBuf.oldMethodSignature)) return false
|
|
||||||
if (old.hasExtension(JvmProtoBuf.oldMethodSignature)) {
|
|
||||||
if (!checkEquals(old.getExtension(JvmProtoBuf.oldMethodSignature), new.getExtension(JvmProtoBuf.oldMethodSignature))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.oldPropertySignature) != new.hasExtension(JvmProtoBuf.oldPropertySignature)) return false
|
|
||||||
if (old.hasExtension(JvmProtoBuf.oldPropertySignature)) {
|
|
||||||
if (!checkEquals(old.getExtension(JvmProtoBuf.oldPropertySignature), new.getExtension(JvmProtoBuf.oldPropertySignature))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.oldImplClassName) != new.hasExtension(JvmProtoBuf.oldImplClassName)) return false
|
|
||||||
if (old.hasExtension(JvmProtoBuf.oldImplClassName)) {
|
|
||||||
if (!checkStringEquals(old.getExtension(JvmProtoBuf.oldImplClassName), new.getExtension(JvmProtoBuf.oldImplClassName))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.Constructor, new: ProtoBuf.Constructor): Boolean {
|
|
||||||
if (old.hasFlags() != new.hasFlags()) return false
|
|
||||||
if (old.hasFlags()) {
|
|
||||||
if (old.flags != new.flags) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!checkEqualsConstructorValueParameter(old, new)) return false
|
|
||||||
|
|
||||||
if (old.hasExtension(JvmProtoBuf.constructorSignature) != new.hasExtension(JvmProtoBuf.constructorSignature)) return false
|
|
||||||
if (old.hasExtension(JvmProtoBuf.constructorSignature)) {
|
|
||||||
if (!checkEquals(old.getExtension(JvmProtoBuf.constructorSignature), new.getExtension(JvmProtoBuf.constructorSignature))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean {
|
open fun checkEquals(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean {
|
||||||
if (old.hasFlags() != new.hasFlags()) return false
|
if (old.hasFlags() != new.hasFlags()) return false
|
||||||
if (old.hasFlags()) {
|
if (old.hasFlags()) {
|
||||||
@@ -376,10 +282,17 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEquals(old: ProtoBuf.Class.PrimaryConstructor, new: ProtoBuf.Class.PrimaryConstructor): Boolean {
|
open fun checkEquals(old: ProtoBuf.Constructor, new: ProtoBuf.Constructor): Boolean {
|
||||||
if (old.hasData() != new.hasData()) return false
|
if (old.hasFlags() != new.hasFlags()) return false
|
||||||
if (old.hasData()) {
|
if (old.hasFlags()) {
|
||||||
if (!checkEquals(old.data, new.data)) return false
|
if (old.flags != new.flags) return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!checkEqualsConstructorValueParameter(old, new)) return false
|
||||||
|
|
||||||
|
if (old.hasExtension(JvmProtoBuf.constructorSignature) != new.hasExtension(JvmProtoBuf.constructorSignature)) return false
|
||||||
|
if (old.hasExtension(JvmProtoBuf.constructorSignature)) {
|
||||||
|
if (!checkEquals(old.getExtension(JvmProtoBuf.constructorSignature), new.getExtension(JvmProtoBuf.constructorSignature))) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -529,26 +442,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEqualsPackageMember(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
|
||||||
if (old.memberCount != new.memberCount) return false
|
|
||||||
|
|
||||||
for(i in 0..old.memberCount - 1) {
|
|
||||||
if (!checkEquals(old.getMember(i), new.getMember(i))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEqualsPackageConstructor(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
|
||||||
if (old.constructorCount != new.constructorCount) return false
|
|
||||||
|
|
||||||
for(i in 0..old.constructorCount - 1) {
|
|
||||||
if (!checkEquals(old.getConstructor(i), new.getConstructor(i))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEqualsPackageFunction(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
open fun checkEqualsPackageFunction(old: ProtoBuf.Package, new: ProtoBuf.Package): Boolean {
|
||||||
if (old.functionCount != new.functionCount) return false
|
if (old.functionCount != new.functionCount) return false
|
||||||
|
|
||||||
@@ -629,16 +522,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEqualsClassMember(old: ProtoBuf.Class, new: ProtoBuf.Class): Boolean {
|
|
||||||
if (old.memberCount != new.memberCount) return false
|
|
||||||
|
|
||||||
for(i in 0..old.memberCount - 1) {
|
|
||||||
if (!checkEquals(old.getMember(i), new.getMember(i))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEqualsClassEnumEntry(old: ProtoBuf.Class, new: ProtoBuf.Class): Boolean {
|
open fun checkEqualsClassEnumEntry(old: ProtoBuf.Class, new: ProtoBuf.Class): Boolean {
|
||||||
if (old.enumEntryCount != new.enumEntryCount) return false
|
if (old.enumEntryCount != new.enumEntryCount) return false
|
||||||
|
|
||||||
@@ -649,46 +532,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun checkEqualsClassSecondaryConstructor(old: ProtoBuf.Class, new: ProtoBuf.Class): Boolean {
|
|
||||||
if (old.secondaryConstructorCount != new.secondaryConstructorCount) return false
|
|
||||||
|
|
||||||
for(i in 0..old.secondaryConstructorCount - 1) {
|
|
||||||
if (!checkEquals(old.getSecondaryConstructor(i), new.getSecondaryConstructor(i))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEqualsCallableTypeParameter(old: ProtoBuf.Callable, new: ProtoBuf.Callable): Boolean {
|
|
||||||
if (old.typeParameterCount != new.typeParameterCount) return false
|
|
||||||
|
|
||||||
for(i in 0..old.typeParameterCount - 1) {
|
|
||||||
if (!checkEquals(old.getTypeParameter(i), new.getTypeParameter(i))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEqualsCallableValueParameter(old: ProtoBuf.Callable, new: ProtoBuf.Callable): Boolean {
|
|
||||||
if (old.valueParameterCount != new.valueParameterCount) return false
|
|
||||||
|
|
||||||
for(i in 0..old.valueParameterCount - 1) {
|
|
||||||
if (!checkEquals(old.getValueParameter(i), new.getValueParameter(i))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEqualsConstructorValueParameter(old: ProtoBuf.Constructor, new: ProtoBuf.Constructor): Boolean {
|
|
||||||
if (old.valueParameterCount != new.valueParameterCount) return false
|
|
||||||
|
|
||||||
for(i in 0..old.valueParameterCount - 1) {
|
|
||||||
if (!checkEquals(old.getValueParameter(i), new.getValueParameter(i))) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun checkEqualsFunctionTypeParameter(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean {
|
open fun checkEqualsFunctionTypeParameter(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean {
|
||||||
if (old.typeParameterCount != new.typeParameterCount) return false
|
if (old.typeParameterCount != new.typeParameterCount) return false
|
||||||
|
|
||||||
@@ -739,6 +582,16 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open fun checkEqualsConstructorValueParameter(old: ProtoBuf.Constructor, new: ProtoBuf.Constructor): Boolean {
|
||||||
|
if (old.valueParameterCount != new.valueParameterCount) return false
|
||||||
|
|
||||||
|
for(i in 0..old.valueParameterCount - 1) {
|
||||||
|
if (!checkEquals(old.getValueParameter(i), new.getValueParameter(i))) return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
open fun checkEqualsAnnotationArgument(old: ProtoBuf.Annotation, new: ProtoBuf.Annotation): Boolean {
|
open fun checkEqualsAnnotationArgument(old: ProtoBuf.Annotation, new: ProtoBuf.Annotation): Boolean {
|
||||||
if (old.argumentCount != new.argumentCount) return false
|
if (old.argumentCount != new.argumentCount) return false
|
||||||
|
|
||||||
@@ -793,14 +646,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
|||||||
public fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
public fun ProtoBuf.Package.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||||
var hashCode = 1
|
var hashCode = 1
|
||||||
|
|
||||||
for(i in 0..memberCount - 1) {
|
|
||||||
hashCode = 31 * hashCode + getMember(i).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i in 0..constructorCount - 1) {
|
|
||||||
hashCode = 31 * hashCode + getConstructor(i).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i in 0..functionCount - 1) {
|
for(i in 0..functionCount - 1) {
|
||||||
hashCode = 31 * hashCode + getFunction(i).hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + getFunction(i).hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
@@ -849,22 +694,10 @@ public fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (
|
|||||||
hashCode = 31 * hashCode + getProperty(i).hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + getProperty(i).hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i in 0..memberCount - 1) {
|
|
||||||
hashCode = 31 * hashCode + getMember(i).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i in 0..enumEntryCount - 1) {
|
for(i in 0..enumEntryCount - 1) {
|
||||||
hashCode = 31 * hashCode + stringIndexes(getEnumEntry(i))
|
hashCode = 31 * hashCode + stringIndexes(getEnumEntry(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasPrimaryConstructor()) {
|
|
||||||
hashCode = 31 * hashCode + primaryConstructor.hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i in 0..secondaryConstructorCount - 1) {
|
|
||||||
hashCode = 31 * hashCode + getSecondaryConstructor(i).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i in 0..getExtensionCount(JvmProtoBuf.classAnnotation) - 1) {
|
for(i in 0..getExtensionCount(JvmProtoBuf.classAnnotation) - 1) {
|
||||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.classAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
@@ -872,70 +705,6 @@ public fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (
|
|||||||
return hashCode
|
return hashCode
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun ProtoBuf.Callable.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
|
||||||
var hashCode = 1
|
|
||||||
|
|
||||||
if (hasFlags()) {
|
|
||||||
hashCode = 31 * hashCode + flags
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasGetterFlags()) {
|
|
||||||
hashCode = 31 * hashCode + getterFlags
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasSetterFlags()) {
|
|
||||||
hashCode = 31 * hashCode + setterFlags
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i in 0..typeParameterCount - 1) {
|
|
||||||
hashCode = 31 * hashCode + getTypeParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasReceiverType()) {
|
|
||||||
hashCode = 31 * hashCode + receiverType.hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
hashCode = 31 * hashCode + stringIndexes(name)
|
|
||||||
|
|
||||||
for(i in 0..valueParameterCount - 1) {
|
|
||||||
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
hashCode = 31 * hashCode + returnType.hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.oldMethodSignature)) {
|
|
||||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.oldMethodSignature).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.oldPropertySignature)) {
|
|
||||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.oldPropertySignature).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.oldImplClassName)) {
|
|
||||||
hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.oldImplClassName))
|
|
||||||
}
|
|
||||||
|
|
||||||
return hashCode
|
|
||||||
}
|
|
||||||
|
|
||||||
public fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
|
||||||
var hashCode = 1
|
|
||||||
|
|
||||||
if (hasFlags()) {
|
|
||||||
hashCode = 31 * hashCode + flags
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i in 0..valueParameterCount - 1) {
|
|
||||||
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasExtension(JvmProtoBuf.constructorSignature)) {
|
|
||||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.constructorSignature).hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
}
|
|
||||||
|
|
||||||
return hashCode
|
|
||||||
}
|
|
||||||
|
|
||||||
public fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
public fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||||
var hashCode = 1
|
var hashCode = 1
|
||||||
|
|
||||||
@@ -1072,11 +841,19 @@ public fun ProtoBuf.Type.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
|
|||||||
return hashCode
|
return hashCode
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun ProtoBuf.Class.PrimaryConstructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
public fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||||
var hashCode = 1
|
var hashCode = 1
|
||||||
|
|
||||||
if (hasData()) {
|
if (hasFlags()) {
|
||||||
hashCode = 31 * hashCode + data.hashCode(stringIndexes, fqNameIndexes)
|
hashCode = 31 * hashCode + flags
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i in 0..valueParameterCount - 1) {
|
||||||
|
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasExtension(JvmProtoBuf.constructorSignature)) {
|
||||||
|
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.constructorSignature).hashCode(stringIndexes, fqNameIndexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashCode
|
return hashCode
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ private abstract class DifferenceCalculator() {
|
|||||||
protected val MessageLite.isPrivate: Boolean
|
protected val MessageLite.isPrivate: Boolean
|
||||||
get() = Visibilities.isPrivate(Deserialization.visibility(
|
get() = Visibilities.isPrivate(Deserialization.visibility(
|
||||||
when (this) {
|
when (this) {
|
||||||
is ProtoBuf.Callable -> Flags.VISIBILITY.get(flags)
|
|
||||||
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
|
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
|
||||||
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
|
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
|
||||||
is ProtoBuf.Property -> Flags.VISIBILITY.get(flags)
|
is ProtoBuf.Property -> Flags.VISIBILITY.get(flags)
|
||||||
@@ -127,7 +126,6 @@ private abstract class DifferenceCalculator() {
|
|||||||
|
|
||||||
private fun MessageLite.getHashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
private fun MessageLite.getHashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) -> Int): Int {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is ProtoBuf.Callable -> hashCode(stringIndexes, fqNameIndexes)
|
|
||||||
is ProtoBuf.Constructor -> hashCode(stringIndexes, fqNameIndexes)
|
is ProtoBuf.Constructor -> hashCode(stringIndexes, fqNameIndexes)
|
||||||
is ProtoBuf.Function -> hashCode(stringIndexes, fqNameIndexes)
|
is ProtoBuf.Function -> hashCode(stringIndexes, fqNameIndexes)
|
||||||
is ProtoBuf.Property -> hashCode(stringIndexes, fqNameIndexes)
|
is ProtoBuf.Property -> hashCode(stringIndexes, fqNameIndexes)
|
||||||
@@ -137,7 +135,6 @@ private abstract class DifferenceCalculator() {
|
|||||||
|
|
||||||
private fun MessageLite.name(nameResolver: NameResolver): String {
|
private fun MessageLite.name(nameResolver: NameResolver): String {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is ProtoBuf.Callable -> nameResolver.getString(name)
|
|
||||||
is ProtoBuf.Constructor -> "<init>"
|
is ProtoBuf.Constructor -> "<init>"
|
||||||
is ProtoBuf.Function -> nameResolver.getString(name)
|
is ProtoBuf.Function -> nameResolver.getString(name)
|
||||||
is ProtoBuf.Property -> nameResolver.getString(name)
|
is ProtoBuf.Property -> nameResolver.getString(name)
|
||||||
@@ -147,7 +144,6 @@ private abstract class DifferenceCalculator() {
|
|||||||
|
|
||||||
private fun ProtoCompareGenerated.checkEquals(old: MessageLite, new: MessageLite): Boolean {
|
private fun ProtoCompareGenerated.checkEquals(old: MessageLite, new: MessageLite): Boolean {
|
||||||
return when {
|
return when {
|
||||||
old is ProtoBuf.Callable && new is ProtoBuf.Callable -> checkEquals(old, new)
|
|
||||||
old is ProtoBuf.Constructor && new is ProtoBuf.Constructor -> checkEquals(old, new)
|
old is ProtoBuf.Constructor && new is ProtoBuf.Constructor -> checkEquals(old, new)
|
||||||
old is ProtoBuf.Function && new is ProtoBuf.Function -> checkEquals(old, new)
|
old is ProtoBuf.Function && new is ProtoBuf.Function -> checkEquals(old, new)
|
||||||
old is ProtoBuf.Property && new is ProtoBuf.Property -> checkEquals(old, new)
|
old is ProtoBuf.Property && new is ProtoBuf.Property -> checkEquals(old, new)
|
||||||
@@ -158,8 +154,6 @@ private abstract class DifferenceCalculator() {
|
|||||||
|
|
||||||
private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
||||||
companion object {
|
companion object {
|
||||||
private val CONSTRUCTOR = "<init>"
|
|
||||||
|
|
||||||
private val CLASS_SIGNATURE_ENUMS = EnumSet.of(
|
private val CLASS_SIGNATURE_ENUMS = EnumSet.of(
|
||||||
ProtoBufClassKind.FLAGS,
|
ProtoBufClassKind.FLAGS,
|
||||||
ProtoBufClassKind.FQ_NAME,
|
ProtoBufClassKind.FQ_NAME,
|
||||||
@@ -214,18 +208,8 @@ private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: Prot
|
|||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Class::getFunctionList))
|
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Class::getFunctionList))
|
||||||
ProtoBufClassKind.PROPERTY_LIST ->
|
ProtoBufClassKind.PROPERTY_LIST ->
|
||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Class::getPropertyList))
|
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Class::getPropertyList))
|
||||||
ProtoBufClassKind.MEMBER_LIST ->
|
|
||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Class::getMemberList))
|
|
||||||
ProtoBufClassKind.ENUM_ENTRY_LIST ->
|
ProtoBufClassKind.ENUM_ENTRY_LIST ->
|
||||||
names.addAll(calcDifferenceForNames(oldProto.enumEntryList, newProto.enumEntryList))
|
names.addAll(calcDifferenceForNames(oldProto.enumEntryList, newProto.enumEntryList))
|
||||||
ProtoBufClassKind.PRIMARY_CONSTRUCTOR ->
|
|
||||||
if (areNonPrivatePrimaryConstructorsDifferent()) {
|
|
||||||
names.add(CONSTRUCTOR)
|
|
||||||
}
|
|
||||||
ProtoBufClassKind.SECONDARY_CONSTRUCTOR_LIST ->
|
|
||||||
if (areNonPrivateSecondaryConstructorsDifferent()) {
|
|
||||||
names.add(CONSTRUCTOR)
|
|
||||||
}
|
|
||||||
ProtoBufClassKind.FLAGS,
|
ProtoBufClassKind.FLAGS,
|
||||||
ProtoBufClassKind.FQ_NAME,
|
ProtoBufClassKind.FQ_NAME,
|
||||||
ProtoBufClassKind.TYPE_PARAMETER_LIST,
|
ProtoBufClassKind.TYPE_PARAMETER_LIST,
|
||||||
@@ -238,30 +222,6 @@ private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: Prot
|
|||||||
}
|
}
|
||||||
return names
|
return names
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun areNonPrivatePrimaryConstructorsDifferent(): Boolean {
|
|
||||||
val oldPrimaryConstructor = oldProto.getNonPrivatePrimaryConstructor
|
|
||||||
val newPrimaryConstructor = newProto.getNonPrivatePrimaryConstructor
|
|
||||||
if (oldPrimaryConstructor == null && newPrimaryConstructor == null) return false
|
|
||||||
|
|
||||||
if (oldPrimaryConstructor == null || newPrimaryConstructor == null) return true
|
|
||||||
|
|
||||||
return !compareObject.checkEquals(oldPrimaryConstructor, newPrimaryConstructor)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun areNonPrivateSecondaryConstructorsDifferent(): Boolean {
|
|
||||||
val oldSecondaryConstructors = oldProto.secondaryConstructorList.filter { !it.isPrivate }
|
|
||||||
val newSecondaryConstructors = newProto.secondaryConstructorList.filter { !it.isPrivate }
|
|
||||||
return (oldSecondaryConstructors.size() != newSecondaryConstructors.size() ||
|
|
||||||
oldSecondaryConstructors.indices.any { !compareObject.checkEquals(oldSecondaryConstructors[it], newSecondaryConstructors[it]) })
|
|
||||||
}
|
|
||||||
|
|
||||||
private val ProtoBuf.Class.getNonPrivatePrimaryConstructor: ProtoBuf.Class.PrimaryConstructor?
|
|
||||||
get() {
|
|
||||||
if (!hasPrimaryConstructor()) return null
|
|
||||||
|
|
||||||
return if (primaryConstructor?.data?.isPrivate ?: false) null else primaryConstructor
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
|
||||||
@@ -293,14 +253,10 @@ private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newDa
|
|||||||
|
|
||||||
for (kind in diff) {
|
for (kind in diff) {
|
||||||
when (kind!!) {
|
when (kind!!) {
|
||||||
ProtoBufPackageKind.CONSTRUCTOR_LIST ->
|
|
||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getConstructorList))
|
|
||||||
ProtoBufPackageKind.FUNCTION_LIST ->
|
ProtoBufPackageKind.FUNCTION_LIST ->
|
||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getFunctionList))
|
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getFunctionList))
|
||||||
ProtoBufPackageKind.PROPERTY_LIST ->
|
ProtoBufPackageKind.PROPERTY_LIST ->
|
||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getPropertyList))
|
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getPropertyList))
|
||||||
ProtoBufPackageKind.MEMBER_LIST ->
|
|
||||||
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getMemberList))
|
|
||||||
else ->
|
else ->
|
||||||
throw IllegalArgumentException("Unsupported kind: $kind")
|
throw IllegalArgumentException("Unsupported kind: $kind")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,6 @@ extend Class {
|
|||||||
repeated Annotation class_annotation = 130;
|
repeated Annotation class_annotation = 130;
|
||||||
}
|
}
|
||||||
|
|
||||||
extend Callable {
|
|
||||||
repeated Annotation old_callable_annotation = 130;
|
|
||||||
optional Annotation.Argument.Value old_compile_time_value = 131;
|
|
||||||
}
|
|
||||||
|
|
||||||
extend Constructor {
|
extend Constructor {
|
||||||
repeated Annotation constructor_annotation = 130;
|
repeated Annotation constructor_annotation = 130;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ public final class JsProtoBuf {
|
|||||||
public static void registerAllExtensions(
|
public static void registerAllExtensions(
|
||||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.classAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.classAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.oldCallableAnnotation);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.oldCompileTimeValue);
|
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.constructorAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.constructorAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.functionAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.functionAnnotation);
|
||||||
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.propertyAnnotation);
|
registry.add(org.jetbrains.kotlin.serialization.js.JsProtoBuf.propertyAnnotation);
|
||||||
@@ -1481,36 +1479,6 @@ public final class JsProtoBuf {
|
|||||||
130,
|
130,
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||||
false);
|
false);
|
||||||
public static final int OLD_CALLABLE_ANNOTATION_FIELD_NUMBER = 130;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable,
|
|
||||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>> oldCallableAnnotation = com.google.protobuf.GeneratedMessageLite
|
|
||||||
.newRepeatedGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.getDefaultInstance(),
|
|
||||||
null,
|
|
||||||
130,
|
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
|
||||||
false);
|
|
||||||
public static final int OLD_COMPILE_TIME_VALUE_FIELD_NUMBER = 131;
|
|
||||||
/**
|
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Callable { ... }</code>
|
|
||||||
*/
|
|
||||||
public static final
|
|
||||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable,
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value> oldCompileTimeValue = com.google.protobuf.GeneratedMessageLite
|
|
||||||
.newSingularGeneratedExtension(
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Callable.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value.getDefaultInstance(),
|
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value.getDefaultInstance(),
|
|
||||||
null,
|
|
||||||
131,
|
|
||||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
|
||||||
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 130;
|
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 130;
|
||||||
/**
|
/**
|
||||||
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ public object KotlinJavascriptSerializationUtil {
|
|||||||
val packageStream = ByteArrayOutputStream()
|
val packageStream = ByteArrayOutputStream()
|
||||||
val fragments = packageView.fragments
|
val fragments = packageView.fragments
|
||||||
val packageProto = serializer.packageProto(fragments, skip).build() ?: error("Package fragments not serialized: $fragments")
|
val packageProto = serializer.packageProto(fragments, skip).build() ?: error("Package fragments not serialized: $fragments")
|
||||||
if (packageProto.memberCount > 0) {
|
if (packageProto.functionCount > 0 || packageProto.propertyCount > 0) {
|
||||||
packageProto.writeTo(packageStream)
|
packageProto.writeTo(packageStream)
|
||||||
writeFun(KotlinJavascriptSerializedResourcePaths.getPackageFilePath(fqName), packageStream.toByteArray())
|
writeFun(KotlinJavascriptSerializedResourcePaths.getPackageFilePath(fqName), packageStream.toByteArray())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user