Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff McAffer2010-09-21 14:00:20 -0400
committerJeff McAffer2010-09-21 14:00:20 -0400
commit0501f653019d0481b4821b0da6e65a4c36551617 (patch)
tree59c4f2ce2599b3491e6bf519a43f136f282e653a /bundles/org.eclipse.osgi/resolver
parent082f548888d89056030814f67a367cf7286901a8 (diff)
downloadrt.equinox.framework-0501f653019d0481b4821b0da6e65a4c36551617.tar.gz
rt.equinox.framework-0501f653019d0481b4821b0da6e65a4c36551617.tar.xz
rt.equinox.framework-0501f653019d0481b4821b0da6e65a4c36551617.zip
Bug 324618 Dynamic import resolver bug backportR36x_v20101015R36x_v20101014
Diffstat (limited to 'bundles/org.eclipse.osgi/resolver')
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java48
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java4
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java4
3 files changed, 37 insertions, 19 deletions
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
index 79f9e59dc..30c59635c 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
@@ -10,6 +10,7 @@ package org.eclipse.osgi.internal.module;
import java.util.*;
import org.eclipse.osgi.service.resolver.BundleSpecification;
+import org.eclipse.osgi.service.resolver.ExportPackageDescription;
/*
* The GroupingChecker checks the 'uses' directive on exported packages for consistency
@@ -36,11 +37,16 @@ public class GroupingChecker {
isConsistentInternal(bundle, selectedSupplier, new ArrayList(1), true, null);
}
// process all imports
- ResolverImport[] imports = bundle.getImportPackages();
- for (int j = 0; j < imports.length; j++) {
- ResolverExport selectedSupplier = (ResolverExport) imports[j].getSelectedSupplier();
- if (selectedSupplier != null)
- isConsistentInternal(bundle, selectedSupplier, true, null);
+ // must check resolved imports to get any dynamically resolved imports
+ ExportPackageDescription[] imports = bundle.getBundle().getResolvedImports();
+ for (int i = 0; i < imports.length; i++) {
+ ExportPackageDescription importPkg = imports[i];
+ Object[] exports = bundle.getResolver().getResolverExports().get(importPkg.getName());
+ for (int j = 0; j < exports.length; j++) {
+ ResolverExport export = (ResolverExport) exports[j];
+ if (export.getExportPackageDescription() == importPkg)
+ isConsistentInternal(bundle, export, true, null);
+ }
}
}
@@ -137,14 +143,30 @@ public class GroupingChecker {
return null;
visited.add(bundle); // prevent endless cycles
// check imports
- ResolverImport imported = bundle.getImport(packageName);
- if (imported != null && imported.getSelectedSupplier() != null) {
- // make sure we are not resolved to our own import
- ResolverExport selectedExport = (ResolverExport) imported.getSelectedSupplier();
- if (selectedExport.getExporter() != bundle) {
- // found resolved import; get the roots from the resolved exporter;
- // this is all the roots if the package is imported
- return getPackageRoots(selectedExport.getExporter(), packageName, visited);
+ if (bundle.getBundle().isResolved()) {
+ // must check resolved imports to get any dynamically resolved imports
+ ExportPackageDescription[] imports = bundle.getBundle().getResolvedImports();
+ for (int i = 0; i < imports.length; i++) {
+ ExportPackageDescription importPkg = imports[i];
+ if (importPkg.getExporter() == bundle.getBundle() || !importPkg.getName().equals(packageName))
+ continue;
+ Object[] exports = bundle.getResolver().getResolverExports().get(packageName);
+ for (int j = 0; j < exports.length; j++) {
+ ResolverExport export = (ResolverExport) exports[j];
+ if (export.getExportPackageDescription() == importPkg)
+ return getPackageRoots(export.getExporter(), packageName, visited);
+ }
+ }
+ } else {
+ ResolverImport imported = bundle.getImport(packageName);
+ if (imported != null && imported.getSelectedSupplier() != null) {
+ // make sure we are not resolved to our own import
+ ResolverExport selectedExport = (ResolverExport) imported.getSelectedSupplier();
+ if (selectedExport.getExporter() != bundle) {
+ // found resolved import; get the roots from the resolved exporter;
+ // this is all the roots if the package is imported
+ return getPackageRoots(selectedExport.getExporter(), packageName, visited);
+ }
}
}
// check if the bundle exports the package
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java
index b692b1155..85acb74e1 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java
@@ -64,10 +64,6 @@ public abstract class ResolverConstraint {
// returns whether this constraint is optional
abstract boolean isOptional();
- public void setPossibleSuppliers(VersionSupplier[] possibleSuppliers) {
- this.possibleSuppliers = possibleSuppliers;
- }
-
void addPossibleSupplier(VersionSupplier supplier) {
if (supplier == null)
return;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
index 92864544b..24b650ab9 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
@@ -1578,7 +1578,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
resolverImports[j].setName(null);
if (!found) {
// not found or there was a conflict; reset the suppliers and return null
- resolverImports[j].setPossibleSuppliers(null);
+ resolverImports[j].clearPossibleSuppliers();
return null;
}
// If the import resolved then return it's matching export
@@ -1588,7 +1588,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
// If it is a wildcard import then clear the wire, so other
// exported packages can be found for it
if (importName.endsWith("*")) //$NON-NLS-1$
- resolverImports[j].setPossibleSuppliers(null);
+ resolverImports[j].clearPossibleSuppliers();
return matchingExport;
}
}

Back to the top