Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97d44d9

Browse files
smowtonigfoo
authored andcommitted
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.
1 parent 613d81d commit 97d44d9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

java/kotlin-extractor/src/main/java/com/semmle/extractor/java/OdasaOutput.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ private static TrapClassVersion fromSymbol(IrDeclaration sym, Logger log) {
552552
sym.getParent() instanceof IrClass ? getIrClassVirtualFile((IrClass)sym.getParent()) :
553553
null;
554554
if(vf == null)
555-
return new TrapClassVersion(0, 0, 0, null);
555+
return new TrapClassVersion(-1, 0, 0, null);
556556

557557
final int[] versionStore = new int[1];
558558

@@ -587,11 +587,11 @@ public void visit(int version, int access, java.lang.String name, java.lang.Stri
587587
}
588588
catch(IllegalAccessException e) {
589589
log.warn("Failed to read class file version information", e);
590-
return new TrapClassVersion(0, 0, 0, null);
590+
return new TrapClassVersion(-1, 0, 0, null);
591591
}
592592
catch(IOException e) {
593593
log.warn("Failed to read class file version information", e);
594-
return new TrapClassVersion(0, 0, 0, null);
594+
return new TrapClassVersion(-1, 0, 0, null);
595595
}
596596
}
597597
private boolean isValid() {

0 commit comments

Comments
 (0)