Skip to content

Commit

Permalink
Issue a warning instead of throwing an exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
khatchad committed Jul 25, 2024
1 parent 02366ec commit 5d72128
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,28 @@ private Util() {}

/**
* If the given {@link ConstantKey}'s value is <code>null</code>, then issue a warning and return
* <code>null</code>. Otherwise, throw an {@link IllegalArgumentException} stating that an {@link
* AllocationSiteInNode} cannot be extracted from the given {@link ConstantKey}. A value of <code>
* <code>null</code>. Otherwise, issue a warning stating that an {@link AllocationSiteInNode}
* cannot be extracted from the given {@link ConstantKey}. A value of <code>
* null</code> most likely indicates that a receiver can potentially be <code>null</code>.
*
* @param constantKey The {@link ConstantKey} from which to extract the corresponding {@link
* AllocationSiteInNode}.
* @return <code>null</code> if the given {@link ConstantKey}'s value is <code>null</code>.
* @throws IllegalArgumentException If the constant's value is another else other than <code>null
* </code>.
* @return <code>null</code>.
*/
private static AllocationSiteInNode getAllocationSiteInNode(ConstantKey<?> constantKey) {
Object value = constantKey.getValue();

if (value == null) {
if (value == null)
LOGGER.warning("Can't extract AllocationSiteInNode from: " + constantKey + ".");
return null;
} else
throw new IllegalArgumentException(
else
LOGGER.warning(
"Can't extract AllocationSiteInNode from: "
+ constantKey
+ ". Not expecting value of: "
+ value
+ " from ConstantKey.");

return null;
}

/**
Expand Down

0 comments on commit 5d72128

Please sign in to comment.