From c7cf381c0c39a6c418ff0f40bea08994959c0f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 7 Jan 2025 08:28:19 +0100 Subject: [PATCH] MatchLocator: enrich RuntimeException with filename During internal errors it is not clear which file did contain the problematic binary. For example: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/3516 Example output will be like: "java.lang.RuntimeException: RuntimeException caching =P/libGh375.jar|TestGh375.class" --- .../internal/core/search/matching/MatchLocator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java index 1bd7e0df46a..b67d80a5b47 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java @@ -448,7 +448,15 @@ protected BinaryTypeBinding cacheBinaryType(IType type, IBinaryType binaryType) } } } - BinaryTypeBinding binding = this.lookupEnvironment.cacheBinaryType(binaryType, null /*no access restriction*/); + BinaryTypeBinding binding; + try { + binding = this.lookupEnvironment.cacheBinaryType(binaryType, null /*no access restriction*/); + } catch (AbortCompilation e) { + throw e; + } catch (RuntimeException e) { + throw new RuntimeException("RuntimeException caching " + new String(binaryType.getFileName()), e); //$NON-NLS-1$ + } + if (binding == null) { // it was already cached as a result of a previous query char[][] compoundName = CharOperation.splitOn('.', type.getFullyQualifiedName().toCharArray()); ReferenceBinding referenceBinding = this.lookupEnvironment.getCachedType(compoundName);