From c378ac59ab484827cbb3fe2198e253c16b00a60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Sat, 29 Jun 2024 07:54:41 +0200 Subject: [PATCH] Show threads involved in disposing of components Currently we show where the component was disposed but not by what thread. As this can be interesting for debugging the cause, this information is now added. --- .../pde/api/tools/internal/model/BundleComponent.java | 7 +++++-- .../pde/api/tools/internal/model/Messages.properties | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java index 56a0b06467..910934e17c 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/BundleComponent.java @@ -200,7 +200,8 @@ public void dispose() { synchronized (this) { fManifest = null; fBundleDescription = null; - disposeSource = new RuntimeException("Component was disposed here"); //$NON-NLS-1$ + String message = String.format("Component was disposed here [%s]", Thread.currentThread().getName()); //$NON-NLS-1$ + disposeSource = new RuntimeException(message); } } } @@ -1202,7 +1203,9 @@ public ResolverError[] getErrors() throws CoreException { */ protected void baselineDisposed(IApiBaseline baseline) throws CoreException { throw new CoreException(new Status(IStatus.ERROR, ApiPlugin.PLUGIN_ID, ApiPlugin.REPORT_BASELINE_IS_DISPOSED, - NLS.bind(Messages.BundleApiComponent_baseline_disposed, getName(), baseline.getName()), disposeSource)); + NLS.bind(Messages.BundleApiComponent_baseline_disposed, + new Object[] { getName(), baseline.getName(), Thread.currentThread().getName() }), + disposeSource)); } /* diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/Messages.properties b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/Messages.properties index 2d54b7dd31..85aaeff8b8 100644 --- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/Messages.properties +++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/model/Messages.properties @@ -16,7 +16,7 @@ ApiType_1=Unable to resolve superclass {0} for {1} ApiType_2=Unsupported operation - API component required for resolution ApiType_3=Unable to resolve member type {0} for {1} ApiScope_0=Unable to visit this element type: {0} -BundleApiComponent_baseline_disposed=Component ''{0}'' in the baseline ''{1}'' is disposed +BundleApiComponent_baseline_disposed=Component ''{0}'' in the baseline ''{1}'' is disposed [{2}] BundleComponent_failed_to_lookup_fragment=Failed to look up resolved fragment: {0} configuring_baseline=Configuring baseline resolving_target_definition=resolving target definition...