Ensure external class extractions without a VirtualFile are lowest priority

Previously by using major version 0 to represent the no-virtual-file case these got highest priority. This meant that a class extracted relating to a .java file seen by the Kotlin compiler, which necessarily lacks a useful source-location, was highest priority. Now that should get overwritten whenever anybody sees it in the form of a .class
file, since this will have version information.

This should in particular eliminate the case where a generic class is extracted with no useful source location (based on .java source), then generic instances are extracted with a useful source location (based on a .class source), but the location isn't in the database.
This commit is contained in:
Chris Smowton
2022-03-23 15:11:29 +00:00
committed by Ian Lynagh
parent 613d81d231
commit 97d44d9583

View File

@@ -552,7 +552,7 @@ public class OdasaOutput {
sym.getParent() instanceof IrClass ? getIrClassVirtualFile((IrClass)sym.getParent()) :
null;
if(vf == null)
return new TrapClassVersion(0, 0, 0, null);
return new TrapClassVersion(-1, 0, 0, null);
final int[] versionStore = new int[1];
@@ -587,11 +587,11 @@ public class OdasaOutput {
}
catch(IllegalAccessException e) {
log.warn("Failed to read class file version information", e);
return new TrapClassVersion(0, 0, 0, null);
return new TrapClassVersion(-1, 0, 0, null);
}
catch(IOException e) {
log.warn("Failed to read class file version information", e);
return new TrapClassVersion(0, 0, 0, null);
return new TrapClassVersion(-1, 0, 0, null);
}
}
private boolean isValid() {