This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git


The following commit(s) were added to refs/heads/master by this push:
     new 49c56651 reservedNames must be an immutable Set
49c56651 is described below

commit 49c5665145f53dab13ca27ee6ee0d7022bfdc3cb
Author: Sebb <s...@apache.org>
AuthorDate: Thu Oct 19 22:54:05 2023 +0100

    reservedNames must be an immutable Set
---
 src/main/java/org/apache/commons/jexl3/JexlFeatures.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/jexl3/JexlFeatures.java 
b/src/main/java/org/apache/commons/jexl3/JexlFeatures.java
index 7f46e9de..02d3e26a 100644
--- a/src/main/java/org/apache/commons/jexl3/JexlFeatures.java
+++ b/src/main/java/org/apache/commons/jexl3/JexlFeatures.java
@@ -221,13 +221,15 @@ public final class JexlFeatures {
     }
 
     /**
-     * An all member constructor.
+     * An all member constructor for use by this class only
      * @param f flag
-     * @param r reserved variable names
+     * @param r reserved variable names; must be an immutable Set
      * @param n namespace predicate
      */
-    protected JexlFeatures(final long f, final Set<String> r, final 
Predicate<String> n) {
+    private JexlFeatures(final long f, final Set<String> r, final 
Predicate<String> n) {
         this.flags = f;
+        // N.B. reservedNames must be an immutable Set.
+        // This can only be guaranteed if this ctor is private
         this.reservedNames = r == null? Collections.emptySet() : r;
         this.nameSpaces = n == null? TEST_STR_FALSE : n;
         setFeature(RESERVED, !this.reservedNames.isEmpty());

Reply via email to