Drop old JVM binary format extensions: static in outer, impl class name
This commit is contained in:
@@ -835,13 +835,6 @@ public class AsmUtil {
|
||||
return asmTypeByFqNameWithoutInnerClasses(fqName).getDescriptor();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String shortNameByAsmType(@NotNull Type type) {
|
||||
String internalName = type.getInternalName();
|
||||
int lastSlash = internalName.lastIndexOf('/');
|
||||
return lastSlash < 0 ? internalName : internalName.substring(lastSlash + 1);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Type asmTypeByFqNameWithoutInnerClasses(@NotNull FqName fqName) {
|
||||
return Type.getObjectType(internalNameByFqNameWithoutInnerClasses(fqName));
|
||||
|
||||
@@ -77,11 +77,13 @@ import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isNullableAny;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.*;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.INDEX_FOR_VALUE_PARAMETER;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.METHOD_FOR_FUNCTION;
|
||||
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.DECLARATION;
|
||||
import static org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorToSourceUtils.getSourceFromDescriptor;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.getSuperClassDescriptor;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isInterface;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
|
||||
import static org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.*;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
@@ -172,10 +174,6 @@ public class FunctionCodegen {
|
||||
jvmSignature.getGenericsSignature(),
|
||||
getThrownExceptions(functionDescriptor, typeMapper));
|
||||
|
||||
String implClassName = CodegenContextUtil.getImplementationClassShortName(owner);
|
||||
if (implClassName != null) {
|
||||
v.getSerializationBindings().put(METHOD_IMPL_CLASS_NAME, functionDescriptor, implClassName);
|
||||
}
|
||||
if (CodegenContextUtil.isImplClassOwner(owner)) {
|
||||
v.getSerializationBindings().put(METHOD_FOR_FUNCTION, functionDescriptor, asmMethod);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ import java.util.List;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConstOrHasJvmFieldAnnotation;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.*;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.FIELD_FOR_PROPERTY;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.SYNTHETIC_METHOD_FOR_PROPERTY;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.K_PROPERTY_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.annotations.AnnotationUtilKt.hasJvmFieldAnnotation;
|
||||
@@ -111,11 +112,6 @@ public class PropertyCodegen {
|
||||
assert kind == OwnerKind.PACKAGE || kind == OwnerKind.IMPLEMENTATION || kind == OwnerKind.DEFAULT_IMPLS
|
||||
: "Generating property with a wrong kind (" + kind + "): " + descriptor;
|
||||
|
||||
String implClassName = CodegenContextUtil.getImplementationClassShortName(context);
|
||||
if (implClassName != null) {
|
||||
v.getSerializationBindings().put(PROPERTY_IMPL_CLASS_NAME, descriptor, implClassName);
|
||||
}
|
||||
|
||||
if (CodegenContextUtil.isImplClassOwner(context)) {
|
||||
assert declaration != null : "Declaration is null for different context: " + context;
|
||||
|
||||
@@ -266,10 +262,6 @@ public class PropertyCodegen {
|
||||
mv.visitInsn(Opcodes.RETURN);
|
||||
mv.visitEnd();
|
||||
}
|
||||
else {
|
||||
Type tImplType = typeMapper.mapDefaultImpls((ClassDescriptor) context.getContextDescriptor());
|
||||
v.getSerializationBindings().put(PROPERTY_IMPL_CLASS_NAME, descriptor, shortNameByAsmType(tImplType));
|
||||
}
|
||||
|
||||
if (kind != OwnerKind.DEFAULT_IMPLS) {
|
||||
v.getSerializationBindings().put(SYNTHETIC_METHOD_FOR_PROPERTY, descriptor, new Method(name, desc));
|
||||
@@ -330,7 +322,6 @@ public class PropertyCodegen {
|
||||
ImplementationBodyCodegen codegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
|
||||
builder = codegen.v;
|
||||
backingFieldContext = codegen.context;
|
||||
v.getSerializationBindings().put(STATIC_FIELD_IN_OUTER_CLASS, propertyDescriptor);
|
||||
}
|
||||
|
||||
if (isObject(propertyDescriptor.getContainingDeclaration()) &&
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen.context
|
||||
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
|
||||
|
||||
public object CodegenContextUtil {
|
||||
@JvmStatic
|
||||
public fun getImplementationOwnerClassType(owner: CodegenContext<*>): Type? =
|
||||
@@ -29,11 +27,7 @@ public object CodegenContextUtil {
|
||||
else -> null
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun getImplementationClassShortName(owner: CodegenContext<*>): String? =
|
||||
getImplementationOwnerClassType(owner)?.let { AsmUtil.shortNameByAsmType(it) }
|
||||
|
||||
@JvmStatic
|
||||
public fun isImplClassOwner(owner: CodegenContext<*>): Boolean =
|
||||
owner !is DelegatingFacadeContext
|
||||
}
|
||||
}
|
||||
|
||||
-6
@@ -36,12 +36,6 @@ public final class JvmSerializationBindings {
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<PropertyDescriptor, Method> SYNTHETIC_METHOD_FOR_PROPERTY =
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<FunctionDescriptor, String> METHOD_IMPL_CLASS_NAME =
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSlice<PropertyDescriptor, String> PROPERTY_IMPL_CLASS_NAME =
|
||||
SerializationMappingSlice.create();
|
||||
public static final SerializationMappingSetSlice<PropertyDescriptor> STATIC_FIELD_IN_OUTER_CLASS =
|
||||
SerializationMappingSetSlice.create();
|
||||
public static final SerializationMappingSlice<ValueParameterDescriptor, Integer> INDEX_FOR_VALUE_PARAMETER =
|
||||
SerializationMappingSlice.create();
|
||||
|
||||
|
||||
+5
-32
@@ -109,11 +109,6 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
proto.setExtension(JvmProtoBuf.methodSignature, signature);
|
||||
}
|
||||
}
|
||||
|
||||
String name = bindings.get(METHOD_IMPL_CLASS_NAME, descriptor);
|
||||
if (name != null) {
|
||||
proto.setExtension(JvmProtoBuf.methodImplClassName, stringTable.getStringIndex(name));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,35 +121,18 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
Method setterMethod = setter == null ? null : bindings.get(METHOD_FOR_FUNCTION, setter);
|
||||
|
||||
Pair<Type, String> field = bindings.get(FIELD_FOR_PROPERTY, descriptor);
|
||||
String fieldName;
|
||||
String fieldDesc;
|
||||
boolean isStaticInOuter;
|
||||
if (field != null) {
|
||||
fieldName = field.second;
|
||||
fieldDesc = field.first.getDescriptor();
|
||||
isStaticInOuter = bindings.get(STATIC_FIELD_IN_OUTER_CLASS, descriptor);
|
||||
}
|
||||
else {
|
||||
fieldName = null;
|
||||
fieldDesc = null;
|
||||
isStaticInOuter = false;
|
||||
}
|
||||
|
||||
Method syntheticMethod = bindings.get(SYNTHETIC_METHOD_FOR_PROPERTY, descriptor);
|
||||
|
||||
JvmProtoBuf.JvmPropertySignature signature = signatureSerializer.propertySignature(
|
||||
descriptor, fieldName, fieldDesc, isStaticInOuter,
|
||||
descriptor,
|
||||
field != null ? field.second : null,
|
||||
field != null ? field.first.getDescriptor() : null,
|
||||
syntheticMethod != null ? signatureSerializer.methodSignature(null, syntheticMethod) : null,
|
||||
getterMethod != null ? signatureSerializer.methodSignature(null, getterMethod) : null,
|
||||
setterMethod != null ? signatureSerializer.methodSignature(null, setterMethod) : null
|
||||
);
|
||||
|
||||
proto.setExtension(JvmProtoBuf.propertySignature, signature);
|
||||
|
||||
String name = bindings.get(PROPERTY_IMPL_CLASS_NAME, descriptor);
|
||||
if (name != null) {
|
||||
proto.setExtension(JvmProtoBuf.propertyImplClassName, stringTable.getStringIndex(name));
|
||||
}
|
||||
}
|
||||
|
||||
private class SignatureSerializer {
|
||||
@@ -230,7 +208,6 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
@NotNull PropertyDescriptor descriptor,
|
||||
@Nullable String fieldName,
|
||||
@Nullable String fieldDesc,
|
||||
boolean isStaticInOuter,
|
||||
@Nullable JvmProtoBuf.JvmMethodSignature syntheticMethod,
|
||||
@Nullable JvmProtoBuf.JvmMethodSignature getter,
|
||||
@Nullable JvmProtoBuf.JvmMethodSignature setter
|
||||
@@ -239,7 +216,7 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
|
||||
if (fieldDesc != null) {
|
||||
assert fieldName != null : "Field name shouldn't be null when there's a field type: " + fieldDesc;
|
||||
signature.setField(fieldSignature(descriptor, fieldName, fieldDesc, isStaticInOuter));
|
||||
signature.setField(fieldSignature(descriptor, fieldName, fieldDesc));
|
||||
}
|
||||
|
||||
if (syntheticMethod != null) {
|
||||
@@ -260,8 +237,7 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
public JvmProtoBuf.JvmFieldSignature fieldSignature(
|
||||
@NotNull PropertyDescriptor descriptor,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
boolean isStaticInOuter
|
||||
@NotNull String desc
|
||||
) {
|
||||
JvmProtoBuf.JvmFieldSignature.Builder builder = JvmProtoBuf.JvmFieldSignature.newBuilder();
|
||||
if (!descriptor.getName().asString().equals(name)) {
|
||||
@@ -270,9 +246,6 @@ public class JvmSerializerExtension extends SerializerExtension {
|
||||
if (requiresSignature(descriptor, desc)) {
|
||||
builder.setDesc(stringTable.getStringIndex(desc));
|
||||
}
|
||||
if (isStaticInOuter) {
|
||||
builder.setIsStaticInOuter(true);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ public final class DebugJvmProtoBuf {
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.constructorSignature);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.methodSignature);
|
||||
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.propertyImplClassName);
|
||||
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.typeParameterAnnotation);
|
||||
@@ -2905,26 +2903,6 @@ public final class DebugJvmProtoBuf {
|
||||
* </pre>
|
||||
*/
|
||||
int getDesc();
|
||||
|
||||
// optional bool is_static_in_outer = 3 [default = false];
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
boolean hasIsStaticInOuter();
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
boolean getIsStaticInOuter();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.JvmFieldSignature}
|
||||
@@ -2987,11 +2965,6 @@ public final class DebugJvmProtoBuf {
|
||||
desc_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
bitField0_ |= 0x00000004;
|
||||
isStaticInOuter_ = input.readBool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -3072,36 +3045,9 @@ public final class DebugJvmProtoBuf {
|
||||
return desc_;
|
||||
}
|
||||
|
||||
// optional bool is_static_in_outer = 3 [default = false];
|
||||
public static final int IS_STATIC_IN_OUTER_FIELD_NUMBER = 3;
|
||||
private boolean isStaticInOuter_;
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasIsStaticInOuter() {
|
||||
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean getIsStaticInOuter() {
|
||||
return isStaticInOuter_;
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
name_ = 0;
|
||||
desc_ = 0;
|
||||
isStaticInOuter_ = false;
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
@@ -3121,9 +3067,6 @@ public final class DebugJvmProtoBuf {
|
||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
output.writeInt32(2, desc_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
output.writeBool(3, isStaticInOuter_);
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@@ -3141,10 +3084,6 @@ public final class DebugJvmProtoBuf {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(2, desc_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeBoolSize(3, isStaticInOuter_);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -3265,8 +3204,6 @@ public final class DebugJvmProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
desc_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00000002);
|
||||
isStaticInOuter_ = false;
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -3303,10 +3240,6 @@ public final class DebugJvmProtoBuf {
|
||||
to_bitField0_ |= 0x00000002;
|
||||
}
|
||||
result.desc_ = desc_;
|
||||
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
to_bitField0_ |= 0x00000004;
|
||||
}
|
||||
result.isStaticInOuter_ = isStaticInOuter_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
onBuilt();
|
||||
return result;
|
||||
@@ -3329,9 +3262,6 @@ public final class DebugJvmProtoBuf {
|
||||
if (other.hasDesc()) {
|
||||
setDesc(other.getDesc());
|
||||
}
|
||||
if (other.hasIsStaticInOuter()) {
|
||||
setIsStaticInOuter(other.getIsStaticInOuter());
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
@@ -3441,59 +3371,6 @@ public final class DebugJvmProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional bool is_static_in_outer = 3 [default = false];
|
||||
private boolean isStaticInOuter_ ;
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasIsStaticInOuter() {
|
||||
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean getIsStaticInOuter() {
|
||||
return isStaticInOuter_;
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setIsStaticInOuter(boolean value) {
|
||||
bitField0_ |= 0x00000004;
|
||||
isStaticInOuter_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearIsStaticInOuter() {
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
isStaticInOuter_ = false;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.jvm.JvmFieldSignature)
|
||||
}
|
||||
|
||||
@@ -4670,17 +4547,6 @@ public final class DebugJvmProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmMethodSignature.class,
|
||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance());
|
||||
public static final int METHOD_IMPL_CLASS_NAME_FIELD_NUMBER = 101;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Function,
|
||||
java.lang.Integer> methodImplClassName = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int PROPERTY_SIGNATURE_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
|
||||
@@ -4692,17 +4558,6 @@ public final class DebugJvmProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmPropertySignature.class,
|
||||
org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf.JvmPropertySignature.getDefaultInstance());
|
||||
public static final int PROPERTY_IMPL_CLASS_NAME_FIELD_NUMBER = 101;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
|
||||
java.lang.Integer> propertyImplClassName = com.google.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
|
||||
@@ -4809,45 +4664,40 @@ public final class DebugJvmProtoBuf {
|
||||
"ration\022\010\n\004NONE\020\000\022\030\n\024INTERNAL_TO_CLASS_ID" +
|
||||
"\020\001\022\024\n\020DESC_TO_CLASS_ID\020\002\"<\n\022JvmMethodSig" +
|
||||
"nature\022\022\n\004name\030\001 \001(\005B\004\230\265\030\001\022\022\n\004desc\030\002 \001(\005" +
|
||||
"B\004\230\265\030\001\"^\n\021JvmFieldSignature\022\022\n\004name\030\001 \001(" +
|
||||
"\005B\004\230\265\030\001\022\022\n\004desc\030\002 \001(\005B\004\230\265\030\001\022!\n\022is_static" +
|
||||
"_in_outer\030\003 \001(\010:\005false\"\316\002\n\024JvmPropertySi",
|
||||
"gnature\022H\n\005field\030\001 \001(\01329.org.jetbrains.k" +
|
||||
"otlin.serialization.jvm.JvmFieldSignatur" +
|
||||
"e\022T\n\020synthetic_method\030\002 \001(\0132:.org.jetbra" +
|
||||
"ins.kotlin.serialization.jvm.JvmMethodSi" +
|
||||
"gnature\022J\n\006getter\030\003 \001(\0132:.org.jetbrains." +
|
||||
"kotlin.serialization.jvm.JvmMethodSignat" +
|
||||
"ure\022J\n\006setter\030\004 \001(\0132:.org.jetbrains.kotl" +
|
||||
"in.serialization.jvm.JvmMethodSignature:" +
|
||||
"\212\001\n\025constructor_signature\022/.org.jetbrain" +
|
||||
"s.kotlin.serialization.Constructor\030d \001(\013",
|
||||
"2:.org.jetbrains.kotlin.serialization.jv" +
|
||||
"m.JvmMethodSignature:\202\001\n\020method_signatur" +
|
||||
"e\022,.org.jetbrains.kotlin.serialization.F" +
|
||||
"unction\030d \001(\0132:.org.jetbrains.kotlin.ser" +
|
||||
"ialization.jvm.JvmMethodSignature:R\n\026met" +
|
||||
"hod_impl_class_name\022,.org.jetbrains.kotl" +
|
||||
"in.serialization.Function\030e \001(\005B\004\230\265\030\001:\206\001" +
|
||||
"\n\022property_signature\022,.org.jetbrains.kot" +
|
||||
"lin.serialization.Property\030d \001(\0132<.org.j" +
|
||||
"etbrains.kotlin.serialization.jvm.JvmPro",
|
||||
"pertySignature:T\n\030property_impl_class_na" +
|
||||
"me\022,.org.jetbrains.kotlin.serialization." +
|
||||
"Property\030e \001(\005B\004\230\265\030\001:q\n\017type_annotation\022" +
|
||||
"(.org.jetbrains.kotlin.serialization.Typ" +
|
||||
"e\030d \003(\0132..org.jetbrains.kotlin.serializa" +
|
||||
"tion.Annotation:8\n\006is_raw\022(.org.jetbrain" +
|
||||
"s.kotlin.serialization.Type\030e \001(\010:\204\001\n\031ty" +
|
||||
"pe_parameter_annotation\0221.org.jetbrains." +
|
||||
"kotlin.serialization.TypeParameter\030d \003(\013" +
|
||||
"2..org.jetbrains.kotlin.serialization.An",
|
||||
"notation:A\n\005index\0222.org.jetbrains.kotlin" +
|
||||
".serialization.ValueParameter\030d \001(\005:s\n\020c" +
|
||||
"lass_annotation\022).org.jetbrains.kotlin.s" +
|
||||
"erialization.Class\030d \003(\0132..org.jetbrains" +
|
||||
".kotlin.serialization.AnnotationB\022B\020Debu" +
|
||||
"gJvmProtoBuf"
|
||||
"B\004\230\265\030\001\";\n\021JvmFieldSignature\022\022\n\004name\030\001 \001(" +
|
||||
"\005B\004\230\265\030\001\022\022\n\004desc\030\002 \001(\005B\004\230\265\030\001\"\316\002\n\024JvmPrope" +
|
||||
"rtySignature\022H\n\005field\030\001 \001(\01329.org.jetbra",
|
||||
"ins.kotlin.serialization.jvm.JvmFieldSig" +
|
||||
"nature\022T\n\020synthetic_method\030\002 \001(\0132:.org.j" +
|
||||
"etbrains.kotlin.serialization.jvm.JvmMet" +
|
||||
"hodSignature\022J\n\006getter\030\003 \001(\0132:.org.jetbr" +
|
||||
"ains.kotlin.serialization.jvm.JvmMethodS" +
|
||||
"ignature\022J\n\006setter\030\004 \001(\0132:.org.jetbrains" +
|
||||
".kotlin.serialization.jvm.JvmMethodSigna" +
|
||||
"ture:\212\001\n\025constructor_signature\022/.org.jet" +
|
||||
"brains.kotlin.serialization.Constructor\030" +
|
||||
"d \001(\0132:.org.jetbrains.kotlin.serializati",
|
||||
"on.jvm.JvmMethodSignature:\202\001\n\020method_sig" +
|
||||
"nature\022,.org.jetbrains.kotlin.serializat" +
|
||||
"ion.Function\030d \001(\0132:.org.jetbrains.kotli" +
|
||||
"n.serialization.jvm.JvmMethodSignature:\206" +
|
||||
"\001\n\022property_signature\022,.org.jetbrains.ko" +
|
||||
"tlin.serialization.Property\030d \001(\0132<.org." +
|
||||
"jetbrains.kotlin.serialization.jvm.JvmPr" +
|
||||
"opertySignature:q\n\017type_annotation\022(.org" +
|
||||
".jetbrains.kotlin.serialization.Type\030d \003" +
|
||||
"(\0132..org.jetbrains.kotlin.serialization.",
|
||||
"Annotation:8\n\006is_raw\022(.org.jetbrains.kot" +
|
||||
"lin.serialization.Type\030e \001(\010:\204\001\n\031type_pa" +
|
||||
"rameter_annotation\0221.org.jetbrains.kotli" +
|
||||
"n.serialization.TypeParameter\030d \003(\0132..or" +
|
||||
"g.jetbrains.kotlin.serialization.Annotat" +
|
||||
"ion:A\n\005index\0222.org.jetbrains.kotlin.seri" +
|
||||
"alization.ValueParameter\030d \001(\005:s\n\020class_" +
|
||||
"annotation\022).org.jetbrains.kotlin.serial" +
|
||||
"ization.Class\030d \003(\0132..org.jetbrains.kotl" +
|
||||
"in.serialization.AnnotationB\022B\020DebugJvmP",
|
||||
"rotoBuf"
|
||||
};
|
||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||
@@ -4877,7 +4727,7 @@ public final class DebugJvmProtoBuf {
|
||||
internal_static_org_jetbrains_kotlin_serialization_jvm_JvmFieldSignature_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_org_jetbrains_kotlin_serialization_jvm_JvmFieldSignature_descriptor,
|
||||
new java.lang.String[] { "Name", "Desc", "IsStaticInOuter", });
|
||||
new java.lang.String[] { "Name", "Desc", });
|
||||
internal_static_org_jetbrains_kotlin_serialization_jvm_JvmPropertySignature_descriptor =
|
||||
getDescriptor().getMessageTypes().get(3);
|
||||
internal_static_org_jetbrains_kotlin_serialization_jvm_JvmPropertySignature_fieldAccessorTable = new
|
||||
@@ -4886,22 +4736,18 @@ public final class DebugJvmProtoBuf {
|
||||
new java.lang.String[] { "Field", "SyntheticMethod", "Getter", "Setter", });
|
||||
constructorSignature.internalInit(descriptor.getExtensions().get(0));
|
||||
methodSignature.internalInit(descriptor.getExtensions().get(1));
|
||||
methodImplClassName.internalInit(descriptor.getExtensions().get(2));
|
||||
propertySignature.internalInit(descriptor.getExtensions().get(3));
|
||||
propertyImplClassName.internalInit(descriptor.getExtensions().get(4));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||
isRaw.internalInit(descriptor.getExtensions().get(6));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(7));
|
||||
index.internalInit(descriptor.getExtensions().get(8));
|
||||
classAnnotation.internalInit(descriptor.getExtensions().get(9));
|
||||
propertySignature.internalInit(descriptor.getExtensions().get(2));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(3));
|
||||
isRaw.internalInit(descriptor.getExtensions().get(4));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||
index.internalInit(descriptor.getExtensions().get(6));
|
||||
classAnnotation.internalInit(descriptor.getExtensions().get(7));
|
||||
com.google.protobuf.ExtensionRegistry registry =
|
||||
com.google.protobuf.ExtensionRegistry.newInstance();
|
||||
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);
|
||||
return registry;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,10 +76,6 @@ message JvmFieldSignature {
|
||||
|
||||
// JVM descriptor of the field type, e.g. 'Ljava/lang/String;'
|
||||
optional int32 desc = 2 [(string_id_in_table) = true];
|
||||
|
||||
// True iff this field is a backing field for a companion object and is really present as a static
|
||||
// field in the outer class, not as an instance field here
|
||||
optional bool is_static_in_outer = 3 [default = false];
|
||||
}
|
||||
|
||||
message JvmPropertySignature {
|
||||
@@ -98,20 +94,10 @@ extend Constructor {
|
||||
|
||||
extend Function {
|
||||
optional JvmMethodSignature method_signature = 100;
|
||||
|
||||
// Package-less name of the class with the callable's body and annotations, if it differs from the class it's serialized into.
|
||||
// E.g. for a class "A/B/C$D" this would be "C$D".
|
||||
// This is needed to find the class to load annotations from in the following cases:
|
||||
// 1) annotations on top-level members are written to compiled package part classes
|
||||
// 2) annotations on properties in traits are written to TImpl classes
|
||||
optional int32 method_impl_class_name = 101 [(string_id_in_table) = true];
|
||||
}
|
||||
|
||||
extend Property {
|
||||
optional JvmPropertySignature property_signature = 100;
|
||||
|
||||
// see Function#method_impl_class_name
|
||||
optional int32 property_impl_class_name = 101 [(string_id_in_table) = true];
|
||||
}
|
||||
|
||||
extend Type {
|
||||
|
||||
-153
@@ -9,9 +9,7 @@ public final class JvmProtoBuf {
|
||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.constructorSignature);
|
||||
registry.add(org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.methodSignature);
|
||||
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.propertyImplClassName);
|
||||
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.typeParameterAnnotation);
|
||||
@@ -2538,26 +2536,6 @@ public final class JvmProtoBuf {
|
||||
* </pre>
|
||||
*/
|
||||
int getDesc();
|
||||
|
||||
// optional bool is_static_in_outer = 3 [default = false];
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
boolean hasIsStaticInOuter();
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
boolean getIsStaticInOuter();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.JvmFieldSignature}
|
||||
@@ -2612,11 +2590,6 @@ public final class JvmProtoBuf {
|
||||
desc_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 24: {
|
||||
bitField0_ |= 0x00000004;
|
||||
isStaticInOuter_ = input.readBool();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -2684,36 +2657,9 @@ public final class JvmProtoBuf {
|
||||
return desc_;
|
||||
}
|
||||
|
||||
// optional bool is_static_in_outer = 3 [default = false];
|
||||
public static final int IS_STATIC_IN_OUTER_FIELD_NUMBER = 3;
|
||||
private boolean isStaticInOuter_;
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasIsStaticInOuter() {
|
||||
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean getIsStaticInOuter() {
|
||||
return isStaticInOuter_;
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
name_ = 0;
|
||||
desc_ = 0;
|
||||
isStaticInOuter_ = false;
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
@@ -2733,9 +2679,6 @@ public final class JvmProtoBuf {
|
||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
output.writeInt32(2, desc_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
output.writeBool(3, isStaticInOuter_);
|
||||
}
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
@@ -2752,10 +2695,6 @@ public final class JvmProtoBuf {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(2, desc_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeBoolSize(3, isStaticInOuter_);
|
||||
}
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
@@ -2851,8 +2790,6 @@ public final class JvmProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
desc_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00000002);
|
||||
isStaticInOuter_ = false;
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2884,10 +2821,6 @@ public final class JvmProtoBuf {
|
||||
to_bitField0_ |= 0x00000002;
|
||||
}
|
||||
result.desc_ = desc_;
|
||||
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
to_bitField0_ |= 0x00000004;
|
||||
}
|
||||
result.isStaticInOuter_ = isStaticInOuter_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
return result;
|
||||
}
|
||||
@@ -2900,9 +2833,6 @@ public final class JvmProtoBuf {
|
||||
if (other.hasDesc()) {
|
||||
setDesc(other.getDesc());
|
||||
}
|
||||
if (other.hasIsStaticInOuter()) {
|
||||
setIsStaticInOuter(other.getIsStaticInOuter());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -3011,59 +2941,6 @@ public final class JvmProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional bool is_static_in_outer = 3 [default = false];
|
||||
private boolean isStaticInOuter_ ;
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasIsStaticInOuter() {
|
||||
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public boolean getIsStaticInOuter() {
|
||||
return isStaticInOuter_;
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setIsStaticInOuter(boolean value) {
|
||||
bitField0_ |= 0x00000004;
|
||||
isStaticInOuter_ = value;
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional bool is_static_in_outer = 3 [default = false];</code>
|
||||
*
|
||||
* <pre>
|
||||
* True iff this field is a backing field for a companion object and is really present as a static
|
||||
* field in the outer class, not as an instance field here
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearIsStaticInOuter() {
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
isStaticInOuter_ = false;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.jvm.JvmFieldSignature)
|
||||
}
|
||||
|
||||
@@ -3865,21 +3742,6 @@ public final class JvmProtoBuf {
|
||||
null,
|
||||
100,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
||||
public static final int METHOD_IMPL_CLASS_NAME_FIELD_NUMBER = 101;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Function,
|
||||
java.lang.Integer> methodImplClassName = com.google.protobuf.GeneratedMessageLite
|
||||
.newSingularGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Function.getDefaultInstance(),
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
101,
|
||||
com.google.protobuf.WireFormat.FieldType.INT32);
|
||||
public static final int PROPERTY_SIGNATURE_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
|
||||
@@ -3895,21 +3757,6 @@ public final class JvmProtoBuf {
|
||||
null,
|
||||
100,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE);
|
||||
public static final int PROPERTY_IMPL_CLASS_NAME_FIELD_NUMBER = 101;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
com.google.protobuf.GeneratedMessageLite.GeneratedExtension<
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Property,
|
||||
java.lang.Integer> propertyImplClassName = com.google.protobuf.GeneratedMessageLite
|
||||
.newSingularGeneratedExtension(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Property.getDefaultInstance(),
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
101,
|
||||
com.google.protobuf.WireFormat.FieldType.INT32);
|
||||
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isClassOrEnumClass
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isCompanionObject
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
|
||||
import java.lang.reflect.Field
|
||||
import kotlin.reflect.jvm.internal.JvmPropertySignature.JavaField
|
||||
@@ -50,7 +53,10 @@ internal abstract class DescriptorBasedProperty<out R> protected constructor(
|
||||
when (jvmSignature) {
|
||||
is KotlinProperty -> {
|
||||
JvmProtoBufUtil.getJvmFieldSignature(jvmSignature.proto, jvmSignature.nameResolver, jvmSignature.typeTable)?.let {
|
||||
container.findFieldBySignature(jvmSignature.proto, jvmSignature.nameResolver, it.name)
|
||||
val isCompanionOfClass = (descriptor.containingDeclaration as? ClassDescriptor)?.let { containingClass ->
|
||||
isCompanionObject(containingClass) && isClassOrEnumClass(containingClass.containingDeclaration)
|
||||
} ?: false
|
||||
container.findFieldBySignature(it.name, isCompanionOfClass)
|
||||
}
|
||||
}
|
||||
is JavaField -> jvmSignature.field
|
||||
|
||||
@@ -19,16 +19,11 @@ package kotlin.reflect.jvm.internal
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.load.java.structure.reflect.classId
|
||||
import org.jetbrains.kotlin.load.java.structure.reflect.createArrayType
|
||||
import org.jetbrains.kotlin.load.java.structure.reflect.safeClassLoader
|
||||
import org.jetbrains.kotlin.load.kotlin.reflect.RuntimeModuleData
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.Method
|
||||
@@ -242,16 +237,8 @@ internal abstract class KDeclarationContainerImpl : ClassBasedDeclarationContain
|
||||
}
|
||||
|
||||
// TODO: check resulting field's type
|
||||
fun findFieldBySignature(
|
||||
proto: ProtoBuf.Property,
|
||||
nameResolver: NameResolver,
|
||||
name: String
|
||||
): Field? {
|
||||
val owner = implClassForCallable(nameResolver, proto) ?:
|
||||
if (proto.hasExtension(JvmProtoBuf.propertySignature) &&
|
||||
proto.getExtension(JvmProtoBuf.propertySignature).let { it.hasField() && it.field.isStaticInOuter }) {
|
||||
jClass.enclosingClass ?: throw KotlinReflectionInternalError("Inconsistent metadata for field $name in $jClass")
|
||||
} else jClass
|
||||
fun findFieldBySignature(name: String, isCompanionOfClass: Boolean): Field? {
|
||||
val owner = if (isCompanionOfClass) jClass.enclosingClass else jClass
|
||||
|
||||
return try {
|
||||
owner.getDeclaredField(name)
|
||||
@@ -261,17 +248,6 @@ internal abstract class KDeclarationContainerImpl : ClassBasedDeclarationContain
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the JVM class which contains this callable. This class may be different from the one represented by descriptors
|
||||
// in case of top level functions (their bodies are in package parts), methods with implementations in interfaces, etc.
|
||||
private fun implClassForCallable(nameResolver: NameResolver, proto: ProtoBuf.Property): Class<*>? {
|
||||
if (!proto.hasExtension(JvmProtoBuf.propertyImplClassName)) return null
|
||||
|
||||
val implClassName = nameResolver.getName(proto.getExtension(JvmProtoBuf.propertyImplClassName))
|
||||
// TODO: store fq name of impl class name in jvm_descriptors.proto
|
||||
val classId = ClassId(jClass.classId.packageFqName, implClassName)
|
||||
return jClass.safeClassLoader.loadClass(classId.asSingleFqName().asString())
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val DEFAULT_CONSTRUCTOR_MARKER = Class.forName("kotlin.jvm.internal.DefaultConstructorMarker")
|
||||
}
|
||||
|
||||
@@ -212,11 +212,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
if (!checkEquals(old.getExtension(JvmProtoBuf.methodSignature), new.getExtension(JvmProtoBuf.methodSignature))) return false
|
||||
}
|
||||
|
||||
if (old.hasExtension(JvmProtoBuf.methodImplClassName) != new.hasExtension(JvmProtoBuf.methodImplClassName)) return false
|
||||
if (old.hasExtension(JvmProtoBuf.methodImplClassName)) {
|
||||
if (!checkStringEquals(old.getExtension(JvmProtoBuf.methodImplClassName), new.getExtension(JvmProtoBuf.methodImplClassName))) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -270,11 +265,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
if (!checkEquals(old.getExtension(JvmProtoBuf.propertySignature), new.getExtension(JvmProtoBuf.propertySignature))) return false
|
||||
}
|
||||
|
||||
if (old.hasExtension(JvmProtoBuf.propertyImplClassName) != new.hasExtension(JvmProtoBuf.propertyImplClassName)) return false
|
||||
if (old.hasExtension(JvmProtoBuf.propertyImplClassName)) {
|
||||
if (!checkStringEquals(old.getExtension(JvmProtoBuf.propertyImplClassName), new.getExtension(JvmProtoBuf.propertyImplClassName))) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -524,11 +514,6 @@ open class ProtoCompareGenerated(public val oldNameResolver: NameResolver, publi
|
||||
if (!checkStringEquals(old.desc, new.desc)) return false
|
||||
}
|
||||
|
||||
if (old.hasIsStaticInOuter() != new.hasIsStaticInOuter()) return false
|
||||
if (old.hasIsStaticInOuter()) {
|
||||
if (old.isStaticInOuter != new.isStaticInOuter) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -924,10 +909,6 @@ public fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes
|
||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.methodSignature).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasExtension(JvmProtoBuf.methodImplClassName)) {
|
||||
hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.methodImplClassName))
|
||||
}
|
||||
|
||||
return hashCode
|
||||
}
|
||||
|
||||
@@ -976,10 +957,6 @@ public fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes
|
||||
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.propertySignature).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
if (hasExtension(JvmProtoBuf.propertyImplClassName)) {
|
||||
hashCode = 31 * hashCode + stringIndexes(getExtension(JvmProtoBuf.propertyImplClassName))
|
||||
}
|
||||
|
||||
return hashCode
|
||||
}
|
||||
|
||||
@@ -1228,10 +1205,6 @@ public fun JvmProtoBuf.JvmFieldSignature.hashCode(stringIndexes: (Int) -> Int, f
|
||||
hashCode = 31 * hashCode + stringIndexes(desc)
|
||||
}
|
||||
|
||||
if (hasIsStaticInOuter()) {
|
||||
hashCode = 31 * hashCode + isStaticInOuter.hashCode()
|
||||
}
|
||||
|
||||
return hashCode
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user