Skip to content

Commit 1cdb5aa

Browse files
committed
[GR-60554] Improve causalilty reporting for unresolved elements.
PullRequest: graal/19626
2 parents 30e879f + 77e3a57 commit 1cdb5aa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/SharedGraphBuilderPhase.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ protected Object loadReferenceTypeLock() {
284284

285285
@Override
286286
protected void maybeEagerlyResolve(int cpi, int bytecode) {
287+
lastUnresolvedElementException = null;
287288
try {
288289
super.maybeEagerlyResolve(cpi, bytecode);
289290
} catch (UnresolvedElementException e) {
@@ -294,12 +295,19 @@ protected void maybeEagerlyResolve(int cpi, int bytecode) {
294295
* ConstantPool.lookupType() which should return an UnresolvedJavaType which we
295296
* know how to deal with.
296297
*/
298+
lastUnresolvedElementException = e;
297299
} else {
298300
throw e;
299301
}
300302
}
301303
}
302304

305+
/**
306+
* The type resolution error, if any, encountered in the last call to
307+
* {@link #maybeEagerlyResolve}.
308+
*/
309+
UnresolvedElementException lastUnresolvedElementException;
310+
303311
@Override
304312
protected JavaType maybeEagerlyResolve(JavaType type, ResolvedJavaType accessingClass) {
305313
try {
@@ -594,7 +602,7 @@ private static Class<?>[] signatureToClasses(JavaMethod method) {
594602
}
595603

596604
private void reportUnresolvedElement(String elementKind, String elementAsString) {
597-
reportUnresolvedElement(elementKind, elementAsString, null);
605+
reportUnresolvedElement(elementKind, elementAsString, lastUnresolvedElementException);
598606
}
599607

600608
private void reportUnresolvedElement(String elementKind, String elementAsString, Throwable cause) {

0 commit comments

Comments
 (0)