poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1881686 - in /xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl: store/Xobj.java values/TypeStore.java
Date Sun, 13 Sep 2020 18:13:45 GMT
Author: kiwiwings
Date: Sun Sep 13 18:13:44 2020
New Revision: 1881686

URL: http://svn.apache.org/viewvc?rev=1881686&view=rev
Log:
Fix cast error on TypeStore (in POI)

Modified:
    xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Xobj.java
    xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/TypeStore.java

Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Xobj.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Xobj.java?rev=1881686&r1=1881685&r2=1881686&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Xobj.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/store/Xobj.java Sun Sep 13 18:13:44
2020
@@ -1984,20 +1984,22 @@ abstract class Xobj implements TypeStore
         return null;
     }
 
+    @SuppressWarnings("unchecked")
     @Override
-    public void find_all_element_users(QName name, List<TypeStoreUser> fillMeUp) {
+    public <T extends XmlObject> void find_all_element_users(QName name, List<T>
fillMeUp) {
         for (Xobj x = _firstChild; x != null; x = x._nextSibling) {
             if (x.isElem() && x._name.equals(name)) {
-                fillMeUp.add(x.getUser());
+                fillMeUp.add((T)x.getUser());
             }
         }
     }
 
+    @SuppressWarnings("unchecked")
     @Override
-    public void find_all_element_users(QNameSet names, List<TypeStoreUser> fillMeUp)
{
+    public <T extends XmlObject>  void find_all_element_users(QNameSet names, List<T>
fillMeUp) {
         for (Xobj x = _firstChild; x != null; x = x._nextSibling) {
             if (x.isElem() && names.contains(x._name)) {
-                fillMeUp.add(x.getUser());
+                fillMeUp.add((T)x.getUser());
             }
         }
     }
@@ -2338,11 +2340,12 @@ abstract class Xobj implements TypeStore
 
             assert m == n;
 
-            List<TypeStoreUser> elementsUser = new ArrayList<>();
+            List<XmlObject> elementsUser = new ArrayList<>();
 
             find_all_element_users(elementName, elementsUser);
 
             List<Xobj> elements = elementsUser.stream()
+                .map(x -> (TypeStoreUser)x)
                 .map(TypeStoreUser::get_store)
                 .map(x -> (Xobj)x)
                 .collect(Collectors.toList());

Modified: xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/TypeStore.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/TypeStore.java?rev=1881686&r1=1881685&r2=1881686&view=diff
==============================================================================
--- xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/TypeStore.java (original)
+++ xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/values/TypeStore.java Sun Sep 13
18:13:44 2020
@@ -176,14 +176,14 @@ public interface TypeStore extends Names
      * given name owned by this typestore, or the empty array of
      * TypeStoreUsers if none was found.
      */
-    void find_all_element_users(QName name, List<TypeStoreUser> fillMeUp);
+    <T extends XmlObject> void find_all_element_users(QName name, List<T> fillMeUp);
 
 
     /**
      * Returns all TypeStoreUsers corresponding to elements with one
      * of the names is the QNameSet.
      */
-    void find_all_element_users(QNameSet name, List<TypeStoreUser> fillMeUp);
+    <T extends XmlObject> void find_all_element_users(QNameSet name, List<T>
fillMeUp);
 
     /**
      * Inserts a new element at the position that will make it



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message