From f9b81a00d95e7005f911ce03c1ec0ced696ad35c Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Thu, 24 Jul 2025 15:52:25 -0700 Subject: [PATCH] Refactor CelExtensionLibrary to centralize version definitions. This allows to have a better support when the extension library has multiple versions. Now the knowledge of all supported extension versions and which version is the latest is encapsulated inside the corresponding Cel*Extension class. PiperOrigin-RevId: 786864243 --- .../cel/bundle/CelEnvironmentExporter.java | 81 +++++++---- .../main/java/dev/cel/extensions/BUILD.bazel | 1 + .../cel/extensions/CelExtensionLibrary.java | 43 ++++-- .../dev/cel/extensions/CelExtensions.java | 26 +++- .../cel/extensions/CelListsExtensions.java | 121 ++++++++-------- .../dev/cel/extensions/CelMathExtensions.java | 137 +++++++++--------- .../extensions/CelListsExtensionsTest.java | 12 +- 7 files changed, 243 insertions(+), 178 deletions(-) diff --git a/bundle/src/main/java/dev/cel/bundle/CelEnvironmentExporter.java b/bundle/src/main/java/dev/cel/bundle/CelEnvironmentExporter.java index fdcc4d110..8c69f6e0d 100644 --- a/bundle/src/main/java/dev/cel/bundle/CelEnvironmentExporter.java +++ b/bundle/src/main/java/dev/cel/bundle/CelEnvironmentExporter.java @@ -23,7 +23,6 @@ import dev.cel.expr.Decl.FunctionDecl.Overload; import com.google.auto.value.AutoValue; import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ListMultimap; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -97,7 +96,8 @@ public abstract class CelEnvironmentExporter { */ abstract int maxExcludedStandardFunctionOverloads(); - abstract ImmutableSet extensionLibraries(); + abstract ImmutableSet> + extensionLibraries(); /** Builder for {@link CelEnvironmentExporter}. */ @AutoValue.Builder @@ -107,22 +107,21 @@ public abstract static class Builder { public abstract Builder setMaxExcludedStandardFunctionOverloads(int count); - abstract ImmutableSet.Builder extensionLibrariesBuilder(); + abstract ImmutableSet.Builder> + extensionLibrariesBuilder(); @CanIgnoreReturnValue public Builder addStandardExtensions(CelOptions options) { addExtensionLibraries( - CelExtensions.math(options, 0), - CelExtensions.math(options, 1), - CelExtensions.math(options, 2), - CelExtensions.lists(0), - CelExtensions.lists(1), - CelExtensions.lists(2)); + CelExtensions.getExtensionLibrary("math", options), + CelExtensions.getExtensionLibrary("lists", options)); + // TODO: add support for remaining standard extensions return this; } @CanIgnoreReturnValue - public Builder addExtensionLibraries(CelExtensionLibrary... libraries) { + public Builder addExtensionLibraries( + CelExtensionLibrary... libraries) { extensionLibrariesBuilder().add(libraries); return this; } @@ -216,52 +215,59 @@ public void visitMacro(CelMacro macro) { */ private void addExtensionConfigsAndRemoveFromInventory( CelEnvironment.Builder envBuilder, Set inventory) { - ImmutableList libraries = - ImmutableList.sortedCopyOf( - Comparator.comparing(CelExtensionLibrary::getName) - .thenComparing(CelExtensionLibrary::getVersion) - .reversed(), - extensionLibraries()); + ArrayList featureSets = new ArrayList<>(); + + for (CelExtensionLibrary extensionLibrary : + extensionLibraries()) { + for (CelExtensionLibrary.FeatureSet featureSet : extensionLibrary.versions()) { + featureSets.add(NamedFeatureSet.create(extensionLibrary.name(), featureSet)); + } + } + + featureSets.sort( + Comparator.comparing(NamedFeatureSet::name) + .thenComparing(nfs -> nfs.featureSet().version()) + .reversed()); Set includedExtensions = new HashSet<>(); - for (CelExtensionLibrary library : libraries) { - if (includedExtensions.contains(library.getName())) { + for (NamedFeatureSet lib : featureSets) { + if (includedExtensions.contains(lib.name())) { // We only need to infer the highest version library, so we can skip lower versions continue; } - if (checkIfExtensionIsIncludedAndRemoveFromInventory(inventory, library)) { - envBuilder.addExtensions(ExtensionConfig.of(library.getName(), library.getVersion())); - includedExtensions.add(library.getName()); + if (checkIfExtensionIsIncludedAndRemoveFromInventory(inventory, lib.featureSet())) { + envBuilder.addExtensions(ExtensionConfig.of(lib.name(), lib.featureSet().version())); + includedExtensions.add(lib.name()); } } } private boolean checkIfExtensionIsIncludedAndRemoveFromInventory( - Set inventory, CelExtensionLibrary library) { - ImmutableSet functions = library.getFunctions(); - ArrayList includedItems = new ArrayList<>(functions.size()); + Set inventory, CelExtensionLibrary.FeatureSet featureSet) { + ImmutableSet functions = featureSet.functions(); + ArrayList includedFeatures = new ArrayList<>(functions.size()); for (CelFunctionDecl function : functions) { for (CelOverloadDecl overload : function.overloads()) { - NamedOverload item = NamedOverload.create(function.name(), overload); - if (!inventory.contains(item)) { + NamedOverload feature = NamedOverload.create(function.name(), overload); + if (!inventory.contains(feature)) { return false; } - includedItems.add(item); + includedFeatures.add(feature); } } - ImmutableSet macros = library.getMacros(); + ImmutableSet macros = featureSet.macros(); for (CelMacro macro : macros) { if (!inventory.contains(macro)) { return false; } - includedItems.add(macro); + includedFeatures.add(macro); } // TODO - Add checks for variables. - inventory.removeAll(includedItems); + inventory.removeAll(includedFeatures); return true; } @@ -424,5 +430,18 @@ static NamedOverload create(String functionName, CelOverloadDecl overload) { return new AutoValue_CelEnvironmentExporter_NamedOverload(functionName, overload); } } -} + /** + * Wrapper for CelExtensionLibrary.FeatureSet, associating it with the corresponding library name. + */ + @AutoValue + abstract static class NamedFeatureSet { + abstract String name(); + + abstract CelExtensionLibrary.FeatureSet featureSet(); + + static NamedFeatureSet create(String name, CelExtensionLibrary.FeatureSet featureSet) { + return new AutoValue_CelEnvironmentExporter_NamedFeatureSet(name, featureSet); + } + } +} diff --git a/extensions/src/main/java/dev/cel/extensions/BUILD.bazel b/extensions/src/main/java/dev/cel/extensions/BUILD.bazel index db743da70..42ef62048 100644 --- a/extensions/src/main/java/dev/cel/extensions/BUILD.bazel +++ b/extensions/src/main/java/dev/cel/extensions/BUILD.bazel @@ -39,6 +39,7 @@ java_library( ":sets_function", ":strings", "//common:options", + "//extensions:extension_library", "@maven//:com_google_guava_guava", ], ) diff --git a/extensions/src/main/java/dev/cel/extensions/CelExtensionLibrary.java b/extensions/src/main/java/dev/cel/extensions/CelExtensionLibrary.java index 6d5637722..28e17b2dc 100644 --- a/extensions/src/main/java/dev/cel/extensions/CelExtensionLibrary.java +++ b/extensions/src/main/java/dev/cel/extensions/CelExtensionLibrary.java @@ -17,6 +17,7 @@ import com.google.common.collect.ImmutableSet; import dev.cel.common.CelFunctionDecl; import dev.cel.parser.CelMacro; +import java.util.Comparator; /** * Interface for defining CEL extension libraries. @@ -24,19 +25,43 @@ *

An extension library is a collection of CEL functions, variables, and macros that can be added * to a CEL environment to provide additional functionality. */ -public interface CelExtensionLibrary { +public interface CelExtensionLibrary { /** Returns the name of the extension library. */ - String getName(); + String name(); - /** Returns the extension library version or -1 if unspecified. */ - int getVersion(); + ImmutableSet versions(); - /** Returns the set of function declarations defined by this extension library. */ - ImmutableSet getFunctions(); + default T latest() { + return versions().stream().max(Comparator.comparing(FeatureSet::version)).get(); + } - /** Returns the set of macros defined by this extension library. */ - ImmutableSet getMacros(); + default T version(int version) { + if (version == Integer.MAX_VALUE) { + return latest(); + } - // TODO - Add a method for variables. + for (T v : versions()) { + if (v.version() == version) { + return v; + } + } + throw new IllegalArgumentException("Unsupported '" + name() + "' extension version " + version); + } + + /** + * Interface for defining a version of a CEL extension library. + */ + interface FeatureSet { + /** Returns the extension library version or -1 if unspecified. */ + int version(); + + /** Returns the set of function declarations defined by this extension library. */ + ImmutableSet functions(); + + /** Returns the set of macros defined by this extension library. */ + ImmutableSet macros(); + + // TODO - Add a method for variables. + } } diff --git a/extensions/src/main/java/dev/cel/extensions/CelExtensions.java b/extensions/src/main/java/dev/cel/extensions/CelExtensions.java index d7a0390c2..c983e5e36 100644 --- a/extensions/src/main/java/dev/cel/extensions/CelExtensions.java +++ b/extensions/src/main/java/dev/cel/extensions/CelExtensions.java @@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Streams; import dev.cel.common.CelOptions; -import dev.cel.extensions.CelListsExtensions.Function; import java.util.Set; /** @@ -108,7 +107,7 @@ public static CelProtoExtensions protos() { * options object used to configure the compilation/runtime environments. */ public static CelMathExtensions math(CelOptions celOptions) { - return new CelMathExtensions(celOptions, Integer.MAX_VALUE); + return CelMathExtensions.library(celOptions).latest(); } /** @@ -117,7 +116,7 @@ public static CelMathExtensions math(CelOptions celOptions) { *

Refer to README.md for functions available in each version. */ public static CelMathExtensions math(CelOptions celOptions, int version) { - return new CelMathExtensions(celOptions, version); + return CelMathExtensions.library(celOptions).version(version); } /** @@ -229,7 +228,7 @@ public static CelSetsExtensions sets(CelOptions celOptions, Set fu * CelListsExtensions.Function}. */ public static CelListsExtensions lists() { - return new CelListsExtensions(Integer.MAX_VALUE); + return CelListsExtensions.library().latest(); } /** @@ -238,7 +237,7 @@ public static CelListsExtensions lists() { *

Refer to README.md for functions available in each version. */ public static CelListsExtensions lists(int version) { - return new CelListsExtensions(version); + return CelListsExtensions.library().version(version); } /** @@ -259,8 +258,8 @@ public static CelListsExtensions lists(CelListsExtensions.Function... functions) *

Refer to README.md for available functions. * *

This will include all functions denoted in {@link CelListsExtensions.Function}, including - * any future additions. To expose only a subset of functions, use {@link #lists(Function...)} - * instead. + * any future additions. To expose only a subset of functions, use {@link + * #lists(CelListsExtensions.Function...)} instead. */ public static CelListsExtensions lists(Set functions) { return new CelListsExtensions(functions); @@ -301,5 +300,18 @@ public static ImmutableSet getAllFunctionNames() { .collect(toImmutableSet()); } + public static CelExtensionLibrary getExtensionLibrary( + String name, CelOptions options) { + switch (name) { + case "math": + return CelMathExtensions.library(options); + case "lists": + return CelListsExtensions.library(); + // TODO: add support for remaining standard extensions + default: + throw new IllegalArgumentException("Unknown standard extension '" + name + "'"); + } + } + private CelExtensions() {} } diff --git a/extensions/src/main/java/dev/cel/extensions/CelListsExtensions.java b/extensions/src/main/java/dev/cel/extensions/CelListsExtensions.java index 283d5bdb5..56e0fb97b 100644 --- a/extensions/src/main/java/dev/cel/extensions/CelListsExtensions.java +++ b/extensions/src/main/java/dev/cel/extensions/CelListsExtensions.java @@ -51,20 +51,19 @@ /** Internal implementation of CEL lists extensions. */ final class CelListsExtensions - implements CelCompilerLibrary, CelInternalRuntimeLibrary, CelExtensionLibrary { - - private static final TypeParamType LIST_PARAM_TYPE = TypeParamType.create("T"); + implements CelCompilerLibrary, CelInternalRuntimeLibrary, CelExtensionLibrary.FeatureSet { @SuppressWarnings({"unchecked"}) // Unchecked: Type-checker guarantees casting safety. public enum Function { + // Note! Creating dependencies on the outer class may cause circular initialization issues. SLICE( CelFunctionDecl.newFunctionDeclaration( "slice", CelOverloadDecl.newMemberOverload( "list_slice", "Returns a new sub-list using the indices provided", - ListType.create(LIST_PARAM_TYPE), - ListType.create(LIST_PARAM_TYPE), + ListType.create(TypeParamType.create("T")), + ListType.create(TypeParamType.create("T")), SimpleType.INT, SimpleType.INT)), CelFunctionBinding.from( @@ -82,8 +81,8 @@ public enum Function { CelOverloadDecl.newMemberOverload( "list_flatten", "Flattens a list by a single level", - ListType.create(LIST_PARAM_TYPE), - ListType.create(ListType.create(LIST_PARAM_TYPE))), + ListType.create(TypeParamType.create("T")), + ListType.create(ListType.create(TypeParamType.create("T")))), CelOverloadDecl.newMemberOverload( "list_flatten_list_int", "Flattens a list to the specified level. A negative depth value flattens the list" @@ -109,16 +108,16 @@ public enum Function { CelOverloadDecl.newMemberOverload( "list_distinct", "Returns the distinct elements of a list", - ListType.create(LIST_PARAM_TYPE), - ListType.create(LIST_PARAM_TYPE)))), + ListType.create(TypeParamType.create("T")), + ListType.create(TypeParamType.create("T"))))), REVERSE( CelFunctionDecl.newFunctionDeclaration( "reverse", CelOverloadDecl.newMemberOverload( "list_reverse", "Returns the elements of a list in reverse order", - ListType.create(LIST_PARAM_TYPE), - ListType.create(LIST_PARAM_TYPE))), + ListType.create(TypeParamType.create("T")), + ListType.create(TypeParamType.create("T")))), CelFunctionBinding.from( "list_reverse", Collection.class, @@ -129,49 +128,18 @@ public enum Function { CelOverloadDecl.newMemberOverload( "list_sort", "Sorts a list with comparable elements.", - ListType.create(LIST_PARAM_TYPE), - ListType.create(LIST_PARAM_TYPE)))), + ListType.create(TypeParamType.create("T")), + ListType.create(TypeParamType.create("T"))))), SORT_BY( CelFunctionDecl.newFunctionDeclaration( "lists.@sortByAssociatedKeys", CelOverloadDecl.newGlobalOverload( "list_sortByAssociatedKeys", "Sorts a list by a key value. Used by the 'sortBy' macro", - ListType.create(LIST_PARAM_TYPE), - ListType.create(LIST_PARAM_TYPE)))) + ListType.create(TypeParamType.create("T")), + ListType.create(TypeParamType.create("T"))))) ; - private static final ImmutableSet VERSION_0 = ImmutableSet.of(SLICE); - - private static final ImmutableSet VERSION_1 = - ImmutableSet.builder().addAll(VERSION_0).add(FLATTEN).build(); - - private static final ImmutableSet VERSION_2 = - ImmutableSet.builder().addAll(VERSION_1).add( - RANGE, - DISTINCT, - REVERSE, - SORT, - SORT_BY) - .build(); - - private static final ImmutableSet VERSION_LATEST = VERSION_2; - - private static ImmutableSet byVersion(int version) { - switch (version) { - case 0: - return Function.VERSION_0; - case 1: - return Function.VERSION_1; - case 2: - return Function.VERSION_2; - case Integer.MAX_VALUE: - return Function.VERSION_LATEST; - default: - throw new IllegalArgumentException("Unsupported 'lists' extension version " + version); - } - } - private final CelFunctionDecl functionDecl; private final ImmutableSet functionBindings; @@ -185,36 +153,69 @@ String getFunction() { } } - private final int version; - private final ImmutableSet functions; + private static final CelExtensionLibrary LIBRARY = + new CelExtensionLibrary() { + private final CelListsExtensions version0 = + new CelListsExtensions(0, ImmutableSet.of(Function.SLICE)); + private final CelListsExtensions version1 = + new CelListsExtensions( + 1, + ImmutableSet.builder() + .addAll(version0.functions) + .add(Function.FLATTEN) + .build()); + private final CelListsExtensions version2 = + new CelListsExtensions( + 2, + ImmutableSet.builder() + .addAll(version1.functions) + .add( + Function.RANGE, + Function.DISTINCT, + Function.REVERSE, + Function.SORT, + Function.SORT_BY) + .build()); + + @Override + public String name() { + return "lists"; + } - CelListsExtensions(int version) { - this.version = version; - this.functions = Function.byVersion(version); + @Override + public ImmutableSet versions() { + return ImmutableSet.of(version0, version1, version2); + } + }; + + static CelExtensionLibrary library() { + return LIBRARY; } + private final int version; + private final ImmutableSet functions; + CelListsExtensions(Set functions) { - this.version = -1; - this.functions = ImmutableSet.copyOf(functions); + this(-1, functions); } - @Override - public String getName() { - return "lists"; + private CelListsExtensions(int version, Set functions) { + this.version = version; + this.functions = ImmutableSet.copyOf(functions); } @Override - public int getVersion() { + public int version() { return version; } @Override - public ImmutableSet getFunctions() { + public ImmutableSet functions() { return functions.stream().map(f -> f.functionDecl).collect(toImmutableSet()); } @Override - public ImmutableSet getMacros() { + public ImmutableSet macros() { if (version >= 2) { return ImmutableSet.of( CelMacro.newReceiverMacro("sortBy", 2, CelListsExtensions::sortByMacro)); @@ -224,7 +225,7 @@ public ImmutableSet getMacros() { @Override public void setParserOptions(CelParserBuilder parserBuilder) { - parserBuilder.addMacros(getMacros()); + parserBuilder.addMacros(macros()); } @Override diff --git a/extensions/src/main/java/dev/cel/extensions/CelMathExtensions.java b/extensions/src/main/java/dev/cel/extensions/CelMathExtensions.java index a65a37619..1e318aedc 100644 --- a/extensions/src/main/java/dev/cel/extensions/CelMathExtensions.java +++ b/extensions/src/main/java/dev/cel/extensions/CelMathExtensions.java @@ -57,7 +57,7 @@ @SuppressWarnings({"rawtypes", "unchecked"}) // Use of raw Comparables. @Immutable final class CelMathExtensions - implements CelCompilerLibrary, CelRuntimeLibrary, CelExtensionLibrary { + implements CelCompilerLibrary, CelRuntimeLibrary, CelExtensionLibrary.FeatureSet { private static final String MATH_NAMESPACE = "math"; @@ -645,54 +645,6 @@ enum Function { CelFunctionBinding.from( "math_sqrt_uint", UnsignedLong.class, CelMathExtensions::sqrtUint))); - private static final ImmutableSet VERSION_0 = ImmutableSet.of( - MIN, - MAX); - - private static final ImmutableSet VERSION_1 = - ImmutableSet.builder() - .addAll(VERSION_0) - .add( - CEIL, - FLOOR, - ROUND, - TRUNC, - ISINF, - ISNAN, - ISFINITE, - ABS, - SIGN, - BITAND, - BITOR, - BITXOR, - BITNOT, - BITSHIFTLEFT, - BITSHIFTRIGHT) - .build(); - - private static final ImmutableSet VERSION_2 = - ImmutableSet.builder() - .addAll(VERSION_1) - .add(SQRT) - .build(); - - private static final ImmutableSet VERSION_LATEST = VERSION_2; - - private static ImmutableSet byVersion(int version) { - switch (version) { - case 0: - return Function.VERSION_0; - case 1: - return Function.VERSION_1; - case 2: - return Function.VERSION_2; - case Integer.MAX_VALUE: - return Function.VERSION_LATEST; - default: - throw new IllegalArgumentException("Unsupported 'math' extension version " + version); - } - } - private final CelFunctionDecl functionDecl; private final ImmutableSet functionBindings; private final ImmutableSet functionBindingsULongSigned; @@ -718,41 +670,96 @@ String getFunction() { } } + private static final class Library implements CelExtensionLibrary { + private final CelMathExtensions version0; + private final CelMathExtensions version1; + private final CelMathExtensions version2; + + Library(boolean enableUnsignedLongs) { + version0 = + new CelMathExtensions( + 0, ImmutableSet.of(Function.MIN, Function.MAX), enableUnsignedLongs); + + version1 = + new CelMathExtensions( + 1, + ImmutableSet.builder() + .addAll(version0.functions) + .add( + Function.CEIL, + Function.FLOOR, + Function.ROUND, + Function.TRUNC, + Function.ISINF, + Function.ISNAN, + Function.ISFINITE, + Function.ABS, + Function.SIGN, + Function.BITAND, + Function.BITOR, + Function.BITXOR, + Function.BITNOT, + Function.BITSHIFTLEFT, + Function.BITSHIFTRIGHT) + .build(), + enableUnsignedLongs); + + version2 = + new CelMathExtensions( + 2, + ImmutableSet.builder() + .addAll(version1.functions) + .add(Function.SQRT) + .build(), + enableUnsignedLongs); + } + + @Override + public String name() { + return "math"; + } + + @Override + public ImmutableSet versions() { + return ImmutableSet.of(version0, version1, version2); + } + } + + private static final Library LIBRARY_UNSIGNED_LONGS_ENABLED = new Library(true); + private static final Library LIBRARY_UNSIGNED_LONGS_DISABLED = new Library(false); + + static CelExtensionLibrary library(CelOptions celOptions) { + return celOptions.enableUnsignedLongs() + ? LIBRARY_UNSIGNED_LONGS_ENABLED + : LIBRARY_UNSIGNED_LONGS_DISABLED; + } + private final boolean enableUnsignedLongs; private final ImmutableSet functions; private final int version; - CelMathExtensions(CelOptions celOptions, int version) { - this(celOptions, version, Function.byVersion(version)); - } - CelMathExtensions(CelOptions celOptions, Set functions) { - this(celOptions, -1, functions); + this(-1, functions, celOptions.enableUnsignedLongs()); } - private CelMathExtensions(CelOptions celOptions, int version, Set functions) { - this.enableUnsignedLongs = celOptions.enableUnsignedLongs(); + private CelMathExtensions(int version, Set functions, boolean enableUnsignedLongs) { + this.enableUnsignedLongs = enableUnsignedLongs; this.version = version; this.functions = ImmutableSet.copyOf(functions); } @Override - public String getName() { - return "math"; - } - - @Override - public int getVersion() { + public int version() { return version; } @Override - public ImmutableSet getFunctions() { + public ImmutableSet functions() { return functions.stream().map(f -> f.functionDecl).collect(toImmutableSet()); } @Override - public ImmutableSet getMacros() { + public ImmutableSet macros() { return ImmutableSet.of( CelMacro.newReceiverVarArgMacro("greatest", CelMathExtensions::expandGreatestMacro), CelMacro.newReceiverVarArgMacro("least", CelMathExtensions::expandLeastMacro)); @@ -760,7 +767,7 @@ public ImmutableSet getMacros() { @Override public void setParserOptions(CelParserBuilder parserBuilder) { - parserBuilder.addMacros(getMacros()); + parserBuilder.addMacros(macros()); } @Override diff --git a/extensions/src/test/java/dev/cel/extensions/CelListsExtensionsTest.java b/extensions/src/test/java/dev/cel/extensions/CelListsExtensionsTest.java index 481bb5843..0a3f34515 100644 --- a/extensions/src/test/java/dev/cel/extensions/CelListsExtensionsTest.java +++ b/extensions/src/test/java/dev/cel/extensions/CelListsExtensionsTest.java @@ -56,11 +56,11 @@ public class CelListsExtensionsTest { @Test public void functionList_byVersion() { - assertThat(CelExtensions.lists(0).getFunctions().stream().map(f -> f.name())) + assertThat(CelExtensions.lists(0).functions().stream().map(f -> f.name())) .containsExactly("slice"); - assertThat(CelExtensions.lists(1).getFunctions().stream().map(f -> f.name())) + assertThat(CelExtensions.lists(1).functions().stream().map(f -> f.name())) .containsExactly("slice", "flatten"); - assertThat(CelExtensions.lists(2).getFunctions().stream().map(f -> f.name())) + assertThat(CelExtensions.lists(2).functions().stream().map(f -> f.name())) .containsExactly( "slice", "flatten", @@ -73,9 +73,9 @@ public void functionList_byVersion() { @Test public void macroList_byVersion() { - assertThat(CelExtensions.lists(0).getMacros().stream().map(f -> f.getFunction())).isEmpty(); - assertThat(CelExtensions.lists(1).getMacros().stream().map(f -> f.getFunction())).isEmpty(); - assertThat(CelExtensions.lists(2).getMacros().stream().map(f -> f.getFunction())) + assertThat(CelExtensions.lists(0).macros().stream().map(f -> f.getFunction())).isEmpty(); + assertThat(CelExtensions.lists(1).macros().stream().map(f -> f.getFunction())).isEmpty(); + assertThat(CelExtensions.lists(2).macros().stream().map(f -> f.getFunction())) .containsExactly("sortBy"); }