Add a conversionContext parameter to option converters
We need to pass flag values through the repo mapping of the main repo, which means that at flag parsing time, we need access to the main repo mapping. To that end, we add a nullable untyped `conversionContext` parameter to the `Converter#convert` method, which is unused in this CL but will be used in a follow-up.
Note that we can't directly add a `RepositoryMapping` parameter because the c.g.devtools.common.options package is a transitive dependency of c.g.devtools.build.lib.cmdline (which RepositoryMapping lives in). So this `conversionContext` will unfortunately need to be an Object.
Reviewers: Please focus on reviewing changes in the c.g.devtools.common.options package. All the other changes in this CL are simply adding a `conversionContext` parameter to implementors of `Converter`, or passing this parameter to delegates, or superclasses.
Work towards https://github.com/bazelbuild/bazel/issues/14852
PiperOrigin-RevId: 459278433
Change-Id: I98b3842305c34d2d0c33e7411c1024897fb0170a
diff --git a/src/test/java/com/google/devtools/common/options/OptionsTest.java b/src/test/java/com/google/devtools/common/options/OptionsTest.java
index 6a0e586..b037507 100644
--- a/src/test/java/com/google/devtools/common/options/OptionsTest.java
+++ b/src/test/java/com/google/devtools/common/options/OptionsTest.java
@@ -375,7 +375,7 @@
" --none\n" + " An expanded option.\n" + " Expands to: --host=www.google.com");
}
- public static class MyURLConverter implements Converter<URL> {
+ public static class MyURLConverter extends Converter.Contextless<URL> {
@Override
public URL convert(String input) throws OptionsParsingException {