[packages/java-commons-collections] Rel 2

arekm arekm at pld-linux.org
Sat Apr 4 20:15:29 CEST 2026


commit d9f963ae3d0f192ba928810bcf9feaeae7980324
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Apr 4 20:15:17 2026 +0200

    Rel 2

 commons-collections-3.2.2-jdk8-map-remove.patch | 115 ++++++++++++++++++++++++
 java-commons-collections.spec                   |  28 ++++--
 2 files changed, 138 insertions(+), 5 deletions(-)
---
diff --git a/java-commons-collections.spec b/java-commons-collections.spec
index 7d71a61..1db6c44 100644
--- a/java-commons-collections.spec
+++ b/java-commons-collections.spec
@@ -5,15 +5,19 @@
 %{?use_default_jdk:%use_default_jdk 8}
 
 %define		srcname	commons-collections4
+%define		v3ver	3.2.2
 Summary:	Commons Collections - Java Collections enhancements
 Summary(pl.UTF-8):	Commons Collections - rozszerzenia Java Collections
 Name:		java-commons-collections
 Version:	4.4
-Release:	1
+Release:	2
 License:	Apache v2.0
 Group:		Libraries/Java
 Source0:	https://archive.apache.org/dist/commons/collections/source/%{srcname}-%{version}-src.tar.gz
 # Source0-md5:	5a4bc1a9b8fd65708057ea50dfc1e74a
+Source1:	https://archive.apache.org/dist/commons/collections/source/commons-collections-%{v3ver}-src.tar.gz
+# Source1-md5:	776b51a51312c1854ad8f6d344a47cda
+Patch0:		commons-collections-3.2.2-jdk8-map-remove.patch
 URL:		https://commons.apache.org/proper/commons-collections/
 %buildrequires_jdk
 BuildRequires:	jpackage-utils
@@ -48,11 +52,14 @@ Dokumentacja do Commons Collections.
 
 %prep
 %setup -q -n %{srcname}-%{version}-src
+%setup -q -n %{srcname}-%{version}-src -a1
+%patch -P0 -p0
 find -name '*.jar' | xargs rm -vf
 
 %build
 export JAVA_HOME="%{java_home}"
 
+# build v4
 install -d target/classes
 %javac -d target/classes \
 	-source 1.8 -target 1.8 \
@@ -63,6 +70,17 @@ cd target/classes
 %jar cf ../%{srcname}-%{version}.jar org
 cd ../..
 
+# build v3 (for packages still using org.apache.commons.collections)
+install -d target/v3classes
+%javac -d target/v3classes \
+	-source 1.5 -target 1.5 \
+	-encoding UTF-8 \
+	$(find commons-collections-%{v3ver}-src/src/java -name '*.java')
+
+cd target/v3classes
+%jar cf ../commons-collections-%{v3ver}.jar org
+cd ../..
+
 %if %{with javadoc}
 %javadoc -d target/apidocs \
 	-source 1.8 \
