Detect dependency cycles formed through Import-Package - #2408
Merged
Conversation
vogella
force-pushed
the
import-package-dependencies
branch
5 times, most recently
from
August 8, 2026 04:37
50f07cf to
3b119b8
Compare
vogella
marked this pull request as ready for review
August 9, 2026 07:30
There was a problem hiding this comment.
Pull request overview
This PR fixes dependency-cycle detection in PDE by ensuring dependencies derived from Import-Package wiring are not silently dropped when plug-in models are created before the target platform State is resolved. The change makes imports derived from a BundleDescription computed lazily so the MANIFEST.MF editor’s “Look for cycles in the dependency graph” can detect cycles that close via package wiring.
Changes:
- Compute
IPluginBaseimports lazily for models backed byBundleDescription, recomputing once after the resolver state becomes resolved. - Add regression tests covering cycles formed via
Export-Package/Import-Packageand mixed Require-Bundle + Import-Package cycles. - Add a test to guard against false cycle reporting when an import is wired to a specific exporter.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/core/builders/DependencyLoopFinderTest.java | Adds new DependencyLoopFinder regression tests for Import-Package and mixed dependency cycles. |
| ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginBase.java | Defers computing imports that depend on resolved package wiring until the state is resolved, preventing permanently cached empty getResolvedImports() results. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The imports of a plug-in read from the state were computed while the model was loaded, which happens before the state is resolved: PDEState creates the models in its constructor and PluginModelManager resolves the state afterwards, once the workspace bundles have been added. At that point BundleDescription.getResolvedImports() is still empty, so the bundles behind the Import-Package header were dropped and the empty result was kept for the lifetime of the model. getRequiredBundles() does not need a resolved state, which is why only Require-Bundle edges survived. Compute those imports on demand instead. A result computed from an unresolved state is provisional and recomputed once the state has been resolved, after which it is kept, so early callers still see the previous result. Only models read from a BundleDescription are affected, and those are the read-only target models, so a model being edited cannot lose its imports. As a result the MANIFEST.MF editor's "Look for cycles in the dependency graph" action reports cycles that close through package wiring instead of silently ignoring them.
vogella
force-pushed
the
import-package-dependencies
branch
from
August 10, 2026 06:11
3b119b8 to
730ea18
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The imports of a plug-in read from the state were computed while the model was loaded, which happens before the state is resolved: PDEState creates the models in its constructor and PluginModelManager resolves the state afterwards, once the workspace bundles have been added. At that point
BundleDescription.getResolvedImports()is still empty, so the bundles behind the Import-Package header were dropped and that empty result was kept for the lifetime of the model, whilegetRequiredBundles()needs no resolved state and kept working. As a result the MANIFEST.MF editor's "Look for cycles in the dependency graph" action silently ignored every cycle that closes through package wiring.Those imports are now computed on demand: a result computed from an unresolved state is provisional and recomputed once the state has been resolved, after which it is kept, so early callers still see the previous result. Only models read from a BundleDescription are affected and those are the read-only target models, so a model being edited cannot lose its imports.
Draft because I could not verify it locally: the test harness here installs the released
org.eclipse.pde.coreinstead of the reactor build (visible intarget/work/configuration/config.ini), regardless of-pl,-amor thejavacprofile, so local results say nothing about a change in that bundle. The three added tests are expected to fail without this change and pass with it, and I would like CI to confirm that. Stacked on #2405 and #2406, so it shows their commits until those are merged.