3838import dev .cel .common .ast .CelConstant ;
3939import dev .cel .common .ast .CelExpr ;
4040import dev .cel .common .ast .CelExprConverter ;
41+ import dev .cel .common .ast .CelMutableExpr ;
4142import dev .cel .common .ast .CelReference ;
4243import dev .cel .common .internal .Errors ;
4344import dev .cel .common .types .CelKind ;
@@ -288,28 +289,31 @@ public Map<Long, CelType> getTypeMap() {
288289 * Returns the type associated with an expression by expression id. It's an error to call this
289290 * method if the type is not present.
290291 *
291- * @deprecated Use {@link #getType(CelExpr)} instead .
292+ * @deprecated Do not use. Migrate to CEL-Java fluent APIs .
292293 */
293294 @ Deprecated
294295 public Type getType (Expr expr ) {
295296 Preconditions .checkNotNull (expr );
296- return CelProtoTypes .celTypeToType (getType (CelExprConverter .fromExpr (expr )));
297+ CelExpr celExpr = CelExprConverter .fromExpr (expr );
298+ CelType celType =
299+ Preconditions .checkNotNull (typeMap .get (celExpr .id ()), "expression has no type" );
300+ return CelProtoTypes .celTypeToType (celType );
297301 }
298302
299303 /**
300- * Returns the type associated with an expression by expression id. It's an error to call this
301- * method if the type is not present.
304+ * Returns the type associated with a mutable expression by expression id. It's an error to call
305+ * this method if the type is not present.
302306 */
303- public CelType getType (CelExpr expr ) {
307+ CelType getType (CelMutableExpr expr ) {
304308 return Preconditions .checkNotNull (typeMap .get (expr .id ()), "expression has no type" );
305309 }
306310
307311 /**
308- * Sets the type associated with an expression by id. It's an error if the type is already set and
309- * is different than the provided one. Returns the expression parameter.
312+ * Sets the type associated with a mutable expression by id. It's an error if the type is already
313+ * set and is different than the provided one. Returns the expression parameter.
310314 */
311315 @ CanIgnoreReturnValue
312- public CelExpr setType (CelExpr expr , CelType type ) {
316+ CelMutableExpr setType (CelMutableExpr expr , CelType type ) {
313317 CelType oldType = typeMap .put (expr .id (), type );
314318 Preconditions .checkState (
315319 oldType == null || oldType .equals (type ),
@@ -320,10 +324,10 @@ public CelExpr setType(CelExpr expr, CelType type) {
320324 }
321325
322326 /**
323- * Sets the reference associated with an expression. It's an error if the reference is already set
324- * and is different.
327+ * Sets the reference associated with a mutable expression. It's an error if the reference is
328+ * already set and is different.
325329 */
326- public void setRef (CelExpr expr , CelReference reference ) {
330+ void setRef (CelMutableExpr expr , CelReference reference ) {
327331 CelReference oldReference = referenceMap .put (expr .id (), reference );
328332 Preconditions .checkState (
329333 oldReference == null || oldReference .equals (reference ),
0 commit comments