diff --git a/semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbTaskListener.java b/semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbTaskListener.java index 46ad5eab..02fe4164 100644 --- a/semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbTaskListener.java +++ b/semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbTaskListener.java @@ -50,6 +50,7 @@ public void started(TaskEvent e) { // we remove the semanticdb file for this source file to ensure // stale data doesn't cause problems if (e.getKind() == TaskEvent.Kind.ENTER) { + inferBazelSourceroot(e.getSourceFile()); Result semanticdbPath = semanticdbOutputPath(options, e); if (semanticdbPath.isOk()) { try { @@ -283,8 +284,6 @@ private void inferBazelSourceroot(JavaFileObject file) { private Result semanticdbOutputPath(SemanticdbJavacOptions options, TaskEvent e) { Path absolutePath = absolutePathFromUri(options, e.getSourceFile()); - if (absolutePath == null) - return Result.error("Failed to produce absolute path for " + e.getSourceFile()); if (absolutePath.startsWith(options.sourceroot)) { Path relativePath = options.sourceroot.relativize(absolutePath); String filename = relativePath.getFileName().toString() + ".semanticdb";