Author: rickhall
Date: Wed Aug 26 13:18:54 2009
New Revision: 807998

URL: http://svn.apache.org/viewvc?rev=807998&view=rev
Log:
Perform cycle check when verifying uses constraints.

Modified:
    
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java

Modified: 
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java?rev=807998&r1=807997&r2=807998&view=diff
==============================================================================
--- 
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
 (original)
+++ 
felix/sandbox/rickhall/resolver/src/main/java/org/apache/felix/resolver/prototype/ProtoResolver.java
 Wed Aug 26 13:18:54 2009
@@ -355,7 +355,7 @@
             {
                 verifyUses(targetModule, entry.getKey(),
                     candidateMap, existingConstraints, currentConstraints,
-                    new HashMap<Module, Module>());
+                    new HashMap<String, List<Module>>());
             }
         }
 
@@ -365,15 +365,16 @@
     private void verifyUses(Module targetModule, String pkgName,
         Map<ImportedPackage, List<Module>> candidateMap,
         Map<String, Blame> existingConstraints,
-        Map<String, Blame> currentConstraints, Map<Module, Module> cycleMap)
+        Map<String, Blame> currentConstraints, Map<String, List<Module>> 
cycleMap)
     {
-// TODO: PROTO RESOLVER - Without this we get into infinite loop with GF 
modules.
-//       With it, we do not resolve scenario5 correctly.
-//        if (cycleMap.containsKey(targetModule))
-//        {
-//            return;
-//        }
-//        cycleMap.put(targetModule, targetModule);
+        List<Module> list = cycleMap.get(pkgName);
+        if ((list != null) && list.contains(targetModule))
+        {
+            return;
+        }
+        list = (list == null) ? new ArrayList<Module>() : list;
+        list.add(targetModule);
+        cycleMap.put(pkgName, list);
 
         // Check that the uses constraints implied by this package are
         // consistent with the existing constraints.


Reply via email to