Skip to content

Commit

Permalink
[GR-59948] Backport to 24.1: Use a safe cast when retrieving the stor…
Browse files Browse the repository at this point in the history
…age in array-based static objects.

PullRequest: graal/19398
  • Loading branch information
OracleLabsAutomation committed Dec 17, 2024
2 parents 2b80bcb + faf9a97 commit 6b85833
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static <T> ArrayBasedStaticShape<T> create(ArrayBasedShapeGenerator<?> generator
@Override
@SuppressWarnings("cast")
Object getStorage(Object obj, boolean primitive) {
Object receiverObject = cast(obj, storageClass, false);
Object receiverObject = checkedCast(obj, storageClass);
if (safetyChecks) {
checkShape(receiverObject);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ final <U> U cast(Object obj, Class<U> type, boolean checkCondition) {
}
}

private static <U> U checkedCast(Object obj, Class<U> type) {
static <U> U checkedCast(Object obj, Class<U> type) {
try {
return type.cast(obj);
} catch (ClassCastException e) {
Expand Down

0 comments on commit 6b85833

Please sign in to comment.