You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2010/12/22 15:52:32 UTC

svn commit: r1051929 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java

Author: rickhall
Date: Wed Dec 22 14:52:31 2010
New Revision: 1051929

URL: http://svn.apache.org/viewvc?rev=1051929&view=rev
Log:
Modified resolver to re-verify package space consistency for bundles performing
a dynamic import. (FELIX-2736)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java?rev=1051929&r1=1051928&r2=1051929&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java Wed Dec 22 14:52:31 2010
@@ -97,7 +97,7 @@ public class ResolverImpl implements Res
                     try
                     {
                         checkPackageSpaceConsistency(
-                            module, candidateMap, modulePkgMap, new HashMap());
+                            false, module, candidateMap, modulePkgMap, new HashMap());
                     }
                     catch (ResolveException ex)
                     {
@@ -174,7 +174,7 @@ public class ResolverImpl implements Res
                     try
                     {
                         checkPackageSpaceConsistency(
-                            module, candidateMap, modulePkgMap, new HashMap());
+                            true, module, candidateMap, modulePkgMap, new HashMap());
                     }
                     catch (ResolveException ex)
                     {
@@ -590,11 +590,11 @@ public class ResolverImpl implements Res
             }
         }
 
-        // First, add all exported packages to our package space.
+        // First, add all exported packages to the target module's package space.
         calculateExportedPackages(module, candidateMap, modulePkgMap);
         Packages modulePkgs = modulePkgMap.get(module);
 
-        // Second, add all imported packages to our candidate space.
+        // Second, add all imported packages to the target module's package space.
         for (int i = 0; i < reqs.size(); i++)
         {
             Requirement req = reqs.get(i);
@@ -603,7 +603,7 @@ public class ResolverImpl implements Res
             mergeCandidatePackages(module, req, cap, modulePkgMap, candidateMap);
         }
 
-        // Third, ask our candidates to calculate their package spaces.
+        // Third, have all candidates to calculate their package spaces.
         for (int i = 0; i < caps.size(); i++)
         {
             calculatePackageSpaces(
@@ -611,8 +611,9 @@ public class ResolverImpl implements Res
                 usesCycleMap, cycle);
         }
 
-        // Fourth, add all of the uses constraints implied by our imported
-        // and required packages.
+        // Fourth, if the target module is unresolved or is dynamically importing,
+        // then add all the uses constraints implied by its imported and required
+        // packages to its package space.
         for (Entry<String, List<Blame>> entry : modulePkgs.m_importedPkgs.entrySet())
         {
             for (Blame blame : entry.getValue())
@@ -834,14 +835,16 @@ public class ResolverImpl implements Res
     }
 
     private void checkPackageSpaceConsistency(
-        Module module, Map<Requirement, Set<Capability>> candidateMap,
-        Map<Module, Packages> modulePkgMap, Map<Module, Object> resultCache)
+        boolean isDynamicImport, Module module,
+        Map<Requirement, Set<Capability>> candidateMap,
+        Map<Module, Packages> modulePkgMap,
+        Map<Module, Object> resultCache)
     {
-        if (module.isResolved())
+        if (module.isResolved() && !isDynamicImport)
         {
             return;
         }
-        else if (resultCache.containsKey(module))
+        else if(resultCache.containsKey(module))
         {
             return;
         }
@@ -1081,8 +1084,8 @@ public class ResolverImpl implements Res
                     try
                     {
                         checkPackageSpaceConsistency(
-                            importBlame.m_cap.getModule(), candidateMap, modulePkgMap,
-                            resultCache);
+                            false, importBlame.m_cap.getModule(), candidateMap,
+                            modulePkgMap, resultCache);
                     }
                     catch (ResolveException ex)
                     {