Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2016-12-15 21:29:12 +0000
committerThomas Watson2016-12-15 21:29:12 +0000
commit58531484f1d8f944df8180960854d870524fd94b (patch)
tree6a3bd5dc556a70e0641024d0ddcd25cebbc7daaa /bundles/org.eclipse.osgi/felix/src
parent0d254aa5f9c7a1a3fdb2d4fd78bcbc8a197c4f8b (diff)
downloadrt.equinox.framework-58531484f1d8f944df8180960854d870524fd94b.tar.gz
rt.equinox.framework-58531484f1d8f944df8180960854d870524fd94b.tar.xz
rt.equinox.framework-58531484f1d8f944df8180960854d870524fd94b.zip
Bug 509318 - Update resolver implementation to latest from apache
Change-Id: I6898a735b29127d71d1ba285106062315f978f88 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.osgi/felix/src')
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java46
-rwxr-xr-xbundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java17
2 files changed, 29 insertions, 34 deletions
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
index 1afed36c3..29b2b7b10 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/Candidates.java
@@ -834,6 +834,30 @@ class Candidates
}
// Step 4
+ // First copy candidates for wrapped requirements to the host.
+ for (WrappedResource hostResource : hostResources) {
+ for (Requirement r : hostResource.getRequirements(null))
+ {
+ Requirement origReq = ((WrappedRequirement) r).getDeclaredRequirement();
+ CandidateSelector cands = m_candidateMap.get(origReq);
+ if (cands != null)
+ {
+ if (cands instanceof ShadowList)
+ {
+ m_candidateMap.put(r, ShadowList.deepCopy((ShadowList) cands));
+ } else {
+ m_candidateMap.put(r, cands.copy());
+ }
+ for (Capability cand : cands.getRemainingCandidates())
+ {
+ Set<Requirement> dependents = m_dependentMap.get(cand);
+ dependents.remove(origReq);
+ dependents.add(r);
+ }
+ }
+ }
+ }
+
for (WrappedResource hostResource : hostResources)
{
// Replaces capabilities from fragments with the capabilities
@@ -918,28 +942,6 @@ class Candidates
}
}
}
-
- // Copy candidates for fragment requirements to the host.
- for (Requirement r : hostResource.getRequirements(null))
- {
- Requirement origReq = ((WrappedRequirement) r).getDeclaredRequirement();
- CandidateSelector cands = m_candidateMap.get(origReq);
- if (cands != null)
- {
- if (cands instanceof ShadowList)
- {
- m_candidateMap.put(r, ShadowList.deepCopy((ShadowList) cands));
- } else {
- m_candidateMap.put(r, cands.copy());
- }
- for (Capability cand : cands.getRemainingCandidates())
- {
- Set<Requirement> dependents = m_dependentMap.get(cand);
- dependents.remove(origReq);
- dependents.add(r);
- }
- }
- }
}
// Lastly, verify that all mandatory revisions are still
diff --git a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java
index f69025fdc..a91ba30ee 100755
--- a/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java
+++ b/bundles/org.eclipse.osgi/felix/src/org/apache/felix/resolver/util/ShadowList.java
@@ -27,36 +27,29 @@ import org.osgi.service.resolver.ResolveContext;
public class ShadowList extends CandidateSelector
{
- public static ShadowList createShadowList(CandidateSelector original) {
+ public static ShadowList createShadowList(CandidateSelector original) {
if (original instanceof ShadowList)
{
throw new IllegalArgumentException("Cannot create a ShadowList using another ShadowList.");
}
- return new ShadowList(original);
+ return new ShadowList(original.unmodifiable, original.unmodifiable, original.isUnmodifiable);
}
public static ShadowList deepCopy(ShadowList original) {
- List<Capability> originalCopy = new ArrayList<Capability>(original.m_original);
- return new ShadowList(original.unmodifiable, originalCopy, original.isUnmodifiable);
+ return new ShadowList(original.unmodifiable, original.m_original, original.isUnmodifiable);
}
private final List<Capability> m_original;
- private ShadowList(CandidateSelector original)
- {
- super(original);
- m_original = new ArrayList<Capability>(original.getRemainingCandidates());
- }
-
private ShadowList(CandidateSelector shadow, List<Capability> original)
{
super(shadow);
m_original = original;
}
- public ShadowList(List<Capability> unmodifiable, List<Capability> originalCopy, AtomicBoolean isUnmodifiable) {
+ private ShadowList(List<Capability> unmodifiable, List<Capability> original, AtomicBoolean isUnmodifiable) {
super(unmodifiable, isUnmodifiable);
- m_original = originalCopy;
+ m_original = new ArrayList<Capability>(original);
}
public ShadowList copy() {

Back to the top