Minimize usages of JvmClassName.getFqName()

This commit is contained in:
Alexander Udalov
2013-10-03 19:47:25 +04:00
parent fa4f568437
commit e8d4aae48b
5 changed files with 19 additions and 20 deletions
@@ -86,6 +86,13 @@ public final class PsiCodegenPredictor {
if (packageName == null) {
return null;
}
if (declaration instanceof JetNamedFunction) {
JvmClassName packageClass = JvmClassName.byFqNameWithoutInnerClasses(getPackageClassFqName(new FqName(packageName)));
Name name = ((JetNamedFunction) declaration).getNameAsName();
return name == null ? null : packageClass.getInternalName() + "$" + name.asString();
}
parentInternalName = JvmClassName.byFqNameWithoutInnerClasses(packageName).getInternalName();
}
@@ -101,19 +108,12 @@ public final class PsiCodegenPredictor {
return null;
}
JetNamedDeclaration namedDeclaration = (JetNamedDeclaration) declaration;
Name name = namedDeclaration.getNameAsName();
Name name = ((JetNamedDeclaration) declaration).getNameAsName();
if (name == null) {
return null;
}
if (declaration instanceof JetNamedFunction) {
if (parentDeclaration == null) {
FqName fqName = JvmClassName.byInternalName(parentInternalName).getFqName();
JvmClassName packageClass = JvmClassName.byFqNameWithoutInnerClasses(getPackageClassFqName(fqName));
return packageClass.getInternalName() + "$" + name.asString();
}
if (!(parentDeclaration instanceof JetClass || parentDeclaration instanceof JetObjectDeclaration)) {
// Can't generate predefined name for internal functions
return null;
@@ -143,10 +143,9 @@ public final class AnalyzerWithCompilerReport {
Collection<VirtualFileKotlinClass> errorClasses = bindingContext.getKeys(TraceBasedErrorReporter.ABI_VERSION_ERRORS);
for (VirtualFileKotlinClass kotlinClass : errorClasses) {
Integer abiVersion = bindingContext.get(TraceBasedErrorReporter.ABI_VERSION_ERRORS, kotlinClass);
String fqName = kotlinClass.getClassName().getFqName().asString();
String path = toSystemDependentName(kotlinClass.getFile().getPath());
messageCollectorWrapper.report(CompilerMessageSeverity.ERROR,
"Class '" + fqName +
"Class '" + kotlinClass.getClassName() +
"' was compiled with an incompatible version of Kotlin. " +
"Its ABI version is " + abiVersion + ", expected ABI version is " + JvmAbi.VERSION,
CompilerMessageLocation.create(path, 0, 0));
+1 -1
View File
@@ -1,5 +1,5 @@
WARNING: $TESTDATA_DIR$/wrongAbiVersion.kt: (3, 9) Parameter 'x' is never used
ERROR: $TESTDATA_DIR$/wrongAbiVersion.kt: (4, 3) Unresolved reference: bar
ERROR: $TESTDATA_DIR$/wrongAbiVersionLib/wrong/WrongPackage.class: (0, 0) Class 'wrong.WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is 9
ERROR: $TESTDATA_DIR$/wrongAbiVersionLib/wrong/WrongPackage.class: (0, 0) Class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is 9
ERROR: $TESTDATA_DIR$/wrongAbiVersionLib/ClassWithWrongAbiVersion.class: (0, 0) Class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is 9
COMPILATION_ERROR
@@ -5,7 +5,7 @@ internal final annotation class Anno : jet.Annotation {
internal final val e: [ERROR : test.E]
}
test.Anno(e = Unresolved enum entry: test.E.ENTRY: [ERROR : Unresolved enum entry: test.E.ENTRY]) internal open class Class {
test.Anno(e = Unresolved enum entry: test/E.ENTRY: [ERROR : Unresolved enum entry: test/E.ENTRY]) internal open class Class {
public constructor Class()
}