Skip to content

Commit b564c48

Browse files
l46kokcopybara-github
authored andcommitted
Internal Changes
PiperOrigin-RevId: 858683968
1 parent 6301340 commit b564c48

File tree

8 files changed

+21
-4
lines changed

8 files changed

+21
-4
lines changed

bundle/src/main/java/dev/cel/bundle/CelFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static CelBuilder standardCelBuilder() {
4040
CelParserImpl.newBuilder(), CelCheckerLegacyImpl.newBuilder()),
4141
CelRuntimeLegacyImpl.newBuilder())
4242
.setOptions(CelOptions.current().build())
43+
// CEL-Internal-2
4344
.setStandardEnvironmentEnabled(true);
4445
}
4546

bundle/src/test/java/dev/cel/bundle/CelImplTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ public void program_setTypeFactoryOnAnyPackedMessage_fieldSelectionSuccess() thr
372372
CelAbstractSyntaxTree ast = celCompiler.compile("input.expression").getAst();
373373
CelRuntime celRuntime =
374374
CelRuntimeFactory.standardCelRuntimeBuilder()
375+
// CEL-Internal-2
375376
.setTypeFactory(
376377
(typeName) ->
377378
typeName.equals("google.type.Expr") ? com.google.type.Expr.newBuilder() : null)
@@ -401,6 +402,7 @@ public void program_setTypeFactoryOnAnyPackedMessage_messageConstructionSucceeds
401402

