Minimize usages of JvmClassName.getFqName()
This commit is contained in:
@@ -86,6 +86,13 @@ public final class PsiCodegenPredictor {
|
|||||||
if (packageName == null) {
|
if (packageName == null) {
|
||||||
return 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();
|
parentInternalName = JvmClassName.byFqNameWithoutInnerClasses(packageName).getInternalName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,19 +108,12 @@ public final class PsiCodegenPredictor {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
JetNamedDeclaration namedDeclaration = (JetNamedDeclaration) declaration;
|
Name name = ((JetNamedDeclaration) declaration).getNameAsName();
|
||||||
Name name = namedDeclaration.getNameAsName();
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (declaration instanceof JetNamedFunction) {
|
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)) {
|
if (!(parentDeclaration instanceof JetClass || parentDeclaration instanceof JetObjectDeclaration)) {
|
||||||
// Can't generate predefined name for internal functions
|
// Can't generate predefined name for internal functions
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+1
-2
@@ -143,10 +143,9 @@ public final class AnalyzerWithCompilerReport {
|
|||||||
Collection<VirtualFileKotlinClass> errorClasses = bindingContext.getKeys(TraceBasedErrorReporter.ABI_VERSION_ERRORS);
|
Collection<VirtualFileKotlinClass> errorClasses = bindingContext.getKeys(TraceBasedErrorReporter.ABI_VERSION_ERRORS);
|
||||||
for (VirtualFileKotlinClass kotlinClass : errorClasses) {
|
for (VirtualFileKotlinClass kotlinClass : errorClasses) {
|
||||||
Integer abiVersion = bindingContext.get(TraceBasedErrorReporter.ABI_VERSION_ERRORS, kotlinClass);
|
Integer abiVersion = bindingContext.get(TraceBasedErrorReporter.ABI_VERSION_ERRORS, kotlinClass);
|
||||||
String fqName = kotlinClass.getClassName().getFqName().asString();
|
|
||||||
String path = toSystemDependentName(kotlinClass.getFile().getPath());
|
String path = toSystemDependentName(kotlinClass.getFile().getPath());
|
||||||
messageCollectorWrapper.report(CompilerMessageSeverity.ERROR,
|
messageCollectorWrapper.report(CompilerMessageSeverity.ERROR,
|
||||||
"Class '" + fqName +
|
"Class '" + kotlinClass.getClassName() +
|
||||||
"' was compiled with an incompatible version of Kotlin. " +
|
"' was compiled with an incompatible version of Kotlin. " +
|
||||||
"Its ABI version is " + abiVersion + ", expected ABI version is " + JvmAbi.VERSION,
|
"Its ABI version is " + abiVersion + ", expected ABI version is " + JvmAbi.VERSION,
|
||||||
CompilerMessageLocation.create(path, 0, 0));
|
CompilerMessageLocation.create(path, 0, 0));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
WARNING: $TESTDATA_DIR$/wrongAbiVersion.kt: (3, 9) Parameter 'x' is never used
|
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$/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
|
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
|
COMPILATION_ERROR
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ internal final annotation class Anno : jet.Annotation {
|
|||||||
internal final val e: [ERROR : test.E]
|
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()
|
public constructor Class()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -36,12 +36,12 @@ import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
|||||||
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
|
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationArgumentResolver;
|
import org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationArgumentResolver;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver;
|
import org.jetbrains.jet.lang.resolve.java.resolver.JavaClassResolver;
|
||||||
import org.jetbrains.jet.storage.LockBasedStorageManager;
|
|
||||||
import org.jetbrains.jet.storage.MemoizedFunctionToNotNull;
|
|
||||||
import org.jetbrains.jet.storage.StorageManager;
|
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.types.ErrorUtils;
|
import org.jetbrains.jet.lang.types.ErrorUtils;
|
||||||
|
import org.jetbrains.jet.storage.LockBasedStorageManager;
|
||||||
|
import org.jetbrains.jet.storage.MemoizedFunctionToNotNull;
|
||||||
|
import org.jetbrains.jet.storage.StorageManager;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -151,7 +151,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
|||||||
) {
|
) {
|
||||||
if (ignoreAnnotation(className)) return null;
|
if (ignoreAnnotation(className)) return null;
|
||||||
|
|
||||||
final ClassDescriptor annotationClass = resolveAnnotationClass(className);
|
final ClassDescriptor annotationClass = resolveClass(className);
|
||||||
final AnnotationDescriptor annotation = new AnnotationDescriptor();
|
final AnnotationDescriptor annotation = new AnnotationDescriptor();
|
||||||
annotation.setAnnotationType(annotationClass.getDefaultType());
|
annotation.setAnnotationType(annotationClass.getDefaultType());
|
||||||
|
|
||||||
@@ -178,8 +178,8 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private CompileTimeConstant<?> enumEntryValue(@NotNull JvmClassName enumClassName, @NotNull Name name) {
|
private CompileTimeConstant<?> enumEntryValue(@NotNull JvmClassName enumClassName, @NotNull Name name) {
|
||||||
ClassDescriptor enumClass = javaClassResolver.resolveClass(enumClassName.getFqName(), IGNORE_KOTLIN_SOURCES);
|
ClassDescriptor enumClass = resolveClass(enumClassName);
|
||||||
if (enumClass != null && enumClass.getKind() == ClassKind.ENUM_CLASS) {
|
if (enumClass.getKind() == ClassKind.ENUM_CLASS) {
|
||||||
ClassDescriptor classObject = enumClass.getClassObjectDescriptor();
|
ClassDescriptor classObject = enumClass.getClassObjectDescriptor();
|
||||||
if (classObject != null) {
|
if (classObject != null) {
|
||||||
Collection<VariableDescriptor> properties = classObject.getDefaultType().getMemberScope().getProperties(name);
|
Collection<VariableDescriptor> properties = classObject.getDefaultType().getMemberScope().getProperties(name);
|
||||||
@@ -191,7 +191,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ErrorValue.create("Unresolved enum entry: " + enumClassName.getFqName() + "." + name);
|
return ErrorValue.create("Unresolved enum entry: " + enumClassName.getInternalName() + "." + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -209,7 +209,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private ClassDescriptor resolveAnnotationClass(@NotNull JvmClassName className) {
|
private ClassDescriptor resolveClass(@NotNull JvmClassName className) {
|
||||||
ClassDescriptor annotationClass = javaClassResolver.resolveClass(className.getFqName(), IGNORE_KOTLIN_SOURCES);
|
ClassDescriptor annotationClass = javaClassResolver.resolveClass(className.getFqName(), IGNORE_KOTLIN_SOURCES);
|
||||||
return annotationClass != null ? annotationClass : ErrorUtils.getErrorClass();
|
return annotationClass != null ? annotationClass : ErrorUtils.getErrorClass();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user