Add TargetPattern.parseConstant(@CompileTimeConstant String) for constant patterns.
This function is permitted to throw a RuntimeException to facilitate its usage in
static initializers.
PiperOrigin-RevId: 281863421
diff --git a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
index 0048197..50db0b9c 100644
--- a/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/query2/PostAnalysisQueryEnvironment.java
@@ -102,17 +102,8 @@
private static final Function<SkyKey, ConfiguredTargetKey> SKYKEY_TO_CTKEY =
skyKey -> (ConfiguredTargetKey) skyKey.argument();
- private static final ImmutableList<TargetPattern> ALL_PATTERNS;
-
- static {
- TargetPattern targetPattern;
- try {
- targetPattern = TargetPattern.defaultParser().parse("//...");
- } catch (TargetParsingException e) {
- throw new IllegalStateException(e);
- }
- ALL_PATTERNS = ImmutableList.of(targetPattern);
- }
+ private static final ImmutableList<TargetPattern> ALL_PATTERNS =
+ ImmutableList.of(TargetPattern.defaultParser().parseConstantUnchecked("//..."));
protected RecursivePackageProviderBackedTargetPatternResolver resolver;