You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2023/03/12 15:15:18 UTC

[commons-jexl] branch release updated: JEXL: 3.3 RC1 - Fixing Javadoc, tests

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

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


The following commit(s) were added to refs/heads/release by this push:
     new 4838439b JEXL: 3.3 RC1 - Fixing Javadoc, tests
4838439b is described below

commit 4838439b337fa374d70c8a06ebb175eb4d16dbde
Author: henrib <he...@apache.org>
AuthorDate: Sun Mar 12 16:15:11 2023 +0100

    JEXL: 3.3 RC1
    - Fixing Javadoc, tests
---
 pom.xml                                            | 20 ++++++-----
 src/changes/changes.xml                            |  2 +-
 .../org/apache/commons/jexl3/JexlArithmetic.java   |  7 +++-
 .../commons/jexl3/introspection/JexlSandbox.java   |  4 +--
 .../commons/jexl3/ComposePermissionsTest.java      | 28 ++++++++++++---
 .../internal/introspection/PermissionsTest.java    | 42 ++++++++++++++++------
 6 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/pom.xml b/pom.xml
index c1d82a71..4944e23b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -273,15 +273,6 @@
                 </configuration>
             </plugin>
 
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <configuration>
-                    <excludePackageNames>*.internal:*.internal.introspection:*.parser</excludePackageNames>
-                    <show>public</show>
-                </configuration>
-            </plugin>
-
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-pmd-plugin</artifactId>
@@ -454,6 +445,17 @@
                 </configuration>
             </plugin>
 
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <excludePackageNames>
+                        *.internal:*.internal.introspection:*.parser:
+                    </excludePackageNames>
+                    <show>protected</show>
+                </configuration>
+            </plugin>
+
         </plugins>
     </reporting>
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 51ade2f1..f013fc8a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -25,7 +25,7 @@
         <author email="dev@commons.apache.org">Commons Developers</author>
     </properties>
     <body>
-        <release version="3.3" date="YYYY-MM-DD">
+        <release version="3.3" date="2020-03-20">
             <!-- ADD -->
             <action dev="henrib" type="add" issue="JEXL-392">
                 Enable namespace declaration based on scripts
