Skip to content

Commit e893d43

Browse files
l46kokcopybara-github
authored andcommitted
Internal Changes
PiperOrigin-RevId: 948498994
1 parent eaf61f7 commit e893d43

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

extensions/src/main/java/dev/cel/extensions/CelComprehensionsExtensions.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ public final class CelComprehensionsExtensions
4848
private static final String MAP_INSERT_FUNCTION = "cel.@mapInsert";
4949
private static final String MAP_INSERT_OVERLOAD_MAP_MAP = "cel_@mapInsert_map_map";
5050
private static final String MAP_INSERT_OVERLOAD_KEY_VALUE = "cel_@mapInsert_map_key_value";
51-
private static final TypeParamType TYPE_PARAM_K = TypeParamType.create("K");
52-
private static final TypeParamType TYPE_PARAM_V = TypeParamType.create("V");
53-
private static final MapType MAP_KV_TYPE = MapType.create(TYPE_PARAM_K, TYPE_PARAM_V);
51+
52+
private static final class Types {
53+
private static final TypeParamType TYPE_PARAM_K = TypeParamType.create("K");
54+
private static final TypeParamType TYPE_PARAM_V = TypeParamType.create("V");
55+
private static final MapType MAP_KV_TYPE = MapType.create(TYPE_PARAM_K, TYPE_PARAM_V);
56+
}
5457

5558
/** Enumeration of functions for Comprehensions extension. */
5659
public enum Function {
@@ -60,16 +63,16 @@ public enum Function {
6063
CelOverloadDecl.newGlobalOverload(
6164
MAP_INSERT_OVERLOAD_MAP_MAP,
6265
"Returns a map that's the result of merging given two maps.",
63-
MAP_KV_TYPE,
64-
MAP_KV_TYPE,
65-
MAP_KV_TYPE),
66+
Types.MAP_KV_TYPE,
67+
Types.MAP_KV_TYPE,
68+
Types.MAP_KV_TYPE),
6669
CelOverloadDecl.newGlobalOverload(
6770
MAP_INSERT_OVERLOAD_KEY_VALUE,
6871
"Adds the given key-value pair to the map.",
69-
MAP_KV_TYPE,
70-
MAP_KV_TYPE,
71-
TYPE_PARAM_K,
72-
TYPE_PARAM_V)));
72+
Types.MAP_KV_TYPE,
73+
Types.MAP_KV_TYPE,
74+
Types.TYPE_PARAM_K,
75+
Types.TYPE_PARAM_V)));
7376

7477
private final CelFunctionDecl functionDecl;
7578

@@ -118,7 +121,7 @@ static CelExtensionLibrary<CelComprehensionsExtensions> library() {
118121

119122
@Override
120123
public void setCheckerOptions(CelCheckerBuilder checkerBuilder) {
121-
functions.forEach(function -> checkerBuilder.addFunctionDeclarations(function.functionDecl));
124+
functions.forEach(function -> checkerBuilder.addFunctionDeclarations(function.functionDecl()));
122125
}
123126

124127
@Override

0 commit comments

Comments
 (0)