svn commit: r1863494 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1863494 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java

mthl
Author: mthl
Date: Sat Jul 20 16:25:51 2019
New Revision: 1863494

URL: http://svn.apache.org/viewvc?rev=1863494&view=rev
Log:
Improved: Rewrite ‘UtilGenerics#checkMap’ to do a simple cast
(OFBIZ-11141)

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863494&r1=1863493&r2=1863494&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:25:51 2019
@@ -59,12 +59,8 @@ public final class UtilGenerics {
         return cast(object);
     }
 
-    @SuppressWarnings("unchecked")
     public static <K, V> Map<K, V> checkMap(Object object) {
-        if (object != null && !(object instanceof Map)) {
-            throw new ClassCastException("Not a map");
-        }
-        return (Map<K, V>) object;
+        return cast(object);
     }
 
     public static <K, V> Map<K, V> checkMap(Object object, Class<K> keyType, Class<V> valueType) {