Skip to content

Commit

Permalink
Fix DependencyComputer missing bundles when they have different versions
Browse files Browse the repository at this point in the history
Currently the DependencyComputer sorts only by bundle name (even though
the comment for the code mentions the version as well) this can lead to
the situation that if a bundle requires the same bundle in different
versions (e.g. because it has actually different package names like
javax -> jakarta) it only gets one of both on the classpath even though
the P2 input suggests both.

This simply enhances the used key in the mak with the version as already
suggested by the java comment.
  • Loading branch information
laeubi committed Sep 19, 2023
1 parent 234f4f9 commit 1500f0c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public String getSymbolicName() {
public Version getVersion() {
return getRevision().getVersion();
}

@Override
public String toString() {
return "DependencyEntry [module=" + module + ", rules=" + rules + "]";
}
}

private final class VisiblePackages {
Expand Down Expand Up @@ -182,7 +187,7 @@ public List<DependencyEntry> computeDependencies(ModuleRevision module) {
// sort by symbolicName_version to get a consistent order
Map<String, BundleRevision> resolvedImportPackages = new TreeMap<>();
for (BundleRevision bundle : visiblePackages.getParticipatingModules()) {
resolvedImportPackages.put(bundle.getSymbolicName(), bundle);
resolvedImportPackages.put(bundle.getSymbolicName() + "_" + bundle.getVersion(), bundle);
}
for (BundleRevision bundle : resolvedImportPackages.values()) {
addDependencyViaImportPackage(bundle, added, visiblePackages, entries);
Expand Down

0 comments on commit 1500f0c

Please sign in to comment.