From 02578f4ca3accb0aae71179e61835be30031dfe9 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Fri, 14 Nov 2025 11:21:19 +0000 Subject: [PATCH] Enhance stack trace information for rule conflicts in BuildManager Fixes #2278 When a builder attempts to begin or end a scheduling rule that doesn't match the outer scope rule, the error message now includes: - Builder name and label - Builder class name - Plugin ID - Project name - The conflicting rule This makes it much easier to identify which builder is causing the rule mismatch, especially in complex build scenarios with multiple builders. The enhancement catches IllegalArgumentException at the point where beginRule() and endRule() are called in BuildManager.basicBuild() and wraps it with detailed context before re-throwing. --- .../core/internal/events/BuildManager.java | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/events/BuildManager.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/events/BuildManager.java index 11db4470a65..10c628ee733 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/events/BuildManager.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/events/BuildManager.java @@ -288,7 +288,29 @@ private void basicBuild(int trigger, IncrementalProjectBuilder builder, Map", //$NON-NLS-1$ + builderClass, + pluginId != null ? pluginId : "", //$NON-NLS-1$ + projectName, + rule, + e.getMessage() + ); + + throw new IllegalArgumentException(enhancedMessage, e); + } // Now that we've acquired the rule, changes may have been made concurrently, ensure we're pointing at the // correct currentTree so delta contains concurrent changes made in areas guarded by the scheduling rule if (currentTree != null) { @@ -303,7 +325,29 @@ private void basicBuild(int trigger, IncrementalProjectBuilder builder, Map", //$NON-NLS-1$ + builderClass, + pluginId != null ? pluginId : "", //$NON-NLS-1$ + projectName, + rule, + e.getMessage() + ); + + throw new IllegalArgumentException(enhancedMessage, e); + } } // Be sure to clean up after ourselves. if (clean || currentBuilder.wasForgetStateRequested()) {