Skip to content

Commit 4c8f2e6

Browse files
committed
Prioritize Maven packages over the JDK when exporting monikers
Previously, when a Maven package re-defined a class from the JDK then lsif-java would emit an export against the JDK instead of the Maven package. This caused problems with navigation to the JDK on Sourcegraph because there were multiple repositories that exported monikers against the `jdk/8` packageInformation node. Now, only the JDK repo should export monikers for the JDK repo.
1 parent ba89c92 commit 4c8f2e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lsif-semanticdb/src/main/java/com/sourcegraph/lsif_semanticdb/PackageTable.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@ public class PackageTable implements Function<Package, Integer> {
3636
public PackageTable(LsifSemanticdbOptions options, LsifWriter writer) throws IOException {
3737
this.writer = writer;
3838
this.javaVersion = new JavaVersion();
39+
// NOTE: it's important that we index the JDK before maven packages. Some maven packages
40+
// redefine classes from the JDK and we want those maven packages to take precedence over
41+
// the JDK. The motivation to prioritize maven packages over the JDK is that we only want
42+
// to exports monikers against the JDK when indexing the JDK repo.
43+
indexJdk();
3944
for (MavenPackage pkg : options.packages) {
4045
indexPackage(pkg);
4146
}
42-
indexJdk();
4347
}
4448

4549
public void writeImportedSymbol(String symbol, int monikerId) {

0 commit comments

Comments
 (0)