diff --git a/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java b/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java index 6aaee69142d..a2089bbe908 100644 --- a/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java +++ b/compiler/cli/src/org/jetbrains/jet/cli/common/messages/AnalyzerWithCompilerReport.java @@ -37,6 +37,7 @@ import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.java.JavaBindingContext; import org.jetbrains.jet.lang.resolve.java.JvmAbi; import org.jetbrains.jet.lang.resolve.java.resolver.TraceBasedErrorReporter; +import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileKotlinClass; import java.util.Collection; import java.util.List; @@ -139,15 +140,16 @@ public final class AnalyzerWithCompilerReport { assert analyzeExhaust != null; BindingContext bindingContext = analyzeExhaust.getBindingContext(); - Collection errorLocations = - bindingContext.getKeys(TraceBasedErrorReporter.ABI_VERSION_ERRORS); - for (TraceBasedErrorReporter.AbiVersionErrorLocation abiVersionErrorLocation : errorLocations) { - Integer abiVersion = bindingContext.get(TraceBasedErrorReporter.ABI_VERSION_ERRORS, abiVersionErrorLocation); + Collection 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 '" + abiVersionErrorLocation.getClassFqName().asString() + + "Class '" + fqName + "' was compiled with an incompatible version of Kotlin. " + "Its ABI version is " + abiVersion + ", expected ABI version is " + JvmAbi.VERSION, - CompilerMessageLocation.create(toSystemDependentName(abiVersionErrorLocation.getPath()), 0, 0)); + CompilerMessageLocation.create(path, 0, 0)); } } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedErrorReporter.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedErrorReporter.java index 8980dcaed83..493efb7b848 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedErrorReporter.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/resolver/TraceBasedErrorReporter.java @@ -16,14 +16,14 @@ package org.jetbrains.jet.lang.resolve.java.resolver; -import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor; import org.jetbrains.jet.lang.psi.JetDeclaration; import org.jetbrains.jet.lang.resolve.BindingContextUtils; import org.jetbrains.jet.lang.resolve.BindingTrace; -import org.jetbrains.jet.lang.resolve.name.FqName; +import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass; +import org.jetbrains.jet.lang.resolve.kotlin.VirtualFileKotlinClass; import org.jetbrains.jet.util.slicedmap.BasicWritableSlice; import org.jetbrains.jet.util.slicedmap.Slices; import org.jetbrains.jet.util.slicedmap.WritableSlice; @@ -33,8 +33,8 @@ import javax.inject.Inject; import static org.jetbrains.jet.lang.diagnostics.Errors.CANNOT_INFER_VISIBILITY; public class TraceBasedErrorReporter implements ErrorReporter { - public static final WritableSlice ABI_VERSION_ERRORS = - new BasicWritableSlice(Slices.ONLY_REWRITE_TO_EQUAL, true); + public static final WritableSlice ABI_VERSION_ERRORS = + new BasicWritableSlice(Slices.ONLY_REWRITE_TO_EQUAL, true); private BindingTrace trace; @Inject @@ -43,8 +43,8 @@ public class TraceBasedErrorReporter implements ErrorReporter { } @Override - public void reportIncompatibleAbiVersion(@NotNull FqName fqName, @NotNull VirtualFile file, int actualVersion) { - trace.record(ABI_VERSION_ERRORS, new AbiVersionErrorLocation(fqName, file), actualVersion); + public void reportIncompatibleAbiVersion(@NotNull KotlinJvmBinaryClass kotlinClass, int actualVersion) { + trace.record(ABI_VERSION_ERRORS, (VirtualFileKotlinClass) kotlinClass, actualVersion); } @Override @@ -54,26 +54,4 @@ public class TraceBasedErrorReporter implements ErrorReporter { trace.report(CANNOT_INFER_VISIBILITY.on((JetDeclaration) element)); } } - - public static final class AbiVersionErrorLocation { - @NotNull - private final FqName classFqName; - @NotNull - private final VirtualFile file; - - public AbiVersionErrorLocation(@NotNull FqName name, @NotNull VirtualFile file) { - this.classFqName = name; - this.file = file; - } - - @NotNull - public FqName getClassFqName() { - return classFqName; - } - - @NotNull - public String getPath() { - return file.getPath(); - } - } } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/kotlin/VirtualFileKotlinClass.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/kotlin/VirtualFileKotlinClass.java index 64f3d6499c5..2027f47f8ed 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/kotlin/VirtualFileKotlinClass.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/kotlin/VirtualFileKotlinClass.java @@ -41,7 +41,6 @@ public class VirtualFileKotlinClass implements KotlinJvmBinaryClass { } @NotNull - @Override public VirtualFile getFile() { return file; } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/ErrorReporter.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/ErrorReporter.java index 9299cf7315a..568198662be 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/ErrorReporter.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/resolver/ErrorReporter.java @@ -16,13 +16,12 @@ package org.jetbrains.jet.lang.resolve.java.resolver; -import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.CallableMemberDescriptor; -import org.jetbrains.jet.lang.resolve.name.FqName; +import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass; public interface ErrorReporter { - void reportIncompatibleAbiVersion(@NotNull FqName fqName, @NotNull VirtualFile file, int actualVersion); + void reportIncompatibleAbiVersion(@NotNull KotlinJvmBinaryClass kotlinClass, int actualVersion); void reportCannotInferVisibility(@NotNull CallableMemberDescriptor descriptor); } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java index a3fa87a5b1e..a62cb0c93b4 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java @@ -116,7 +116,7 @@ public final class DeserializedDescriptorResolver { } if (header != null) { - errorReporter.reportIncompatibleAbiVersion(kotlinClass.getClassName().getFqName(), kotlinClass.getFile(), header.getVersion()); + errorReporter.reportIncompatibleAbiVersion(kotlinClass, header.getVersion()); } return null; diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/KotlinJvmBinaryClass.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/KotlinJvmBinaryClass.java index 50ec310c9e3..ed79bd4aa8c 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/KotlinJvmBinaryClass.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/KotlinJvmBinaryClass.java @@ -16,16 +16,12 @@ package org.jetbrains.jet.lang.resolve.kotlin; -import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.lang.resolve.java.JvmClassName; import org.jetbrains.jet.lang.resolve.name.Name; public interface KotlinJvmBinaryClass { - @NotNull - VirtualFile getFile(); - @NotNull JvmClassName getClassName();