@@ -78,9 +96,9 @@ rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_javadir}
 install target/%{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{srcname}-%{version}.jar
 ln -sf %{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{srcname}.jar
-# compat symlinks for packages expecting old names
-ln -sf %{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/commons-collections-%{version}.jar
-ln -sf %{srcname}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/commons-collections.jar
+# v3 compat jar (for packages using org.apache.commons.collections.*)
+install target/commons-collections-%{v3ver}.jar $RPM_BUILD_ROOT%{_javadir}/commons-collections-%{v3ver}.jar
+ln -sf commons-collections-%{v3ver}.jar $RPM_BUILD_ROOT%{_javadir}/commons-collections.jar
 
 # javadoc
 %if %{with javadoc}
@@ -100,7 +118,7 @@ ln -sf %{srcname}-%{version} %{_javadocdir}/%{srcname}
 %doc LICENSE.txt NOTICE.txt RELEASE-NOTES.txt
 %{_javadir}/%{srcname}-%{version}.jar
 %{_javadir}/%{srcname}.jar
-%{_javadir}/commons-collections-%{version}.jar
+%{_javadir}/commons-collections-%{v3ver}.jar
 %{_javadir}/commons-collections.jar
 
 %if %{with javadoc}
diff --git a/commons-collections-3.2.2-jdk8-map-remove.patch b/commons-collections-3.2.2-jdk8-map-remove.patch
new file mode 100644
index 0000000..f522942
--- /dev/null
+++ b/commons-collections-3.2.2-jdk8-map-remove.patch
@@ -0,0 +1,115 @@
+diff -urN --no-dereference commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/map/MultiKeyMap.java commons-collections-3.2.2-src/src/java/org/apache/commons/collections/map/MultiKeyMap.java
+--- commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/map/MultiKeyMap.java	2015-11-12 23:25:19.000000000 +0100
++++ commons-collections-3.2.2-src/src/java/org/apache/commons/collections/map/MultiKeyMap.java	2026-04-04 17:48:59.883231983 +0200
+@@ -192,26 +192,25 @@
+ 
+     /**
+      * Removes the specified multi-key from this map.
+-     * 
++     *
+      * @param key1  the first key
+      * @param key2  the second key
+-     * @return the value mapped to the removed key, null if key not in map
++     * @return true if a mapping was removed, false otherwise
+      */
+-    public Object remove(Object key1, Object key2) {
++    public boolean remove(Object key1, Object key2) {
+         int hashCode = hash(key1, key2);
+         int index = map.hashIndex(hashCode, map.data.length);
+         AbstractHashedMap.HashEntry entry = map.data[index];
+         AbstractHashedMap.HashEntry previous = null;
+         while (entry != null) {
+             if (entry.hashCode == hashCode && isEqualKey(entry, key1, key2)) {
+-                Object oldValue = entry.getValue();
+                 map.removeMapping(entry, index, previous);
+-                return oldValue;
++                return true;
+             }
+             previous = entry;
+             entry = entry.next;
+         }
+-        return null;
++        return false;
+     }
+ 
+     /**
+diff -urN --no-dereference commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/map/MultiValueMap.java commons-collections-3.2.2-src/src/java/org/apache/commons/collections/map/MultiValueMap.java
+--- commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/map/MultiValueMap.java	2015-11-12 23:25:19.000000000 +0100
++++ commons-collections-3.2.2-src/src/java/org/apache/commons/collections/map/MultiValueMap.java	2026-04-04 17:48:33.219898652 +0200
+@@ -151,21 +151,21 @@
+      *
+      * @param key  the key to remove from
+      * @param value the value to remove
+-     * @return the value removed (which was passed in), null if nothing removed
++     * @return true if the value was removed, false otherwise
+      */
+-    public Object remove(Object key, Object value) {
++    public boolean remove(Object key, Object value) {
+         Collection valuesForKey = getCollection(key);
+         if (valuesForKey == null) {
+-            return null;
++            return false;
+         }
+         boolean removed = valuesForKey.remove(value);
+         if (removed == false) {
+-            return null;
++            return false;
+         }
+         if (valuesForKey.isEmpty()) {
+             remove(key);
+         }
+-        return value;
++        return true;
+     }
+ 
+     /**
+diff -urN --no-dereference commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/MultiHashMap.java commons-collections-3.2.2-src/src/java/org/apache/commons/collections/MultiHashMap.java
+--- commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/MultiHashMap.java	2015-11-12 23:25:20.000000000 +0100
++++ commons-collections-3.2.2-src/src/java/org/apache/commons/collections/MultiHashMap.java	2026-04-04 17:48:43.579898650 +0200
+@@ -329,23 +329,23 @@
+      * 
+      * @param key  the key to remove from
+      * @param item  the value to remove
+-     * @return the value removed (which was passed in), null if nothing removed
++     * @return true if the value was removed, false otherwise
+      */
+-    public Object remove(Object key, Object item) {
++    public boolean remove(Object key, Object item) {
+         Collection valuesForKey = getCollection(key);
+         if (valuesForKey == null) {
+-            return null;
++            return false;
+         }
+         boolean removed = valuesForKey.remove(item);
+         if (removed == false) {
+-            return null;
++            return false;
+         }
+         // remove the list if it is now empty
+         // (saves space, and allows equals to work)
+         if (valuesForKey.isEmpty()){
+             remove(key);
+         }
+-        return item;
++        return true;
+     }
+ 
+     /**
+diff -urN --no-dereference commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/MultiMap.java commons-collections-3.2.2-src/src/java/org/apache/commons/collections/MultiMap.java
+--- commons-collections-3.2.2-src.orig/src/java/org/apache/commons/collections/MultiMap.java	2015-11-12 23:25:19.000000000 +0100
++++ commons-collections-3.2.2-src/src/java/org/apache/commons/collections/MultiMap.java	2026-04-04 17:48:21.892712804 +0200
+@@ -61,12 +61,12 @@
+      * 
+      * @param key  the key to remove from
+      * @param item  the item to remove
+-     * @return the value removed (which was passed in), null if nothing removed
++     * @return true if the value was removed, false otherwise
+      * @throws UnsupportedOperationException if the map is unmodifiable
+      * @throws ClassCastException if the key or value is of an invalid type
+      * @throws NullPointerException if the key or value is null and null is invalid
+      */
+-    public Object remove(Object key, Object item);
++    public boolean remove(Object key, Object item);
+ 
+     //-----------------------------------------------------------------------
+     /**
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/java-commons-collections.git/commitdiff/d9f963ae3d0f192ba928810bcf9feaeae7980324



More information about the pld-cvs-commit mailing list