Rename JvmClassName.getFqName() and add a warning
All usages of this method as of right now seem wrong, as they don't work in the case of classes which contain dollars in their names -- dollars get replaced to dots
This commit is contained in:
+2
-1
@@ -69,7 +69,8 @@ public class KotlinLightClassForExplicitDeclaration extends AbstractLightClass i
|
||||
String jvmInternalName = PsiCodegenPredictor.getPredefinedJvmInternalName(classOrObject);
|
||||
if (jvmInternalName == null) return null;
|
||||
|
||||
return new KotlinLightClassForExplicitDeclaration(manager, JvmClassName.byInternalName(jvmInternalName).getFqName(), classOrObject);
|
||||
FqName fqName = JvmClassName.byInternalName(jvmInternalName).getFqNameForClassNameWithoutDollars();
|
||||
return new KotlinLightClassForExplicitDeclaration(manager, fqName, classOrObject);
|
||||
}
|
||||
|
||||
private final FqName classFqName; // FqName of (possibly inner) class
|
||||
|
||||
+4
-1
@@ -77,8 +77,11 @@ public class JvmClassName {
|
||||
this.internalName = internalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* WARNING: internal name cannot be converted to FQ name for a class which contains dollars in the name
|
||||
*/
|
||||
@NotNull
|
||||
public FqName getFqName() {
|
||||
public FqName getFqNameForClassNameWithoutDollars() {
|
||||
if (fqName == null) {
|
||||
fqName = new FqName(internalNameToFqName(internalName));
|
||||
}
|
||||
|
||||
+2
-1
@@ -210,7 +210,8 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
|
||||
@NotNull
|
||||
private ClassDescriptor resolveClass(@NotNull JvmClassName className) {
|
||||
ClassDescriptor annotationClass = javaClassResolver.resolveClass(className.getFqName(), IGNORE_KOTLIN_SOURCES);
|
||||
ClassDescriptor annotationClass = javaClassResolver.resolveClass(className.getFqNameForClassNameWithoutDollars(),
|
||||
IGNORE_KOTLIN_SOURCES);
|
||||
return annotationClass != null ? annotationClass : ErrorUtils.getErrorClass();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public final class DecompiledDataFactory {
|
||||
this.javaDescriptorResolver = injector.getJavaDescriptorResolver();
|
||||
|
||||
VirtualFileKotlinClass kotlinClass = new VirtualFileKotlinClass(classFile);
|
||||
this.classFqName = kotlinClass.getClassName().getFqName();
|
||||
this.classFqName = kotlinClass.getClassName().getFqNameForClassNameWithoutDollars();
|
||||
|
||||
KotlinClassFileHeader header = KotlinClassFileHeader.readKotlinHeaderFromClassFile(kotlinClass);
|
||||
assert header instanceof SerializedDataHeader : "Decompiled data factory shouldn't be called on an unsupported file: " + classFile;
|
||||
|
||||
@@ -370,7 +370,7 @@ public class JetSourceNavigationHelper {
|
||||
if (internalName == null) {
|
||||
return null;
|
||||
}
|
||||
String fqName = JvmClassName.byInternalName(internalName).getFqName().asString();
|
||||
String fqName = JvmClassName.byInternalName(internalName).getFqNameForClassNameWithoutDollars().asString();
|
||||
|
||||
JetFile file = (JetFile) classOrObject.getContainingFile();
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public final class KotlinClassFileIndex extends ScalarIndexExtension<FqName> {
|
||||
VirtualFileKotlinClass kotlinClass = new VirtualFileKotlinClass(inputData.getFile());
|
||||
KotlinClassFileHeader header = KotlinClassFileHeader.readKotlinHeaderFromClassFile(kotlinClass);
|
||||
if (header != null && !(header instanceof IncompatibleAnnotationHeader)) {
|
||||
return Collections.singletonMap(kotlinClass.getClassName().getFqName(), null);
|
||||
return Collections.singletonMap(kotlinClass.getClassName().getFqNameForClassNameWithoutDollars(), null);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
|
||||
Reference in New Issue
Block a user