diff --git a/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/util/Util.java b/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/util/Util.java
index 233fc038..5e5f9f5d 100644
--- a/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/util/Util.java
+++ b/com.ibm.wala.cast.python/source/com/ibm/wala/cast/python/util/Util.java
@@ -168,28 +168,29 @@ private Util() {}
/**
* If the given {@link ConstantKey}'s value is null
, then issue a warning and return
- * null
. Otherwise, issue a warning stating that an {@link AllocationSiteInNode}
- * cannot be extracted from the given {@link ConstantKey}. A value of
+ * null
. Otherwise, throw an {@link IllegalArgumentException} stating that an {@link
+ * AllocationSiteInNode} cannot be extracted from the given {@link ConstantKey}. A value of
* null
most likely indicates that a receiver can potentially be null
.
*
* @param constantKey The {@link ConstantKey} from which to extract the corresponding {@link
* AllocationSiteInNode}.
- * @return null
.
+ * @return null
if the given {@link ConstantKey}'s value is null
.
+ * @throws IllegalArgumentException If the constant's value is another else other than null
+ *
.
*/
private static AllocationSiteInNode getAllocationSiteInNode(ConstantKey> constantKey) {
Object value = constantKey.getValue();
- if (value == null)
+ if (value == null) {
LOGGER.warning("Can't extract AllocationSiteInNode from: " + constantKey + ".");
- else
- LOGGER.warning(
+ return null;
+ } else
+ throw new IllegalArgumentException(
"Can't extract AllocationSiteInNode from: "
+ constantKey
+ ". Not expecting value of: "
+ value
+ " from ConstantKey.");
-
- return null;
}
/**