Avoid checking for dynamic imports, if not needed. (FELIX-2035)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@938038 13f79535-47bb-0310-9956-ffa450edef68
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 0fcfd18..0e730c6 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
@@ -250,6 +250,14 @@
             return null;
         }
 
+        // If the module doesn't have dynamic imports, then just return
+        // immediately.
+        List<Requirement> dynamics = module.getDynamicRequirements();
+        if ((dynamics == null) || (dynamics.size() == 0))
+        {
+            return null;
+        }
+
         // If any of the module exports this package, then we cannot
         // attempt to dynamically import it.
         List<Capability> caps = module.getCapabilities();
@@ -281,7 +289,6 @@
         Requirement req = new RequirementImpl(
             module, Capability.PACKAGE_NAMESPACE, dirs, attrs);
         Set<Capability> candidates = state.getCandidates(module, req, false);
-        List<Requirement> dynamics = module.getDynamicRequirements();
 
         // First find a dynamic requirement that matches the capabilities.
         Requirement dynReq = null;
@@ -1636,4 +1643,4 @@
                 && m_cap.equals(((Blame) o).m_cap);
         }
     }
-}
\ No newline at end of file
+}