Skip to content

Commit 409997f

Browse files
l46kokcopybara-github
authored andcommitted
Remove unused code and legacy type provider across CEL-Java
PiperOrigin-RevId: 1000252391
1 parent 91bb3fb commit 409997f

20 files changed

Lines changed: 0 additions & 691 deletions

File tree

‎checker/BUILD.bazel‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ java_library(
2727
exports = ["//checker/src/main/java/dev/cel/checker:type_provider_legacy"],
2828
)
2929

30-
java_library(
31-
name = "type_provider_legacy_impl",
32-
visibility = ["//:internal"],
33-
exports = ["//checker/src/main/java/dev/cel/checker:type_provider_legacy_impl"],
34-
)
35-
3630
java_library(
3731
name = "checker_legacy_environment",
3832
deprecation = "See go/cel-java-migration-guide. Please use CEL-Java Fluent APIs //compiler instead",

‎checker/src/main/java/dev/cel/checker/BUILD.bazel‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,6 @@ java_library(
129129
],
130130
)
131131

132-
java_library(
133-
name = "type_provider_legacy_impl",
134-
srcs = ["TypeProviderLegacyImpl.java"],
135-
tags = [
136-
],
137-
deps = [
138-
":type_provider_legacy",
139-
"//common/annotations",
140-
"//common/types",
141-
"//common/types:cel_proto_types",
142-
"//common/types:type_providers",
143-
"@cel_spec//proto/cel/expr:checked_java_proto",
144-
"@maven//:com_google_errorprone_error_prone_annotations",
145-
"@maven//:com_google_guava_guava",
146-
"@maven//:org_jspecify_jspecify",
147-
],
148-
)
149-
150132
java_library(
151133
name = "checker_legacy_environment",
152134
srcs = CHECKER_LEGACY_ENV_SOURCES,

‎checker/src/main/java/dev/cel/checker/CelStandardDeclarations.java‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
package dev.cel.checker;
1616

1717
import static com.google.common.base.Preconditions.checkNotNull;
18-
import static com.google.common.collect.ImmutableMap.toImmutableMap;
1918
import static com.google.common.collect.ImmutableSet.toImmutableSet;
2019
import static java.util.Arrays.stream;
2120

22-
import com.google.common.collect.ImmutableMap;
2321
import com.google.common.collect.ImmutableSet;
2422
import com.google.errorprone.annotations.CanIgnoreReturnValue;
2523
import com.google.errorprone.annotations.Immutable;
@@ -34,7 +32,6 @@
3432
import dev.cel.common.types.SimpleType;
3533
import dev.cel.common.types.TypeParamType;
3634
import dev.cel.common.types.TypeType;
37-
import java.util.Optional;
3835

3936
/**
4037
* Standard declarations for CEL.
@@ -606,13 +603,6 @@ public enum Size implements StandardOverload {
606603
CelOverloadDecl.newMemberOverload("map_size", "map size", SimpleType.INT, MAP_OF_AB)),
607604
;
608605

609-
private static final ImmutableMap<String, Size> ID_TO_ENUM =
610-
stream(values()).collect(toImmutableMap(e -> e.celOverloadDecl().overloadId(), e -> e));
611-
612-
public static Optional<Size> fromOverloadId(String overloadId) {
613-
return Optional.ofNullable(ID_TO_ENUM.get(overloadId));
614-
}
615-
616606
private final CelOverloadDecl celOverloadDecl;
617607

618608
Size(CelOverloadDecl overloadDecl) {
@@ -1489,16 +1479,6 @@ public boolean isHeterogeneousComparison() {
14891479
public CelOverloadDecl celOverloadDecl() {
14901480
return this.celOverloadDecl;
14911481
}
1492-
1493-
/** Finds a Comparison by its overload ID. */
1494-
public static Optional<Comparison> fromOverloadId(String overloadId) {
1495-
for (Comparison c : values()) {
1496-
if (c.celOverloadDecl().overloadId().equals(overloadId)) {
1497-
return Optional.of(c);
1498-
}
1499-
}
1500-
return Optional.empty();
1501-
}
15021482
}
15031483

15041484
private Overload() {}
@@ -1518,10 +1498,6 @@ public String functionName() {
15181498
return functionName;
15191499
}
15201500

1521-
boolean isDeprecated() {
1522-
return isDeprecated;
1523-
}
1524-
15251501
StandardFunction(Operator operator, StandardOverload... overloads) {
15261502
this(false, operator.getFunction(), overloads);
15271503
}

‎checker/src/main/java/dev/cel/checker/TypeProviderLegacyImpl.java‎

Lines changed: 0 additions & 121 deletions
This file was deleted.

‎checker/src/test/java/dev/cel/checker/BUILD.bazel‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ java_library(
2020
"//checker:proto_type_mask",
2121
"//checker:standard_decl",
2222
"//checker:type_inferencer",
23-
"//checker:type_provider_legacy_impl",
2423
"//common:cel_ast",
2524
"//common:cel_function_decl",
2625
"//common:cel_issue",

‎checker/src/test/java/dev/cel/checker/TypeProviderLegacyImplTest.java‎

Lines changed: 0 additions & 133 deletions
This file was deleted.

‎common/src/main/java/dev/cel/common/CelAbstractSyntaxTree.java‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
package dev.cel.common;
1616

1717
import com.google.auto.value.AutoValue;
18-
import com.google.common.collect.ImmutableList;
1918
import com.google.common.collect.ImmutableMap;
2019
import com.google.errorprone.annotations.Immutable;
2120
import dev.cel.common.annotations.Internal;
22-
import dev.cel.common.ast.CelConstant;
2321
import dev.cel.common.ast.CelExpr;
2422
import dev.cel.common.ast.CelReference;
2523
import dev.cel.common.types.CelType;
@@ -124,16 +122,4 @@ public CelReference getReferenceOrThrow(long exprId) {
124122
return getReference(exprId)
125123
.orElseThrow(() -> new NoSuchElementException("Expr Id not found: " + exprId));
126124
}
127-
128-
Optional<CelConstant> findEnumValue(long exprId) {
129-
CelReference ref = references().get(exprId);
130-
return ref != null ? ref.value() : Optional.empty();
131-
}
132-
133-
Optional<ImmutableList<String>> findOverloadIDs(long exprId) {
134-
CelReference ref = references().get(exprId);
135-
return ref != null && !ref.value().isPresent()
136-
? Optional.of(ref.overloadIds())
137-
: Optional.empty();
138-
}
139125
}

0 commit comments

Comments
 (0)