Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 30820 Details for
Bug 118520
Problem with resolver resolution algorithm
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Possible fix
118520_org.eclipse.osgi.patch (text/plain), 7.37 KB, created by
Thomas Watson
on 2005-11-29 19:20:59 EST
(
hide
)
Description:
Possible fix
Filename:
MIME Type:
Creator:
Thomas Watson
Created:
2005-11-29 19:20:59 EST
Size:
7.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.osgi >Index: resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java,v >retrieving revision 1.16 >diff -u -r1.16 ResolverBundle.java >--- resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java 7 Nov 2005 17:07:06 -0000 1.16 >+++ resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java 30 Nov 2005 00:13:58 -0000 >@@ -39,6 +39,7 @@ > > private ResolverImpl resolver; > private boolean newFragmentExports; >+ private ArrayList refs; > > ResolverBundle(BundleDescription bundle, ResolverImpl resolver) { > super(bundle); >@@ -48,6 +49,8 @@ > } > > void initialize(boolean useSelectedExports) { >+ if (getBundle().isSingleton()) >+ refs = new ArrayList(); > if (getBundle().getHost() != null) { > host = new BundleConstraint(this, getBundle().getHost()); > exports = new ResolverExport[0]; >@@ -440,4 +443,16 @@ > ResolverImpl getResolver() { > return resolver; > } >+ >+ void clearRefs() { >+ if (refs != null) >+ refs.clear(); >+ } >+ void addRef(ResolverBundle ref) { >+ if (refs != null && !refs.contains(ref)) >+ refs.add(ref); >+ } >+ int getRefs() { >+ return refs == null ? 0 : refs.size(); >+ } > } >Index: resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java,v >retrieving revision 1.28 >diff -u -r1.28 ResolverImpl.java >--- resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java 15 Nov 2005 20:31:56 -0000 1.28 >+++ resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java 30 Nov 2005 00:13:58 -0000 >@@ -285,8 +285,10 @@ > BundleConstraint hostConstraint = bundle.getHost(); > Object[] hosts = resolverBundles.get(hostConstraint.getVersionConstraint().getName()); > for (int i = 0; i < hosts.length; i++) >- if (((ResolverBundle) hosts[i]).isResolvable() && hostConstraint.isSatisfiedBy((ResolverBundle) hosts[i])) >+ if (((ResolverBundle) hosts[i]).isResolvable() && hostConstraint.isSatisfiedBy((ResolverBundle) hosts[i])) { >+ ((ResolverBundle) hosts[i]).addRef(bundle); > resolverExports.put(((ResolverBundle) hosts[i]).attachFragment(bundle, true)); >+ } > } > > public synchronized void resolve(BundleDescription[] reRefresh, Dictionary[] platformProperties) { >@@ -344,6 +346,7 @@ > for (int i = 0; i < bundles.length; i++) { > state.removeResolverErrors(bundles[i].getBundle()); > bundles[i].setResolvable(isResolvable(bundles[i].getBundle(), platformProperties, rejectedSingletons)); >+ bundles[i].clearRefs(); > groupingChecker.removeAllExportConstraints(bundles[i]); > } > >@@ -426,13 +429,13 @@ > continue; > Object[] sameName = resolverBundles.get(bundleDesc.getName()); > if (sameName.length > 1) { // Need to make a selection based off of num dependents >- int numDeps = bundleDesc.getDependents().length; > for (int j = 0; j < sameName.length; j++) { > BundleDescription sameNameDesc = ((VersionSupplier) sameName[j]).getBundle(); >+ ResolverBundle sameNameBundle = (ResolverBundle) sameName[j]; > if (sameName[j] == bundles[i] || !sameNameDesc.isSingleton() || !sameNameDesc.isResolved() || rejectedSingletons.contains(sameNameDesc)) > continue; // Ignore the bundle we are selecting, non-singletons, and non-resolved > result = true; >- if (sameNameDesc.getVersion().compareTo(bundleDesc.getVersion()) > 0 && (sameNameDesc.getDependents().length > 0 || numDeps == 0)) { >+ if (sameNameDesc.getVersion().compareTo(bundleDesc.getVersion()) > 0 && sameNameBundle.getRefs() >= bundles[i].getRefs()) { > // this bundle is not selected; add it to the rejected list > if (!rejectedSingletons.contains(bundles[i].getBundle())) > rejectedSingletons.add(bundles[i].getBundle()); >@@ -554,15 +557,21 @@ > return true; // Already wired (due to grouping dependencies) so just return > } > Object[] bundles = resolverBundles.get(req.getVersionConstraint().getName()); >+ boolean result = false; > for (int i = 0; i < bundles.length; i++) { > ResolverBundle bundle = (ResolverBundle) bundles[i]; > if (DEBUG_REQUIRES) > ResolverImpl.log("CHECKING: " + bundle.getBundle()); //$NON-NLS-1$ > // Check if export matches > if (req.isSatisfiedBy(bundle)) { >+ bundle.addRef(req.getBundle()); >+ if (result) >+ continue; > req.setMatchingBundle(bundle); // Wire to the bundle >- if (req.getBundle() == bundle) >- return true; // Wired to ourselves >+ if (req.getBundle() == bundle) { >+ result = true; // Wired to ourselves >+ continue; >+ } > if ((bundle.getState() != ResolverBundle.RESOLVED && !resolveBundle(bundle, cycle))) { > req.setMatchingBundle(null); > continue; // Bundle hasn't resolved >@@ -574,10 +583,10 @@ > cycle.add(req.getBundle()); > if (DEBUG_REQUIRES) > ResolverImpl.log("Found match: " + bundle.getBundle() + ". Wiring"); //$NON-NLS-1$ //$NON-NLS-2$ >- return checkRequiresConstraints(req, req.getMatchingBundle()); >+ result = checkRequiresConstraints(req, req.getMatchingBundle()); > } > } >- if (req.isOptional()) >+ if (result || req.isOptional()) > return true; // If the req is optional then just return true > > return false; >@@ -605,6 +614,7 @@ > ResolverImpl.log(" - already wired"); //$NON-NLS-1$ > return true; // Already wired (due to grouping dependencies) so just return > } >+ boolean result = false; > Object[] exports = resolverExports.get(imp.getName()); > exportsloop: for (int i = 0; i < exports.length; i++) { > ResolverExport export = (ResolverExport) exports[i]; >@@ -614,9 +624,12 @@ > if (imp.isSatisfiedBy(export) && imp.isNotAnUnresolvableWiring(export)) { > int originalState = export.getExporter().getState(); > if (imp.isDynamic() && originalState != ResolverBundle.RESOLVED) >- return false; // Must not attempt to resolve an exporter when dynamic >+ continue; // Must not attempt to resolve an exporter when dynamic > if (imp.getBundle() == export.getExporter() && !export.getExportPackageDescription().isRoot()) > continue; // Can't wire to our own re-export >+ export.getExporter().addRef(imp.getBundle()); >+ if (result) >+ continue; > imp.setMatchingExport(export); // Wire the import to the export > if (imp.getBundle() != export.getExporter()) { > ResolverExport[] exps = imp.getBundle().getExports(imp.getName()); >@@ -651,7 +664,7 @@ > } > if (DEBUG_IMPORTS) > ResolverImpl.log("Found match: " + export.getExporter() + ". Wiring " + imp.getBundle() + ":" + imp.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- return true; >+ result = true; > } else if (!imp.getBundle().isResolvable()) { > // If grouping has caused recursive calls to resolveImport, and the grouping has failed > // then we need to catch that here, so we don't continue trying to wire here >@@ -661,6 +674,8 @@ > return true; // Grouping has changed the wiring, so return here > } > } >+ if (result) >+ return true; > if (checkReexportsFromRequires && resolveImportReprovide(imp, cycle)) > return true; // A reprovide satisfies imp > if (imp.isOptional())
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 118520
:
30812
|
30820
|
30904