402403
CelRuntime celRuntime =
403404
CelRuntimeFactory.standardCelRuntimeBuilder()
405+
// CEL-Internal-2
404406
.setTypeFactory(
405407
(typeName) ->
406408
typeName.equals("google.type.Expr") ? com.google.type.Expr.newBuilder() : null)
@@ -832,6 +834,7 @@ public void program_duplicateTypeDescriptor() throws Exception {
832834
public void program_hermeticDescriptors_wellKnownProtobuf() throws Exception {
833835
Cel cel =
834836
standardCelBuilderWithMacros()
837+
// CEL-Internal-2
835838
.addMessageTypes(Timestamp.getDescriptor())
836839
.setContainer(CelContainer.ofName("google"))
837840
.setResultType(SimpleType.TIMESTAMP)
@@ -914,6 +917,7 @@ public void program_deepTypeResolutionEnabledForRuntime_success() throws Excepti
914917
CelRuntimeFactory.standardCelRuntimeBuilder()
915918
.addFileTypes(CheckedExpr.getDescriptor().getFile())
916919
.setOptions(CelOptions.current().resolveTypeDependencies(true).build())
920+
// CEL-Internal-2
917921
.build();
918922
CelRuntime.Program program = celRuntime.createProgram(ast);
919923

@@ -942,6 +946,7 @@ public void program_deepTypeResolutionDisabledForRuntime_fails() throws Exceptio
942946
CelRuntimeFactory.standardCelRuntimeBuilder()
943947
.addFileTypes(CheckedExpr.getDescriptor().getFile())
944948
.setOptions(CelOptions.current().resolveTypeDependencies(false).build())
949+
// CEL-Internal-2
945950
.build();
946951
CelRuntime.Program program = celRuntime.createProgram(ast);
947952

@@ -2154,6 +2159,7 @@ public void program_fdsContainsWktDependency_descriptorInstancesMatch() throws E
21542159
Cel cel =
21552160
standardCelBuilderWithMacros()
21562161
.addMessageTypes(descriptors)
2162+
// CEL-Internal-2
21572163
.setOptions(CelOptions.current().enableTimestampEpoch(true).build())
21582164
.setContainer(CelContainer.ofName("cel.expr.conformance.proto3"))
21592165
.build();

extensions/src/test/java/dev/cel/extensions/CelProtoExtensionsTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ public void getExt_onAnyPackedExtensionField_success() throws Exception {
295295
TestAllTypesExtensions.registerAllExtensions(extensionRegistry);
296296
Cel cel =
297297
CelFactory.standardCelBuilder()
298+
// CEL-Internal-2
298299
.addCompilerLibraries(CelExtensions.protos())
299300
.addFileTypes(TestAllTypesExtensions.getDescriptor())
300301
.setExtensionRegistry(extensionRegistry)

protobuf/src/main/java/dev/cel/protobuf/JavaFileGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.google.common.collect.ImmutableList;
2121
import com.google.common.collect.ImmutableMap;
2222
import com.google.common.io.ByteStreams;
23-
// CEL-Internal-5
23+
// CEL-Internal-3
2424
import freemarker.template.Configuration;
2525
import freemarker.template.DefaultObjectWrapperBuilder;
2626
import freemarker.template.Template;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public final class CelRuntimeFactory {
2828
public static CelRuntimeBuilder standardCelRuntimeBuilder() {
2929
return CelRuntimeLegacyImpl.newBuilder()
3030
.setOptions(CelOptions.current().build())
31+
// CEL-Internal-2
3132
.setStandardEnvironmentEnabled(true);
3233
}
3334

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import dev.cel.common.internal.DefaultDescriptorPool;
3939
import dev.cel.common.internal.DefaultMessageFactory;
4040
import dev.cel.common.internal.DynamicProto;
41-
// CEL-Internal-3
41+
// CEL-Internal-1
4242
import dev.cel.common.internal.ProtoMessageFactory;
4343
import dev.cel.common.types.CelTypes;
4444
import dev.cel.common.values.CelValueProvider;
@@ -97,6 +97,7 @@ public CelRuntimeBuilder toRuntimeBuilder() {
9797
CelRuntimeBuilder builder =
9898
new Builder()
9999
.setOptions(options)
100+
// CEL-Internal-2
100101
.setStandardEnvironmentEnabled(standardEnvironmentEnabled)
101102
.setExtensionRegistry(extensionRegistry)
102103
.addFileTypes(fileDescriptors)
@@ -366,7 +367,8 @@ private ImmutableSet<CelFunctionBinding> newStandardFunctionBindings(
366367
break;
367368
default:
368369
if (!options.enableHeterogeneousNumericComparisons()) {
369-
return !CelStandardFunctions.isHeterogeneousComparison(standardOverload);
370+
return !CelStandardFunctions.isHeterogeneousComparison(
371+
standardOverload);
370372
}
371373
break;
372374
}

runtime/src/test/java/dev/cel/runtime/CelRuntimeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public void newWellKnownTypeMessage_withDifferentDescriptorInstance() throws Exc
171171
.build();
172172
CelRuntime celRuntime =
173173
CelRuntimeFactory.standardCelRuntimeBuilder()
174+
// CEL-Internal-2
174175
.addFileTypes(
175176
FileDescriptorSet.newBuilder()
176177
.addFile(
@@ -192,6 +193,7 @@ public void newWellKnownTypeMessage_inDynamicMessage_withSetTypeFactory() throws
192193
.build();
193194
CelRuntime celRuntime =
194195
CelRuntimeFactory.standardCelRuntimeBuilder()
196+
// CEL-Internal-2
195197
.setTypeFactory(
196198
(typeName) ->
197199
typeName.equals("google.protobuf.BoolValue")
@@ -218,6 +220,8 @@ public void newWellKnownTypeMessage_inAnyMessage_withDifferentDescriptorInstance
218220
CelCompilerFactory.standardCelCompilerBuilder().addFileTypes(fds).build();
219221
CelRuntime celRuntime =
220222
CelRuntimeFactory.standardCelRuntimeBuilder()
223+
// CEL-Internal-2
224+
.addFileTypes(fds)
221225
.build();
222226

223227
CelAbstractSyntaxTree ast =
@@ -241,6 +245,8 @@ public void newWellKnownTypeMessage_inAnyMessage_withSetTypeFactory() throws Exc
241245
CelCompilerFactory.standardCelCompilerBuilder().addFileTypes(fds).build();
242246
CelRuntime celRuntime =
243247
CelRuntimeFactory.standardCelRuntimeBuilder()
248+
// CEL-Internal-2
249+
.addFileTypes(fds)
244250
.setTypeFactory(
245251
(typeName) ->
246252
typeName.equals("google.protobuf.Any")

runtime/src/test/java/dev/cel/runtime/DescriptorMessageProviderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import dev.cel.common.internal.CelDescriptorPool;
3636
import dev.cel.common.internal.DefaultDescriptorPool;
3737
import dev.cel.common.internal.DefaultMessageFactory;
38-
// CEL-Internal-3
38+
// CEL-Internal-1
3939
import dev.cel.common.internal.ProtoMessageFactory;
4040
import dev.cel.common.internal.WellKnownProto;
4141
import dev.cel.expr.conformance.proto2.TestAllTypes;

0 commit comments

Comments
 (0)