diff --git a/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java b/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
index 4121cc11..30ff02dc 100644
--- a/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
+++ b/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
@@ -385,6 +385,7 @@ public class JexlArithmetic {
      *
      * @param strictCast whether strict cast is required
      * @param defaultValue the default value to return, if not strict
+     * @param <T> the value type
      * @return the default value is strict is false
      * @throws JexlArithmetic.NullOperand if strict-cast
      * @since 3.3
@@ -1875,7 +1876,11 @@ public class JexlArithmetic {
 
     /**
      * Any override of this method (pre 3.3) should be modified to match the new signature.
-     * @link JexlArithmetic.compare(String, String, JexlOperator);
+     * @param left left operand
+     * @param right right operand
+     * @param symbol the operator symbol
+     * @return -1 if left &lt; right; +1 if left &gt; right; 0 if left == right
+     * {@link JexlArithmetic#compare(Object, Object, JexlOperator)}
      * @deprecated 3.3
      */
     @Deprecated
diff --git a/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java b/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java
index 67b8afe6..b2ef75f6 100644
--- a/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java
+++ b/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java
@@ -395,13 +395,13 @@ public final class JexlSandbox {
     }
 
     /**
-     * Unused.
+     * @deprecated since 3.2, use {@link AllowSet}
      */
     @Deprecated
     public static final class WhiteSet extends AllowSet {}
 
     /**
-     * Unused.
+     * @deprecated since 3.2, use {@link BlockSet}
      */
     @Deprecated
     public static final class BlackSet extends BlockSet {}
diff --git a/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java b/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
index 6f4de5e3..be4f20e9 100644
--- a/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
+++ b/src/test/java/org/apache/commons/jexl3/ComposePermissionsTest.java
@@ -18,6 +18,7 @@ package org.apache.commons.jexl3;
 
 import java.io.File;
 import java.io.FileReader;
+import java.util.Collections;
 
 import com.google.gson.Gson;
 import org.apache.commons.jexl3.introspection.JexlPermissions;
@@ -36,7 +37,26 @@ public class ComposePermissionsTest extends JexlTestCase {
     super("PermissionsTest");
   }
 
-  @Test public void testComposePermissions() throws Exception {
+  @Test
+  public void testComposePermissions() throws Exception {
+    runComposePermissions(JexlPermissions.UNRESTRICTED);
+  }
+
+  @Test
+  public void testComposePermissions1() throws Exception {
+    runComposePermissions(new JexlPermissions.Delegate(JexlPermissions.UNRESTRICTED) {
+      @Override public String toString() {
+        return "delegate:" + base.toString();
+      }
+    });
+  }
+
+  @Test
+  public void testComposePermissions2() throws Exception {
+    runComposePermissions(new JexlPermissions.ClassPermissions(JexlPermissions.UNRESTRICTED, Collections.emptySet()));
+  }
+
+  void runComposePermissions(JexlPermissions p) throws Exception {
     final String check = "http://example.com/content.jpg";
     final File jsonFile = new File(SAMPLE_JSON);
     Gson gson = new Gson();
@@ -44,13 +64,13 @@ public class ComposePermissionsTest extends JexlTestCase {
     Assert.assertNotNull(json);
 
     // will succeed because java.util.Map is allowed and gson LinkedTreeMap is one
-    JexlEngine j0 = createEngine(false, JexlPermissions.UNRESTRICTED);
+    JexlEngine j0 = createEngine(false, p);
     JexlScript s0 = j0.createScript("json.pageInfo.pagePic", "json");
     Object r0 = s0.execute(null, json);
     Assert.assertEquals(check, r0);
 
     // will fail if gson package is denied
-    JexlEngine j1 = createEngine(false, JexlPermissions.UNRESTRICTED.compose("com.google.gson.internal {}"));
+    JexlEngine j1 = createEngine(false, p.compose("com.google.gson.internal {}"));
     JexlScript s1 = j1.createScript("json.pageInfo.pagePic", "json");
     try {
       Object r1 = s1.execute(null, json);
@@ -60,7 +80,7 @@ public class ComposePermissionsTest extends JexlTestCase {
     }
 
     // will fail since gson package is denied
-     j1 = createEngine(false, JexlPermissions.UNRESTRICTED.compose("com.google.gson.internal { LinkedTreeMap {} }"));
+     j1 = createEngine(false, p.compose("com.google.gson.internal { LinkedTreeMap {} }"));
      s1 = j1.createScript("json.pageInfo.pagePic", "json");
     try {
       Object r1 = s1.execute(null, json);
diff --git a/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java b/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java
index da0eb7a8..d8564735 100644
--- a/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java
+++ b/src/test/java/org/apache/commons/jexl3/internal/introspection/PermissionsTest.java
@@ -34,6 +34,7 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
@@ -98,18 +99,39 @@ public class PermissionsTest {
         int method();
     }
 
-    @Test
-    public void testPermissions() throws Exception {
-        String src = " org.apache.commons.jexl3.internal.introspection { PermissionsTest { "+
-                "InterNoJexl0 { } "+
-                "InterNoJexl1 { method(); } "+
-                "A0 { A0(); i0; } "+
-                "A1 { A1(); } "+
-                "A2 { } "+
-                "InterNoJexl5 { } "+
+    JexlPermissions permissions0() {
+        String src = " org.apache.commons.jexl3.internal.introspection { PermissionsTest { " +
+                "InterNoJexl0 { } " +
+                "InterNoJexl1 { method(); } " +
+                "A0 { A0(); i0; } " +
+                "A1 { A1(); } " +
+                "A2 { } " +
+                "InterNoJexl5 { } " +
                 "} }";
-
         JexlPermissions p = (Permissions) JexlPermissions.parse(src);
+        return p;
+    }
+
+    @Test
+    public void testPermissions0() throws Exception {
+        runTestPermissions(permissions0());
+    }
+
+    @Test
+    public void testPermissions1() throws Exception {
+        runTestPermissions(new JexlPermissions.Delegate(permissions0()) {
+            @Override public String toString() {
+                return "delegate:" + base.toString();
+            }
+        });
+    }
+
+    @Test
+    public void testPermissions2() throws Exception {
+        runTestPermissions(new JexlPermissions.ClassPermissions(permissions0(), Collections.emptySet()));
+    }
+
+    private void runTestPermissions(JexlPermissions p) throws Exception {
         Assert.assertFalse(p.allow((Field) null));
         Assert.assertFalse(p.allow((Package) null));
         Assert.assertFalse(p.allow((Method) null));