Delete signature name from JvmClassName
This commit is contained in:
+3
-70
@@ -63,13 +63,6 @@ public class JvmClassName {
|
||||
return byFqNameWithoutInnerClasses(new FqName(klass.getCanonicalName()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JvmClassName bySignatureName(@NotNull String signatureName) {
|
||||
JvmClassName className = new JvmClassName(signatureNameToInternalName(signatureName));
|
||||
className.signatureName = signatureName;
|
||||
return className;
|
||||
}
|
||||
|
||||
private static String encodeSpecialNames(String str) {
|
||||
String encodedObjectNames = StringUtil.replace(str, JvmAbi.CLASS_OBJECT_CLASS_NAME, CLASS_OBJECT_REPLACE_GUARD);
|
||||
return StringUtil.replace(encodedObjectNames, JvmAbi.TRAIT_IMPL_CLASS_NAME, TRAIT_IMPL_REPLACE_GUARD);
|
||||
@@ -109,39 +102,20 @@ public class JvmClassName {
|
||||
return fqName.asString().replace('.', '/');
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String signatureNameToInternalName(@NotNull String signatureName) {
|
||||
return signatureName.replace('.', '$');
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String internalNameToFqName(@NotNull String name) {
|
||||
return decodeSpecialNames(encodeSpecialNames(name).replace('$', '.').replace('/', '.'));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String internalNameToSignatureName(@NotNull String name) {
|
||||
return decodeSpecialNames(encodeSpecialNames(name).replace('$', '.'));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String signatureNameToFqName(@NotNull String name) {
|
||||
return name.replace('/', '.');
|
||||
}
|
||||
|
||||
|
||||
private final static String CLASS_OBJECT_REPLACE_GUARD = "<class_object>";
|
||||
private final static String TRAIT_IMPL_REPLACE_GUARD = "<trait_impl>";
|
||||
|
||||
// Internal name: jet/Map$Entry
|
||||
// FqName: jet.Map.Entry
|
||||
// Signature name: jet/Map.Entry
|
||||
|
||||
private final String internalName;
|
||||
private FqName fqName;
|
||||
private String descriptor;
|
||||
private String signatureName;
|
||||
|
||||
private Type asmType;
|
||||
|
||||
private JvmClassName(@NotNull String internalName) {
|
||||
@@ -151,7 +125,7 @@ public class JvmClassName {
|
||||
@NotNull
|
||||
public FqName getFqName() {
|
||||
if (fqName == null) {
|
||||
this.fqName = new FqName(internalNameToFqName(internalName));
|
||||
fqName = new FqName(internalNameToFqName(internalName));
|
||||
}
|
||||
return fqName;
|
||||
}
|
||||
@@ -164,11 +138,7 @@ public class JvmClassName {
|
||||
@NotNull
|
||||
public String getDescriptor() {
|
||||
if (descriptor == null) {
|
||||
StringBuilder sb = new StringBuilder(internalName.length() + 2);
|
||||
sb.append('L');
|
||||
sb.append(internalName);
|
||||
sb.append(';');
|
||||
descriptor = sb.toString();
|
||||
descriptor = "L" + internalName + ';';
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
@@ -181,36 +151,6 @@ public class JvmClassName {
|
||||
return asmType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getSignatureName() {
|
||||
if (signatureName == null) {
|
||||
signatureName = internalNameToSignatureName(internalName);
|
||||
}
|
||||
return signatureName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FqName getOuterClassFqName() {
|
||||
String signatureName = getSignatureName();
|
||||
int index = signatureName.indexOf('.');
|
||||
String outerClassName = index != -1 ? signatureName.substring(0, index) : signatureName;
|
||||
return new FqName(signatureNameToFqName(outerClassName));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<String> getInnerClassNameList() {
|
||||
List<String> innerClassList = new ArrayList<String>();
|
||||
String signatureName = getSignatureName();
|
||||
int index = signatureName.indexOf('.');
|
||||
while (index != -1) {
|
||||
int nextIndex = signatureName.indexOf('.', index + 1);
|
||||
String innerClassName = nextIndex != -1 ? signatureName.substring(index + 1, nextIndex) : signatureName.substring(index + 1);
|
||||
innerClassList.add(innerClassName);
|
||||
index = nextIndex;
|
||||
}
|
||||
return innerClassList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getInternalName();
|
||||
@@ -218,20 +158,13 @@ public class JvmClassName {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
// generated by Idea
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
JvmClassName name = (JvmClassName) o;
|
||||
|
||||
if (!internalName.equals(name.internalName)) return false;
|
||||
|
||||
return true;
|
||||
return internalName.equals(((JvmClassName) o).internalName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// generated by Idea
|
||||
return internalName.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user