Skip to content

Commit 0d17994

Browse files
committed
Restrict DiagnosticThunkRegistry#thunks type to RuntimeImageHeapList.
1 parent c6a95ec commit 0d17994

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateDiagnostics.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
import com.oracle.svm.core.threadlocal.VMThreadLocalInfos;
9797
import com.oracle.svm.core.util.CounterSupport;
9898
import com.oracle.svm.core.util.ImageHeapList;
99+
import com.oracle.svm.core.util.RuntimeImageHeapList;
99100
import com.oracle.svm.core.util.TimeUtils;
100101
import com.oracle.svm.core.util.VMError;
101102

@@ -1352,7 +1353,12 @@ int size() {
13521353
}
13531354

13541355
DiagnosticThunk getThunk(int index) {
1355-
return thunks.get(index);
1356+
/*
1357+
* Use an explicit cast to aid open-world analysis. Otherwise, this may trigger false
1358+
* positive violations of @RestrictHeapAccess since some implementations of List.get()
1359+
* can allocate.
1360+
*/
1361+
return ((RuntimeImageHeapList<DiagnosticThunk>) thunks).get(index);
13561362
}
13571363

13581364
int getInitialInvocationCount(int index) {

0 commit comments

Comments
 (0)