Minor, move ABI version error reporting
AbiVersionUtil will be used in descriptors.loader.java, so it cannot depend on BindingTrace
This commit is contained in:
@@ -16,46 +16,13 @@
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.java;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.ErrorReporter;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.util.slicedmap.BasicWritableSlice;
|
||||
import org.jetbrains.jet.util.slicedmap.Slices;
|
||||
import org.jetbrains.jet.util.slicedmap.WritableSlice;
|
||||
|
||||
public final class AbiVersionUtil {
|
||||
public static final WritableSlice<AbiVersionErrorLocation, Integer> ABI_VERSION_ERRORS =
|
||||
new BasicWritableSlice<AbiVersionErrorLocation, Integer>(Slices.ONLY_REWRITE_TO_EQUAL, true);
|
||||
public static final int INVALID_VERSION = -1;
|
||||
|
||||
public static boolean isAbiVersionCompatible(int abiVersion) {
|
||||
return abiVersion == JvmAbi.VERSION;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private AbiVersionUtil() {
|
||||
}
|
||||
}
|
||||
|
||||
+28
-2
@@ -19,12 +19,16 @@ package org.jetbrains.jet.lang.resolve.java.resolver;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.java.AbiVersionUtil;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.util.slicedmap.BasicWritableSlice;
|
||||
import org.jetbrains.jet.util.slicedmap.Slices;
|
||||
import org.jetbrains.jet.util.slicedmap.WritableSlice;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class TraceBasedErrorReporter implements ErrorReporter {
|
||||
public static final WritableSlice<AbiVersionErrorLocation, Integer> ABI_VERSION_ERRORS =
|
||||
new BasicWritableSlice<AbiVersionErrorLocation, Integer>(Slices.ONLY_REWRITE_TO_EQUAL, true);
|
||||
private BindingTrace trace;
|
||||
|
||||
@Inject
|
||||
@@ -34,6 +38,28 @@ public class TraceBasedErrorReporter implements ErrorReporter {
|
||||
|
||||
@Override
|
||||
public void reportIncompatibleAbiVersion(@NotNull FqName fqName, @NotNull VirtualFile file, int actualVersion) {
|
||||
trace.record(AbiVersionUtil.ABI_VERSION_ERRORS, new AbiVersionUtil.AbiVersionErrorLocation(fqName, file), actualVersion);
|
||||
trace.record(ABI_VERSION_ERRORS, new AbiVersionErrorLocation(fqName, file), actualVersion);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user