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

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

commit 43328bae51a02eca3c56b8c605a605cb02cee1b3
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Mar 20 11:01:22 2025 -0400

    BasicTypeConverter.unmodifiableCollection(Collection) now uses generics
---
 src/changes/changes.xml                                          | 1 +
 .../java/org/apache/commons/jxpath/util/BasicTypeConverter.java  | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b3ba793..f299b01 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -133,6 +133,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Make the private 
NullPointer.qname field final.</action>
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Make the private 
JDOMNodePointer.id field final.</action>
       <action dev="ggregory" type="fix" due-to="Gary 
Gregory">ExpressionContext.getContextNodeList() now uses generics.</action>
+      <action dev="ggregory" type="fix" due-to="Gary 
Gregory">BasicTypeConverter.unmodifiableCollection(Collection) now uses 
generics.</action>
       <!-- ADD -->
       <action issue="JXPATH-123" dev="mbenson" type="add">
         XPath function "ends-with" is not implemented (although "starts-with" 
is).
diff --git 
a/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java 
b/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
index 0eb3ead..cfff6c6 100644
--- a/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
+++ b/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java
@@ -536,18 +536,19 @@ public class BasicTypeConverter implements TypeConverter {
     /**
      * Gets an unmodifiable version of a collection.
      *
+     * @param <E> the type of elements in this collection.
      * @param collection to wrap
      * @return Collection
      */
-    protected Collection unmodifiableCollection(final Collection collection) {
+    protected <E> Collection<E> unmodifiableCollection(final Collection<E> 
collection) {
         if (collection instanceof List) {
-            return Collections.unmodifiableList((List) collection);
+            return Collections.unmodifiableList((List<E>) collection);
         }
         if (collection instanceof SortedSet) {
-            return Collections.unmodifiableSortedSet((SortedSet) collection);
+            return Collections.unmodifiableSortedSet((SortedSet<E>) 
collection);
         }
         if (collection instanceof Set) {
-            return Collections.unmodifiableSet((Set) collection);
+            return Collections.unmodifiableSet((Set<E>) collection);
         }
         return Collections.unmodifiableCollection(collection);
     }

Reply via email to