Skip to content

Commit

Permalink
BinaryTypeBinding: enrich RuntimeException with filename
Browse files Browse the repository at this point in the history
During internal errors it is not clear which file did contain the
problematic binary. For example:

#3516

Example output will be like: "java.lang.RuntimeException:
RuntimeException loading =P/libGh375.jar|TestGh375.class"
  • Loading branch information
jukzi committed Jan 9, 2025
1 parent c77e693 commit 2c5a057
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,17 @@ public MethodBinding[] availableMethods() {
return availableMethods;
}

void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
final void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
try {
cachePartsFrom2(binaryType, needFieldsAndMethods);
} catch (AbortCompilation e) {
throw e;
} catch (RuntimeException e) {
throw new RuntimeException("RuntimeException loading " + new String(binaryType.getFileName()), e); //$NON-NLS-1$
}
}

private void cachePartsFrom2(IBinaryType binaryType, boolean needFieldsAndMethods) {
if (!isPrototype()) throw new IllegalStateException();
ReferenceBinding previousRequester = this.environment.requestingType;
this.environment.requestingType = this;
Expand Down

0 comments on commit 2c5a057

Please sign in to comment.