Skip to content

Commit fe8b24b

Browse files
maskri17copybara-github
authored andcommitted
Implement strings.format in CEL string extensions.
PiperOrigin-RevId: 986928740
1 parent 35ac2a7 commit fe8b24b

10 files changed

Lines changed: 1032 additions & 46 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ java_library(
277277
],
278278
deps = [
279279
"//:auto_value",
280-
"//common/annotations",
281280
"@maven//:com_google_errorprone_error_prone_annotations",
282281
],
283282
)

‎common/src/main/java/dev/cel/common/exceptions/CelBadFormatException.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@ public CelBadFormatException(Throwable cause) {
2828
public CelBadFormatException(String errorMessage) {
2929
super(errorMessage, CelErrorCode.BAD_FORMAT);
3030
}
31+
32+
public CelBadFormatException(String errorMessage, Throwable cause) {
33+
super(errorMessage, cause, CelErrorCode.BAD_FORMAT);
34+
}
3135
}

‎common/src/main/java/dev/cel/common/exceptions/CelRuntimeException.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public abstract class CelRuntimeException extends RuntimeException {
3232
this.errorCode = errorCode;
3333
}
3434

35+
CelRuntimeException(String errorMessage, Throwable cause, CelErrorCode errorCode) {
36+
super(errorMessage, cause);
37+
this.errorCode = errorCode;
38+
}
39+
3540
public CelRuntimeException(Throwable cause, CelErrorCode errorCode) {
3641
super(cause);
3742
this.errorCode = errorCode;

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ _TESTS_TO_SKIP_LEGACY = [
120120

121121
# Skip until fixed.
122122
"fields/qualified_identifier_resolution/map_value_repeat_key_heterogeneous",
123-
# TODO: Add strings.format.quote.
124-
"string_ext/format",
125-
"string_ext/format_errors",
126123

127124
# Future features for CEL 1.0
128125
# TODO: Strong typing support for enums, specified but not implemented.
@@ -148,10 +145,6 @@ _TESTS_TO_SKIP_LEGACY = [
148145
]
149146

150147
_TESTS_TO_SKIP_PLANNER = [
151-
# TODO: Add strings.format.
152-
"string_ext/format",
153-
"string_ext/format_errors",
154-
155148
# TODO: This is actually a user experience degradation.
156149
# Not worth fixing until we see a concrete need.
157150
"basic/functions/unbound_is_runtime_error",

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,22 @@ java_library(
8787
],
8888
deps = [
8989
"//checker:checker_builder",
90-
"//common:compiler_common",
90+
"//common:cel_function_decl",
91+
"//common:cel_overload_decl",
92+
"//common/exceptions:bad_format",
93+
"//common/exceptions:invalid_argument",
9194
"//common/internal",
95+
"//common/internal:date_time_helpers",
9296
"//common/types",
97+
"//common/types:type_providers",
98+
"//common/values",
99+
"//common/values:cel_byte_string",
93100
"//compiler:compiler_builder",
94101
"//extensions:extension_library",
95102
"//runtime",
96103
"//runtime:evaluation_exception_builder",
97104
"//runtime:function_binding",
105+
"//runtime:type_resolver",
98106
"@maven//:com_google_errorprone_error_prone_annotations",
99107
"@maven//:com_google_guava_guava",
100108
],

0 commit comments

Comments
 (0)