Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-04-17 16:35:20 +0000
committerThomas Watson2014-04-17 16:35:20 +0000
commitd50939980ee9c5b4fc82a2f85d70bb1fa44a707a (patch)
tree480223f364d1d9b2193a95efda38215cc5f409ad
parent660c78161150f4fe6ed6c11469d9e225b7fab6ec (diff)
downloadrt.equinox.framework-d50939980ee9c5b4fc82a2f85d70bb1fa44a707a.tar.gz
rt.equinox.framework-d50939980ee9c5b4fc82a2f85d70bb1fa44a707a.tar.xz
rt.equinox.framework-d50939980ee9c5b4fc82a2f85d70bb1fa44a707a.zip
Bug 433023 - Resolver does not allow optional reqs to resolve if they introduce class space inconsistenciesI20140422-0800
- fixed by clearing candidates if an optional req
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/Candidates.java5
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java18
2 files changed, 20 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/Candidates.java b/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/Candidates.java
index 366605b8d..b5429eb3a 100644
--- a/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/Candidates.java
+++ b/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/Candidates.java
@@ -746,6 +746,11 @@ class Candidates
return m_candidateMap.get(req);
}
+ public void clearCandidates(Requirement req)
+ {
+ m_candidateMap.remove(req);
+ }
+
/**
* Merges fragments into their hosts. It does this by wrapping all host
* modules and attaching their selected fragments, removing all unselected
diff --git a/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java b/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java
index d0e396751..d6d3910fe 100644
--- a/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/container/src/org/apache/felix/resolver/ResolverImpl.java
@@ -1237,11 +1237,15 @@ public class ResolverImpl implements Resolver
// requirement; there may be no candidates if the resource
// associated with the requirement is already resolved.
List<Capability> candidates = permutation.getCandidates(req);
- if ((candidates != null) && (candidates.size() > 1))
+ if ((candidates != null) && (candidates.size() > 1 || Util.isOptional(req)))
{
mutated.add(req);
// Remove the conflicting candidate.
candidates.remove(0);
+ if (candidates.isEmpty())
+ {
+ permutation.clearCandidates(req);
+ }
// Continue with the next uses constraint.
break;
}
@@ -1346,11 +1350,15 @@ public class ResolverImpl implements Resolver
// requirement; there may be no candidates if the resource
// associated with the requirement is already resolved.
List<Capability> candidates = permutation.getCandidates(req);
- if ((candidates != null) && (candidates.size() > 1))
+ if ((candidates != null) && (candidates.size() > 1 || Util.isOptional(req)))
{
mutated.add(req);
// Remove the conflicting candidate.
candidates.remove(0);
+ if (candidates.isEmpty())
+ {
+ permutation.clearCandidates(req);
+ }
// Continue with the next uses constraint.
break;
}
@@ -1470,11 +1478,15 @@ public class ResolverImpl implements Resolver
if (!Util.isMultiple(req))
{
List<Capability> candidates = allCandidates.getCandidates(req);
- if ((candidates != null) && (candidates.size() > 1))
+ if ((candidates != null) && (candidates.size() > 1 || Util.isOptional(req)))
{
Candidates perm = allCandidates.copy();
candidates = perm.getCandidates(req);
candidates.remove(0);
+ if (candidates.isEmpty())
+ {
+ perm.clearCandidates(req);
+ }
permutations.add(perm);
}
}

Back to the top