Removed dependency on asm in descriptor.loader.java

Conflicts:
	compiler/backend/src/org/jetbrains/jet/codegen/JavaSerializerExtension.java
This commit is contained in:
Evgeny Gerashchenko
2014-03-19 02:02:53 +04:00
parent 9f8a16fb1a
commit a44f0c2f2d
4 changed files with 26 additions and 22 deletions
@@ -63,17 +63,17 @@ public abstract class BaseDescriptorDeserializer {
switch (kind) {
case FUNCTION:
if (proto.hasExtension(JavaProtoBuf.methodSignature)) {
return MemberSignature.fromAsmMethod(deserializer.methodSignature(proto.getExtension(JavaProtoBuf.methodSignature)));
return deserializer.methodSignature(proto.getExtension(JavaProtoBuf.methodSignature));
}
break;
case PROPERTY_GETTER:
if (proto.hasExtension(JavaProtoBuf.propertySignature)) {
return MemberSignature.fromAsmMethod(deserializer.methodSignature(proto.getExtension(JavaProtoBuf.propertySignature).getGetter()));
return deserializer.methodSignature(proto.getExtension(JavaProtoBuf.propertySignature).getGetter());
}
break;
case PROPERTY_SETTER:
if (proto.hasExtension(JavaProtoBuf.propertySignature)) {
return MemberSignature.fromAsmMethod(deserializer.methodSignature(proto.getExtension(JavaProtoBuf.propertySignature).getSetter()));
return deserializer.methodSignature(proto.getExtension(JavaProtoBuf.propertySignature).getSetter());
}
break;
case PROPERTY:
@@ -87,7 +87,7 @@ public abstract class BaseDescriptorDeserializer {
return MemberSignature.fromFieldNameAndDesc(name, type);
}
else if (propertySignature.hasSyntheticMethod()) {
return MemberSignature.fromAsmMethod(deserializer.methodSignature(propertySignature.getSyntheticMethod()));
return deserializer.methodSignature(propertySignature.getSyntheticMethod());
}
}
break;
@@ -19,7 +19,6 @@ package org.jetbrains.jet.lang.resolve.kotlin;
import kotlin.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.asm4.commons.Method;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.resolve.constants.ConstantsPackage;
@@ -81,7 +80,7 @@ public class DescriptorDeserializersStorage {
@Nullable
@Override
public KotlinJvmBinaryClass.MethodAnnotationVisitor visitMethod(@NotNull Name name, @NotNull String desc) {
return new AnnotationVisitorForMethod(MemberSignature.fromMethodNameAndDesc(name, desc));
return new AnnotationVisitorForMethod(MemberSignature.fromMethodNameAndDesc(name.asString() + desc));
}
@Nullable
@@ -141,7 +140,7 @@ public class DescriptorDeserializersStorage {
// The purpose of this class is to hold a unique signature of either a method or a field, so that annotations on a member can be put
// into a map indexed by these signatures
protected static final class MemberSignature {
public static final class MemberSignature {
private final String signature;
private MemberSignature(@NotNull String signature) {
@@ -149,13 +148,8 @@ public class DescriptorDeserializersStorage {
}
@NotNull
public static MemberSignature fromMethodNameAndDesc(@NotNull Name name, @NotNull String desc) {
return new MemberSignature(name.asString() + desc);
}
@NotNull
public static MemberSignature fromAsmMethod(@NotNull Method method) {
return new MemberSignature(method.toString());
public static MemberSignature fromMethodNameAndDesc(@NotNull String nameAndDesc) {
return new MemberSignature(nameAndDesc);
}
@NotNull
@@ -17,7 +17,6 @@
package org.jetbrains.jet.lang.resolve.kotlin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.asm4.commons.Method;
import org.jetbrains.jet.descriptors.serialization.JavaProtoBuf;
import org.jetbrains.jet.descriptors.serialization.NameResolver;
import org.jetbrains.jet.lang.resolve.name.FqName;
@@ -34,7 +33,7 @@ public class SignatureDeserializer {
}
@NotNull
public Method methodSignature(@NotNull JavaProtoBuf.JavaMethodSignature signature) {
public String methodSignatureString(@NotNull JavaProtoBuf.JavaMethodSignature signature) {
Name name = nameResolver.getName(signature.getName());
StringBuilder sb = new StringBuilder();
@@ -45,7 +44,12 @@ public class SignatureDeserializer {
sb.append(')');
typeDescriptor(signature.getReturnType(), sb);
return new Method(name.asString(), sb.toString());
return name.asString() + sb.toString();
}
@NotNull
public DescriptorDeserializersStorage.MemberSignature methodSignature(@NotNull JavaProtoBuf.JavaMethodSignature signature) {
return DescriptorDeserializersStorage.MemberSignature.fromMethodNameAndDesc(methodSignatureString(signature));
}
@NotNull