Skip to content

Commit ab239c4

Browse files
l46kokcopybara-github
authored andcommitted
Remove references to deprecated type resolvers in the runtime.
PiperOrigin-RevId: 704765516
1 parent a30184b commit ab239c4

File tree

7 files changed

+1
-380
lines changed

7 files changed

+1
-380
lines changed

common/src/main/java/dev/cel/common/internal/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ java_library(
126126
"//common:proto_json_adapter",
127127
"//common:runtime_exception",
128128
"//common/annotations",
129-
"@cel_spec//proto/cel/expr:expr_java_proto",
130129
"@maven//:com_google_code_findbugs_annotations",
131130
"@maven//:com_google_errorprone_error_prone_annotations",
132131
"@maven//:com_google_guava_guava",

runtime/src/main/java/dev/cel/runtime/BUILD.bazel

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ BASE_SOURCES = [
1818
"Registrar.java",
1919
"ResolvedOverload.java",
2020
"StandardFunctions.java",
21-
"StandardTypeResolver.java",
22-
"TypeResolver.java",
2321
]
2422

2523
# keep sorted
@@ -70,8 +68,6 @@ java_library(
7068
"//common/internal:default_message_factory",
7169
"//common/internal:dynamic_proto",
7270
"//common/internal:safe_string_formatter",
73-
"//common/types",
74-
"//common/types:type_providers",
7571
"//runtime:runtime_helper",
7672
"@cel_spec//proto/cel/expr:expr_java_proto",
7773
"@maven//:com_google_code_findbugs_annotations",
@@ -111,7 +107,6 @@ java_library(
111107
"//common/types",
112108
"//common/types:cel_types",
113109
"//common/types:type_providers",
114-
"@cel_spec//proto/cel/expr:expr_java_proto",
115110
"@maven//:com_google_code_findbugs_annotations",
116111
"@maven//:com_google_errorprone_error_prone_annotations",
117112
"@maven//:com_google_guava_guava",
@@ -253,17 +248,13 @@ java_library(
253248
"//common/annotations",
254249
"//common/internal:cel_descriptor_pools",
255250
"//common/internal:dynamic_proto",
256-
"//common/types",
257-
"//common/types:type_providers",
258251
"//common/values",
259252
"//common/values:cel_value",
260253
"//common/values:cel_value_provider",
261254
"//common/values:proto_message_value",
262255
"//runtime:interpreter",
263-
"@cel_spec//proto/cel/expr:expr_java_proto",
264256
"@maven//:com_google_errorprone_error_prone_annotations",
265257
"@maven//:com_google_guava_guava",
266-
"@maven//:org_jspecify_jspecify",
267258
],
268259
)
269260

@@ -276,7 +267,6 @@ java_library(
276267
":base",
277268
":unknown_attributes",
278269
"//common/annotations",
279-
"@cel_spec//proto/cel/expr:expr_java_proto",
280270
"@maven//:com_google_errorprone_error_prone_annotations",
281271
"@maven//:org_jspecify_jspecify",
282272
],

runtime/src/main/java/dev/cel/runtime/DescriptorMessageProvider.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
package dev.cel.runtime;
1616

17-
import dev.cel.expr.Type;
18-
import dev.cel.expr.Value;
1917
import com.google.common.collect.ImmutableSet;
2018
import com.google.errorprone.annotations.Immutable;
2119
import com.google.protobuf.Descriptors.Descriptor;
@@ -31,7 +29,6 @@
3129
import dev.cel.common.internal.DynamicProto;
3230
import dev.cel.common.internal.ProtoAdapter;
3331
import dev.cel.common.internal.ProtoMessageFactory;
34-
import dev.cel.common.types.CelType;
3532
import dev.cel.common.types.CelTypes;
3633
import java.util.Map;
3734
import java.util.Optional;
@@ -50,7 +47,6 @@
5047
@Internal
5148
public final class DescriptorMessageProvider implements RuntimeTypeProvider {
5249
private final ProtoMessageFactory protoMessageFactory;
53-
private final TypeResolver typeResolver;
5450

5551
@SuppressWarnings("Immutable")
5652
private final ProtoAdapter protoAdapter;
@@ -82,33 +78,12 @@ public DescriptorMessageProvider(
8278
* when adapting from proto to CEL and vice versa.
8379
*/
8480
public DescriptorMessageProvider(ProtoMessageFactory protoMessageFactory, CelOptions celOptions) {
85-
this.typeResolver = StandardTypeResolver.getInstance(celOptions);
8681
this.protoMessageFactory = protoMessageFactory;
8782
this.protoAdapter =
8883
new ProtoAdapter(
8984
DynamicProto.create(protoMessageFactory), celOptions.enableUnsignedLongs());
9085
}
9186

92-
@Override
93-
@Nullable
94-
public Value resolveObjectType(Object obj, @Nullable Value checkedTypeValue) {
95-
return typeResolver.resolveObjectType(obj, checkedTypeValue);
96-
}
97-
98-
/** {@inheritDoc} */
99-
@Override
100-
public Value adaptType(CelType type) {
101-
return typeResolver.adaptType(type);
102-
}
103-
104-
@Nullable
105-
@Override
106-
@Deprecated
107-
/** {@inheritDoc} */
108-
public Value adaptType(@Nullable Type type) {
109-
return typeResolver.adaptType(type);
110-
}
111-
11287
@Nullable
11388
@Override
11489
public Object createMessage(String messageName, Map<String, Object> values) {

runtime/src/main/java/dev/cel/runtime/RuntimeTypeProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
*/
2626
@Immutable
2727
@Internal
28-
public interface RuntimeTypeProvider extends MessageProvider, TypeResolver {}
28+
public interface RuntimeTypeProvider extends MessageProvider {}

runtime/src/main/java/dev/cel/runtime/RuntimeTypeProviderLegacyImpl.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,21 @@
1414

1515
package dev.cel.runtime;
1616

17-
import dev.cel.expr.Type;
18-
import dev.cel.expr.Value;
1917
import com.google.common.annotations.VisibleForTesting;
20-
import com.google.common.base.Preconditions;
2118
import com.google.errorprone.annotations.Immutable;
2219
import dev.cel.common.CelErrorCode;
2320
import dev.cel.common.CelOptions;
2421
import dev.cel.common.CelRuntimeException;
2522
import dev.cel.common.annotations.Internal;
2623
import dev.cel.common.internal.CelDescriptorPool;
2724
import dev.cel.common.internal.DynamicProto;
28-
import dev.cel.common.types.CelType;
29-
import dev.cel.common.types.TypeType;
3025
import dev.cel.common.values.CelValue;
3126
import dev.cel.common.values.CelValueProvider;
3227
import dev.cel.common.values.ProtoCelValueConverter;
3328
import dev.cel.common.values.SelectableValue;
3429
import dev.cel.common.values.StringValue;
3530
import java.util.Map;
3631
import java.util.NoSuchElementException;
37-
import org.jspecify.annotations.Nullable;
3832

3933
/** Bridge between the old RuntimeTypeProvider and CelValueProvider APIs. */
4034
@Internal
@@ -43,7 +37,6 @@ public final class RuntimeTypeProviderLegacyImpl implements RuntimeTypeProvider
4337

4438
private final CelValueProvider valueProvider;
4539
private final ProtoCelValueConverter protoCelValueConverter;
46-
private final TypeResolver standardTypeResolver;
4740

4841
@VisibleForTesting
4942
public RuntimeTypeProviderLegacyImpl(
@@ -54,7 +47,6 @@ public RuntimeTypeProviderLegacyImpl(
5447
this.valueProvider = valueProvider;
5548
this.protoCelValueConverter =
5649
ProtoCelValueConverter.newInstance(celOptions, celDescriptorPool, dynamicProto);
57-
this.standardTypeResolver = StandardTypeResolver.getInstance(celOptions);
5850
}
5951

6052
@Override
@@ -115,28 +107,6 @@ public Object adapt(Object message) {
115107
return unwrapCelValue(protoCelValueConverter.fromJavaObjectToCelValue(message));
116108
}
117109

118-
@Override
119-
public Value resolveObjectType(Object obj, Value checkedTypeValue) {
120-
// Presently, Java only supports evaluation of checked-only expressions.
121-
Preconditions.checkNotNull(checkedTypeValue);
122-
return standardTypeResolver.resolveObjectType(obj, checkedTypeValue);
123-
}
124-
125-
@Override
126-
public Value adaptType(CelType type) {
127-
Preconditions.checkNotNull(type);
128-
if (type instanceof TypeType) {
129-
return createTypeValue(((TypeType) type).containingTypeName());
130-
}
131-
132-
return createTypeValue(type.name());
133-
}
134-
135-
@Override
136-
public @Nullable Value adaptType(@Nullable Type type) {
137-
throw new UnsupportedOperationException("This should only be called with native CelType.");
138-
}
139-
140110
/**
141111
* DefaultInterpreter cannot handle CelValue and instead expects plain Java objects.
142112
*
@@ -145,8 +115,4 @@ public Value adaptType(CelType type) {
145115
private Object unwrapCelValue(CelValue object) {
146116
return protoCelValueConverter.fromCelValueToJavaObject(object);
147117
}
148-
149-
private static Value createTypeValue(String name) {
150-
return Value.newBuilder().setTypeValue(name).build();
151-
}
152118
}

0 commit comments

Comments
 (0)