This is an automated email from the ASF dual-hosted git repository. henrib pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
commit fc8d447930d7d6446c1d7eed71a9b64cebab9e01 Author: henrib <hen...@apache.org> AuthorDate: Thu Dec 23 16:43:21 2021 +0100 JEXL: winter cleaning; - restoring CI build, take 2 --- pom.xml | 164 +++++++++++++-------- src/main/config/clirr-ignored.xml | 58 ++++++++ src/main/config/pmd.xml | 2 + .../jexl3/internal/introspection/Permissions.java | 29 ++++ 4 files changed, 188 insertions(+), 65 deletions(-) diff --git a/pom.xml b/pom.xml index 4861eb2..ea080b4 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,7 @@ <japicmp.skip>false</japicmp.skip> <commons.japicmp.version>0.15.3</commons.japicmp.version> <commons.pmd.version>3.15.0</commons.pmd.version> + <commons.spotbugs.version>4.4.1</commons.spotbugs.version> <!-- override of Jacoco properties defined in CP52 --> <commons.jacoco.version>0.8.7</commons.jacoco.version> @@ -122,7 +123,7 @@ </dependencies> <build> - <defaultGoal>clean package apache-rat:check spotbugs:check japicmp:cmp checkstyle:check javadoc:javadoc </defaultGoal> + <defaultGoal>clean package apache-rat:check spotbugs:check clirr:check checkstyle:check javadoc:javadoc </defaultGoal> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -248,31 +249,45 @@ <xmlOutput>true</xmlOutput> <excludeFilterFile>${basedir}/src/main/config/findbugs-exclude-filter.xml</excludeFilterFile> </configuration> + <dependencies> + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> + <version>9.2</version> + </dependency> + </dependencies> </plugin> - <!-- japicmp --> + <!-- Allow Clirr to be run from command-line. Must agree with config in report section. --> <plugin> - <groupId>com.github.siom79.japicmp</groupId> - <artifactId>japicmp-maven-plugin</artifactId> - <version>${commons.japicmp.version}</version> + <groupId>org.codehaus.mojo</groupId> + <artifactId>clirr-maven-plugin</artifactId> <configuration> - <parameter> - <includes> - <include>org.apache.commons.jexl3</include> - <include>org.apache.commons.jexl3.introspection</include> - <include>org.apache.commons.jexl3.scripting</include> - </includes> - <excludes> - <exclude>org.apache.commons.jexl3.internal</exclude> - <exclude>org.apache.commons.jexl3.introspection.internal</exclude> - <exclude>org.apache.commons.jexl3.parser</exclude> - </excludes> - <onlyModified>true</onlyModified> - <accessModifier>protected</accessModifier> - <ignoreMissingClasses>true</ignoreMissingClasses> - <breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications> - <breakBuildIfCausedByExclusion>false</breakBuildIfCausedByExclusion> - </parameter> + <ignoredDifferencesFile>${basedir}/src/main/config/clirr-ignored.xml</ignoredDifferencesFile> + <excludes> + <exclude>org/apache/commons/jexl3/parser/**</exclude> + <exclude>org/apache/commons/jexl3/internal/**</exclude> + </excludes> + </configuration> + </plugin> + + <!-- Allow RAT to be run from command-line. Must agree with config in report section. --> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes> + <exclude>.travis.yml</exclude> + </excludes> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <excludePackageNames>*.internal:*.parser</excludePackageNames> + <show>public</show> </configuration> </plugin> @@ -281,7 +296,6 @@ <artifactId>maven-pmd-plugin</artifactId> <version>${commons.pmd.version}</version> <configuration> - <targetJdk>${maven.compiler.target}</targetJdk> <rulesets> <ruleset>${project.basedir}/src/main/config/pmd_jexl.xml</ruleset> </rulesets> @@ -303,25 +317,32 @@ </dependencies> </plugin> - <!-- Allow RAT to be run from command-line. Must agree with config in report section. --> + <!-- japicmp --> <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> + <groupId>com.github.siom79.japicmp</groupId> + <artifactId>japicmp-maven-plugin</artifactId> + <version>${commons.japicmp.version}</version> <configuration> - <excludes> - <exclude>.travis.yml</exclude> - </excludes> + <parameter> + <includes> + <include>org.apache.commons.jexl3</include> + <include>org.apache.commons.jexl3.introspection</include> + <include>org.apache.commons.jexl3.scripting</include> + </includes> + <excludes> + <exclude>org.apache.commons.jexl3.internal</exclude> + <exclude>org.apache.commons.jexl3.introspection.internal</exclude> + <exclude>org.apache.commons.jexl3.parser</exclude> + </excludes> + <onlyModified>true</onlyModified> + <accessModifier>protected</accessModifier> + <ignoreMissingClasses>true</ignoreMissingClasses> + <breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications> + <breakBuildIfCausedByExclusion>false</breakBuildIfCausedByExclusion> + </parameter> </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <excludePackageNames>*.internal:*.parser</excludePackageNames> - <show>public</show> - </configuration> - </plugin> </plugins> </build> @@ -373,6 +394,34 @@ </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <version>${commons.pmd.version}</version> + <configuration> + <targetJdk>${maven.compiler.target}</targetJdk> + <rulesets> + <ruleset>${project.basedir}/src/main/config/pmd.xml</ruleset> + </rulesets> + <excludes> + <exclude>org/apache/commons/jexl3/parser/Parser.java</exclude> + <exclude>org/apache/commons/jexl3/parser/AST*.java</exclude> + <exclude>org/apache/commons/jexl3/parser/ParserTokenManager.java</exclude> + <exclude>org/apache/commons/jexl3/parser/*Constants.java</exclude> + <exclude>org/apache/commons/jexl3/parser/AbstractCharStream.java</exclude> + <exclude>org/apache/commons/jexl3/parser/*Provider.java</exclude> + </excludes> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>pmd</report> + <report>cpd</report> + </reports> + </reportSet> + </reportSets> + </plugin> + + <plugin> <groupId>com.github.siom79.japicmp</groupId> <artifactId>japicmp-maven-plugin</artifactId> <version>${commons.japicmp.version}</version> @@ -398,6 +447,19 @@ </plugin> <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>clirr-maven-plugin</artifactId> + <version>2.8</version> + <configuration> + <ignoredDifferencesFile>${basedir}/src/main/config/clirr-ignored.xml</ignoredDifferencesFile> + <excludes> + <exclude>org/apache/commons/jexl3/parser/**</exclude> + <exclude>org/apache/commons/jexl3/internal/**</exclude> + </excludes> + </configuration> + </plugin> + + <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <configuration> @@ -420,34 +482,6 @@ </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - <version>${commons.pmd.version}</version> - <configuration> - <targetJdk>${maven.compiler.target}</targetJdk> - <rulesets> - <ruleset>${project.basedir}/src/main/config/pmd.xml</ruleset> - </rulesets> - <excludes> - <exclude>org/apache/commons/jexl3/parser/Parser.java</exclude> - <exclude>org/apache/commons/jexl3/parser/AST*.java</exclude> - <exclude>org/apache/commons/jexl3/parser/ParserTokenManager.java</exclude> - <exclude>org/apache/commons/jexl3/parser/*Constants.java</exclude> - <exclude>org/apache/commons/jexl3/parser/AbstractCharStream.java</exclude> - <exclude>org/apache/commons/jexl3/parser/*Provider.java</exclude> - </excludes> - </configuration> - <reportSets> - <reportSet> - <reports> - <report>pmd</report> - <report>cpd</report> - </reports> - </reportSet> - </reportSets> - </plugin> - </plugins> </reporting> diff --git a/src/main/config/clirr-ignored.xml b/src/main/config/clirr-ignored.xml new file mode 100644 index 0000000..6f8b1e1 --- /dev/null +++ b/src/main/config/clirr-ignored.xml @@ -0,0 +1,58 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<differences> + <!-- 3.2 differences: Jexl{Engine, Script, Uberspect} are not used as user implementation contracts + but only as JEXL API contracts. Adding new methods or final modifier to those is very unlikely to have + any impact on actual binary compatiblity.An equivalent set of changes occured on 3.1 without complaints. --> + <difference> + <className>org/apache/commons/jexl3/JexlEngine</className> + <differenceType>7014</differenceType> <!-- final method on abstract class not meant for the user to derive --> + <method>org.apache.commons.jexl3.JexlScript createScript(org.apache.commons.jexl3.JexlInfo, java.lang.String, java.lang.String[])</method> + <to>org.apache.commons.jexl3.JexlScript createScript(org.apache.commons.jexl3.JexlInfo, java.lang.String, java.lang.String[])</to> + </difference> + + <difference> + <className>org/apache/commons/jexl3/JexlEngine</className> + <differenceType>7013</differenceType> <!-- added abstract method on abstract class not meant for the user to derive --> + <method>org.apache.commons.jexl3.JexlScript createScript(org.apache.commons.jexl3.JexlFeatures, org.apache.commons.jexl3.JexlInfo, java.lang.String, java.lang.String[])</method> + <to>org.apache.commons.jexl3.JexlScript createScript(org.apache.commons.jexl3.JexlFeatures, org.apache.commons.jexl3.JexlInfo, java.lang.String, java.lang.String[])</to> + </difference> + + <difference> + <className>org/apache/commons/jexl3/JexlScript</className> + <differenceType>7012</differenceType> <!-- method added to interface that is not meant for the user to implement --> + <method>java.lang.String[] getUnboundParameters()</method> + <to>java.lang.String[] getUnboundParameters()</to> + </difference> + + <difference> + <className>org/apache/commons/jexl3/introspection/JexlUberspect</className> + <differenceType>7012</differenceType> <!-- method added to interface that is not meant for the user to implement --> + <method>java.lang.ClassLoader getClassLoader()</method> + <to>java.lang.ClassLoader getClassLoader()</to> + </difference> + + <!-- The parser now expects/generates TokenMgrException instead of TokenMgrError --> + <difference> + <className>org/apache/commons/jexl3/JexlException$Tokenization</className> + <differenceType>7005</differenceType> <!-- parser now constructs this exception using TokenMgrException --> + <method>JexlException$Tokenization(org.apache.commons.jexl3.JexlInfo, org.apache.commons.jexl3.parser.TokenMgrError)</method> + <to>JexlException$Tokenization(org.apache.commons.jexl3.JexlInfo, org.apache.commons.jexl3.parser.TokenMgrException)</to> + </difference> +</differences> \ No newline at end of file diff --git a/src/main/config/pmd.xml b/src/main/config/pmd.xml index d8099ed..c07be55 100644 --- a/src/main/config/pmd.xml +++ b/src/main/config/pmd.xml @@ -25,7 +25,9 @@ limitations under the License. </description> <rule ref="category/java/bestpractices.xml"> + <!-- Often arguments and parameters array, not semantically varargs --> <exclude name="UseVarargs"/> + <!-- Internal structures (nodes, etc) --> <exclude name="ArrayIsStoredDirectly"/> </rule> </ruleset> diff --git a/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java b/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java index c6fd0ee..afa665c 100644 --- a/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java +++ b/src/main/java/org/apache/commons/jexl3/internal/introspection/Permissions.java @@ -21,6 +21,11 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +//import java.util.Collections; +//import java.util.Map; +//import java.util.Set; +//import java.util.concurrent.ConcurrentHashMap; + import org.apache.commons.jexl3.annotations.NoJexl; /** @@ -35,6 +40,30 @@ public class Permissions { * The default singleton. */ public static final Permissions DEFAULT = new Permissions(); +// +// // my.package { +// // class0 {... +// // class1 {...} +// // class1(); // constructors +// // method(); // method +// // field; +// // } // end class0 +// // } // end package my.package +// +// public static class NoJexlPackage { +// protected Map<String, NoJexlClass> nojexl = new ConcurrentHashMap<>(); +// } +// public static class NoJexlClass { +// protected Set<String> methodNames; +// protected Set<String> fieldNames; +// } +// static final NoJexlClass NOJEXL_CLASS = new NoJexlClass(); +// static final Set<String> NOJEXL_METHODS = Collections.singleton(""); +// static final Set<String> NOJEXL_FIELDS = Collections.singleton(""); +// +// public static final class Shielded extends Permissions { +// Map<String, NoJexlPackage> packageShields; +// } /** * Checks whether a package explicitly disallows JEXL introspection.