1919
2020import com .google .common .collect .ImmutableSet ;
2121import com .google .common .collect .Streams ;
22+ import com .google .errorprone .annotations .InlineMe ;
2223import dev .cel .common .CelOptions ;
24+ import dev .cel .extensions .CelMathExtensions .Function ;
2325import java .util .Set ;
2426
2527/**
@@ -121,21 +123,18 @@ public static CelProtoExtensions protos() {
121123 * <p>This will include all functions denoted in {@link CelMathExtensions.Function}, including any
122124 * future additions. To expose only a subset of these, use {@link #math(CelOptions,
123125 * CelMathExtensions.Function...)} or {@link #math(CelOptions,int)} instead.
124- *
125- * @param celOptions CelOptions to configure CelMathExtension with. This should be the same
126- * options object used to configure the compilation/runtime environments.
127126 */
128- public static CelMathExtensions math (CelOptions celOptions ) {
129- return CelMathExtensions .library (celOptions ).latest ();
127+ public static CelMathExtensions math () {
128+ return CelMathExtensions .library ().latest ();
130129 }
131130
132131 /**
133132 * Returns the specified version of the 'math' extension.
134133 *
135134 * <p>Refer to README.md for functions available in each version.
136135 */
137- public static CelMathExtensions math (CelOptions celOptions , int version ) {
138- return CelMathExtensions .library (celOptions ).version (version );
136+ public static CelMathExtensions math (int version ) {
137+ return CelMathExtensions .library ().version (version );
139138 }
140139
141140 /**
@@ -150,13 +149,9 @@ public static CelMathExtensions math(CelOptions celOptions, int version) {
150149 * collision.
151150 *
152151 * <p>This will include only the specific functions denoted by {@link CelMathExtensions.Function}.
153- *
154- * @param celOptions CelOptions to configure CelMathExtension with. This should be the same
155- * options object used to configure the compilation/runtime environments.
156152 */
157- public static CelMathExtensions math (
158- CelOptions celOptions , CelMathExtensions .Function ... functions ) {
159- return math (celOptions , ImmutableSet .copyOf (functions ));
153+ public static CelMathExtensions math (CelMathExtensions .Function ... functions ) {
154+ return math (ImmutableSet .copyOf (functions ));
160155 }
161156
162157 /**
@@ -171,13 +166,49 @@ public static CelMathExtensions math(
171166 * collision.
172167 *
173168 * <p>This will include only the specific functions denoted by {@link CelMathExtensions.Function}.
174- *
175- * @param celOptions CelOptions to configure CelMathExtension with. This should be the same
176- * options object used to configure the compilation/runtime environments.
177169 */
170+ public static CelMathExtensions math (Set <CelMathExtensions .Function > functions ) {
171+ return new CelMathExtensions (functions );
172+ }
173+
174+ /**
175+ * @deprecated Use {@link #math()} instead.
176+ */
177+ @ Deprecated
178+ @ InlineMe (replacement = "CelExtensions.math()" , imports = "dev.cel.extensions.CelExtensions" )
179+ public static CelMathExtensions math (CelOptions unused ) {
180+ return math ();
181+ }
182+
183+ /**
184+ * @deprecated Use {@link #math(int)} instead.
185+ */
186+ @ Deprecated
187+ @ InlineMe (
188+ replacement = "CelExtensions.math(version)" ,
189+ imports = "dev.cel.extensions.CelExtensions" )
190+ public static CelMathExtensions math (CelOptions unused , int version ) {
191+ return math (version );
192+ }
193+
194+ /**
195+ * @deprecated Use {@link #math(Function...)} instead.
196+ */
197+ @ Deprecated
198+ public static CelMathExtensions math (CelOptions unused , CelMathExtensions .Function ... functions ) {
199+ return math (ImmutableSet .copyOf (functions ));
200+ }
201+
202+ /**
203+ * @deprecated Use {@link #math(Set)} instead.
204+ */
205+ @ Deprecated
206+ @ InlineMe (
207+ replacement = "CelExtensions.math(functions)" ,
208+ imports = "dev.cel.extensions.CelExtensions" )
178209 public static CelMathExtensions math (
179- CelOptions celOptions , Set <CelMathExtensions .Function > functions ) {
180- return new CelMathExtensions ( celOptions , functions );
210+ CelOptions unused , Set <CelMathExtensions .Function > functions ) {
211+ return math ( functions );
181212 }
182213
183214 /**
@@ -354,7 +385,7 @@ public static CelExtensionLibrary<? extends CelExtensionLibrary.FeatureSet> getE
354385 case "lists" :
355386 return CelListsExtensions .library ();
356387 case "math" :
357- return CelMathExtensions .library (options );
388+ return CelMathExtensions .library ();
358389 case "optional" :
359390 return CelOptionalLibrary .library ();
360391 case "protos" :
0 commit comments