Add an overload of `bind` that accepts a log
To support clients that want to retrieve partial bindings results
for compilations with errors.
PiperOrigin-RevId: 573027552
diff --git a/java/com/google/turbine/binder/Binder.java b/java/com/google/turbine/binder/Binder.java
index d2ce948..d5f1ed7 100644
--- a/java/com/google/turbine/binder/Binder.java
+++ b/java/com/google/turbine/binder/Binder.java
@@ -91,6 +91,19 @@
ClassPath bootclasspath,
Optional<String> moduleVersion) {
TurbineLog log = new TurbineLog();
+ BindingResult br = bind(log, units, classpath, processorInfo, bootclasspath, moduleVersion);
+ log.maybeThrow();
+ return br;
+ }
+
+ /** Binds symbols and types to the given compilation units. */
+ public static @Nullable BindingResult bind(
+ TurbineLog log,
+ ImmutableList<CompUnit> units,
+ ClassPath classpath,
+ ProcessorInfo processorInfo,
+ ClassPath bootclasspath,
+ Optional<String> moduleVersion) {
BindingResult br;
try {
br =
@@ -114,7 +127,6 @@
.addAll(turbineError.diagnostics())
.build());
}
- log.maybeThrow();
return br;
}