Skip to content

Detect dependency cycles formed through Import-Package - #2408

Merged
vogella merged 1 commit into
eclipse-pde:masterfrom
vogella:import-package-dependencies
Aug 10, 2026
Merged

Detect dependency cycles formed through Import-Package#2408
vogella merged 1 commit into
eclipse-pde:masterfrom
vogella:import-package-dependencies

Conversation

@vogella

@vogella vogella commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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, while getRequiredBundles() 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.core instead of the reactor build (visible in target/work/configuration/config.ini), regardless of -pl, -am or the javac profile, 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.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

Test Results

  129 files  +    4    129 suites  +4   39m 27s ⏱️ + 8m 14s
3 534 tests +    3  3 480 ✅ +    4   54 💤 ± 0  0 ❌  - 1 
9 405 runs  +2 148  9 275 ✅ +2 125  130 💤 +24  0 ❌  - 1 

Results for commit 730ea18. ± Comparison against base commit f6968e0.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the import-package-dependencies branch 5 times, most recently from 50f07cf to 3b119b8 Compare August 8, 2026 04:37
@vogella
vogella marked this pull request as ready for review August 9, 2026 07:30
@vogella
vogella requested a lite review from Copilot August 10, 2026 05:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IPluginBase imports lazily for models backed by BundleDescription, recomputing once after the resolver state becomes resolved.
  • Add regression tests covering cycles formed via Export-Package/Import-Package and 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.

Comment thread ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginBase.java Outdated
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
vogella force-pushed the import-package-dependencies branch from 3b119b8 to 730ea18 Compare August 10, 2026 06:11
@vogella
vogella merged commit 4454bcd into eclipse-pde:master Aug 10, 2026
19 checks passed
@vogella
vogella deleted the import-package-dependencies branch August 10, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants