Skip to content

Commit d4bbe72

Browse files
authored
Bazel: fallback to default absolute path logic (#620)
* Remove unnecessary throw for unexpected exception * Bazel: fallback to default absolute path logic Previously, we failed compilation when failing to infer the absolute path of a file that was being compiled by Bazel. This commit changes the behavior to fallback to the default behavior, which uses the standard `JavaFileObject.toUri()` API. The goal of this change is to fix an issue that happened when using errorprone together with semanticdb-javac, and errorprone triggers compilation with custom compilation unit here https://sourcegraph.com/github.com/google/error-prone@77ba705df2c213eddd5652622336f4a8fef3c387/-/blob/check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java
1 parent 56529d6 commit d4bbe72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbTaskListener.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ public static Path absolutePathFromUri(SemanticdbJavacOptions options, JavaFileO
146146
return options.sourceroot.resolve(path);
147147
}
148148
}
149-
throw new IllegalArgumentException("unsupported source file: " + toString);
150-
} else {
151-
return Paths.get(uri);
149+
// Fallback to default behavior.
152150
}
151+
152+
return Paths.get(uri);
153153
}
154154

155155
// Infers the `-sourceroot:` flag from the provided file.

0 commit comments

Comments
 (0)