Some resolver cleanup. (FELIX-2950)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1153233 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
index 57b974a..484bec2 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
@@ -478,9 +478,6 @@
         BundleRequirement req, SortedSet<BundleCapability> candidates)
     {
         // Add the dynamic imports candidates.
-// TODO: OSGi R4.3 - Can we just calculate the candidates inside here too?
-//       I think we don't because of performance reasons since we have to
-//       look them up already. If so, maybe it is not worth doing it here.
         add(req, candidates);
 
         // Populate the candidates for the dynamic import.
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
index 9cad608..cb2e751 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
@@ -212,9 +212,8 @@
                 for (Iterator<BundleRevision> it = revisions.iterator(); it.hasNext(); )
                 {
                     BundleRevision br = it.next();
-// TODO: OSGi R4.3 - This is not correct for fragments, since they may have wires already
-//       but we still need to resolve them.
-                    if ((br.getWiring() != null) || !allCandidates.populate(state, br, false))
+                    if ((!Util.isFragment(br) && br.getWiring() != null)
+                        || !allCandidates.populate(state, br, false))
                     {
                         it.remove();
                     }
@@ -230,14 +229,14 @@
                 allCandidates.prepare(getResolvedSingletons(state));
 
                 // Prune failed revisions.
-// TODO: OSGi R4.3 - Again, can we merge this stuff into Candidates?
-//                for (Iterator<BundleRevision> it = revisions.iterator(); it.hasNext(); )
-//                {
-//                    if (!allCandidates.isPopulated(it.next()))
-//                    {
-//                        it.remove();
-//                    }
-//                }
+// TODO: OSGi R4.3 - Could this be merged back into Candidates?
+                for (Iterator<BundleRevision> it = revisions.iterator(); it.hasNext(); )
+                {
+                    if (!allCandidates.isPopulated(it.next()))
+                    {
+                        it.remove();
+                    }
+                }
 
                 // Record the initial candidate permutation.
                 m_usesPermutations.add(allCandidates);