Skip to content
Permalink
Browse files

Improved: Rewrite ‘UtilGenerics#checkMap’ to do a simple cast

(OFBIZ-11141)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863494 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jul 20, 2019
1 parent 7db8f19 commit fe9631545e0789502e80dbe1b9514ebc22362306
Showing with 1 addition and 5 deletions.
  1. +1 −5 framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
@@ -59,12 +59,8 @@ private 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) {

0 comments on commit fe96315

Please sign in to comment.
You can’t perform that action at this time.