More code cleanup. (FELIX-2035)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@944022 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
index b646b2d..1c669fd 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -312,9 +312,6 @@
 
         try
         {
-// TODO: EXTENSIONMANAGER - Should we be setting this?
-//            bundle.setExtension(true);
-
             // Merge the exported packages with the exported packages of the systembundle.
             List<Capability> exports = null;
             try
@@ -355,8 +352,6 @@
         }
         catch (Exception ex)
         {
-// TODO: EXTENSIONMANAGER - Should we be setting this?
-//            bundle.setExtension(false);
             throw ex;
         }
 
@@ -380,11 +375,12 @@
         {
             try
             {
+// TODO: SECURITY - Should this consider security?
                 BundleActivator activator = (BundleActivator)
                     felix.getClass().getClassLoader().loadClass(
                         activatorClass.trim()).newInstance();
 
-// TODO: KARL - This is kind of hacky, can we improve it?
+// TODO: EXTENSIONMANAGER - This is kind of hacky, can we improve it?
                 felix.m_activatorList.add(activator);
 
                 BundleContext context = felix._getBundleContext();
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 3659b9f..b37e74b 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -2791,15 +2791,7 @@
         // Acquire bundle lock.
         try
         {
-            if (bundle.isExtension())
-            {
-// TODO: EXTENSIONMANAGER - Verify this.
-                acquireBundleLock(bundle, Bundle.RESOLVED | Bundle.STARTING | Bundle.ACTIVE);
-            }
-            else
-            {
-                acquireBundleLock(bundle, Bundle.STARTING | Bundle.ACTIVE);
-            }
+            acquireBundleLock(bundle, Bundle.STARTING | Bundle.ACTIVE);
         }
         catch (IllegalStateException ex)
         {
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java b/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
index 5cc9ed2..9ce4c31 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/CandidateComparator.java
@@ -43,7 +43,7 @@
             c = 1;
         }
 
-        // Next compare version numbers.
+        // Compare module capabilities.
         if ((c == 0) && cap1.getNamespace().equals(Capability.MODULE_NAMESPACE))
         {
             c = ((Comparable) cap1.getAttribute(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
@@ -62,10 +62,8 @@
                 c = v2.compareTo(v1);
             }
         }
-// TODO: FELIX3 - Need to change this to handle arbitrary capabilities
-//       that may not have a natural ordering.
-        // Assume everything else is a package capability.
-        else if (c == 0)
+        // Compare package capabilities.
+        else if ((c == 0) && cap1.getNamespace().equals(Capability.PACKAGE_NAMESPACE))
         {
             c = ((Comparable) cap1.getAttribute(Capability.PACKAGE_ATTR).getValue())
                 .compareTo(cap2.getAttribute(Capability.PACKAGE_ATTR).getValue());
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 62cd70c..b167c67 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
@@ -232,7 +232,8 @@
         return null;
     }
 
-// TODO: FELIX3 - It would be nice to make this private.
+// TODO: FELIX3 - It would be nice to make this private. We will likely have
+//       to duplicate some of its code if we put the resolve in a separate module.
     public static Map<Requirement, Set<Capability>> getDynamicImportCandidates(
         ResolverState state, Module module, String pkgName)
     {
@@ -530,9 +531,6 @@
             }
         }
 
-// TODO: FELIX3 - Since we reuse the same dynamic requirement, is it possible
-//       that some sort of cycle could cause us to try to match another set
-//       of candidates to the same requirement?
         if (candidates.size() == 0)
         {
             candidateMap.remove(dynReq);
@@ -707,7 +705,7 @@
             // We have to merge all exported packages from the candidate,
             // since the current module requires it.
 // TODO: FELIX3 - If a module imports its exports, then imported exports should
-//       should be reexported to requiring bundle.
+//       be reexported to requiring bundles.
             for (Entry<String, Blame> entry : candPkgs.m_exportedPkgs.entrySet())
             {
                 mergeCandidatePackage(
@@ -1010,8 +1008,7 @@
                     mutated = (mutated != null)
                         ? mutated
                         : new HashSet();
-// TODO: FELIX3 - I think we need to walk up this chain too.
-// TODO: FELIX3 - What about uses and import permutations?
+// TODO: FELIX3 - I think we need to walk up the uses chain too.
                     Requirement req = blame.m_reqs.get(blame.m_reqs.size() - 1);
                     if (!mutated.contains(req))
                     {
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java b/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
index 8e36f3b..a52ce7a 100755
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/WireImpl.java
@@ -94,7 +94,6 @@
             // to the exporting module, rather than its content, so it can
             // it can follow any internal wires it may have (e.g., if the
             // package has multiple sources).
-// TODO: FELIX3 - Should isIncluded() be part of Capability?
             if (((CapabilityImpl) m_cap).isIncluded(name))
             {
                 clazz = m_exporter.getClassByDelegation(name);