From c30f417656d15400573452888b0ad783623c4bb3 Mon Sep 17 00:00:00 2001 From: Sokwhan Huh Date: Mon, 6 May 2024 15:11:09 -0700 Subject: [PATCH] Remove deprecated create methods PiperOrigin-RevId: 631198940 --- .../main/java/dev/cel/common/ast/CelExpr.java | 67 ++----------------- .../dev/cel/common/ast/CelExprConverter.java | 4 +- .../common/ast/CelExprV1Alpha1Converter.java | 4 +- 3 files changed, 10 insertions(+), 65 deletions(-) diff --git a/common/src/main/java/dev/cel/common/ast/CelExpr.java b/common/src/main/java/dev/cel/common/ast/CelExpr.java index 0868daa1..9960ae39 100644 --- a/common/src/main/java/dev/cel/common/ast/CelExpr.java +++ b/common/src/main/java/dev/cel/common/ast/CelExpr.java @@ -23,7 +23,6 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.CheckReturnValue; import com.google.errorprone.annotations.Immutable; -import com.google.errorprone.annotations.InlineMe; import dev.cel.common.ast.CelExpr.ExprKind.Kind; import java.util.ArrayList; import java.util.Arrays; @@ -90,15 +89,6 @@ public CelCall call() { return exprKind().call(); } - /** - * @deprecated Use {@link #list()} instead. - */ - @Deprecated - @InlineMe(replacement = "this.list()") - public final CelList createList() { - return list(); - } - /** * {@inheritDoc} * @@ -106,16 +96,7 @@ public final CelList createList() { */ @Override public CelList list() { - return exprKind().createList(); - } - - /** - * @deprecated Use {@link #list()} instead. - */ - @Deprecated - @InlineMe(replacement = "this.struct()") - public final CelStruct createStruct() { - return struct(); + return exprKind().list(); } /** @@ -125,16 +106,7 @@ public final CelStruct createStruct() { */ @Override public CelStruct struct() { - return exprKind().createStruct(); - } - - /** - * @deprecated Use {@link #list()} instead. - */ - @Deprecated - @InlineMe(replacement = "this.map()") - public final CelMap createMap() { - return map(); + return exprKind().struct(); } /** @@ -144,7 +116,7 @@ public final CelMap createMap() { */ @Override public CelMap map() { - return exprKind().createMap(); + return exprKind().map(); } /** @@ -203,7 +175,7 @@ public CelCall callOrDefault() { */ public CelList listOrDefault() { return exprKind().getKind().equals(ExprKind.Kind.LIST) - ? exprKind().createList() + ? exprKind().list() : CelList.newBuilder().build(); } @@ -213,7 +185,7 @@ public CelList listOrDefault() { */ public CelStruct structOrDefault() { return exprKind().getKind().equals(ExprKind.Kind.STRUCT) - ? exprKind().createStruct() + ? exprKind().struct() : CelStruct.newBuilder().build(); } @@ -223,7 +195,7 @@ public CelStruct structOrDefault() { */ public CelMap mapOrDefault() { return exprKind().getKind().equals(ExprKind.Kind.MAP) - ? exprKind().createMap() + ? exprKind().map() : CelMap.newBuilder().build(); } @@ -405,37 +377,10 @@ public enum Kind { public abstract CelList list(); - /** - * @deprecated Use {@link #list()} instead. - */ - @Deprecated - @InlineMe(replacement = "this.list()") - public final CelList createList() { - return list(); - } - public abstract CelStruct struct(); - /** - * @deprecated Use {@link #struct()} instead. - */ - @Deprecated - @InlineMe(replacement = "this.struct()") - public final CelStruct createStruct() { - return struct(); - } - public abstract CelMap map(); - /** - * @deprecated Use {@link #map()} instead. - */ - @Deprecated - @InlineMe(replacement = "this.map()") - public final CelMap createMap() { - return map(); - } - public abstract CelComprehension comprehension(); } diff --git a/common/src/main/java/dev/cel/common/ast/CelExprConverter.java b/common/src/main/java/dev/cel/common/ast/CelExprConverter.java index 994ea321..bb36575f 100644 --- a/common/src/main/java/dev/cel/common/ast/CelExprConverter.java +++ b/common/src/main/java/dev/cel/common/ast/CelExprConverter.java @@ -76,9 +76,9 @@ public static Expr fromCelExpr(CelExpr celExpr) { .addAllOptionalIndices(celCreateList.optionalIndices())) .build(); case STRUCT: - return expr.setStructExpr(celStructToExprStruct(celExprKind.createStruct())).build(); + return expr.setStructExpr(celStructToExprStruct(celExprKind.struct())).build(); case MAP: - return expr.setStructExpr(celMapToExprStruct(celExprKind.createMap())).build(); + return expr.setStructExpr(celMapToExprStruct(celExprKind.map())).build(); case COMPREHENSION: CelExpr.CelComprehension celComprehension = celExprKind.comprehension(); return expr.setComprehensionExpr( diff --git a/common/src/main/java/dev/cel/common/ast/CelExprV1Alpha1Converter.java b/common/src/main/java/dev/cel/common/ast/CelExprV1Alpha1Converter.java index 794d78f8..85a9ae66 100644 --- a/common/src/main/java/dev/cel/common/ast/CelExprV1Alpha1Converter.java +++ b/common/src/main/java/dev/cel/common/ast/CelExprV1Alpha1Converter.java @@ -76,9 +76,9 @@ public static Expr fromCelExpr(CelExpr celExpr) { .addAllOptionalIndices(celCreateList.optionalIndices())) .build(); case STRUCT: - return expr.setStructExpr(celStructToExprStruct(celExprKind.createStruct())).build(); + return expr.setStructExpr(celStructToExprStruct(celExprKind.struct())).build(); case MAP: - return expr.setStructExpr(celMapToExprStruct(celExprKind.createMap())).build(); + return expr.setStructExpr(celMapToExprStruct(celExprKind.map())).build(); case COMPREHENSION: CelExpr.CelComprehension celComprehension = celExprKind.comprehension(); return expr.setComprehensionExpr(