diff --git a/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
index 40112d5..8d6e9ba 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleContextImpl.java
@@ -46,9 +46,7 @@
 
     public void addRequirement(String s) throws BundleException
     {
-        // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
-        //       to deal with code generation.
-        m_felix.addRequirement(m_bundle, s);
+        throw new BundleException("Not implemented yet.");
     }
 
     public void removeRequirement() throws BundleException
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 461d167..f7df03f 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -2181,31 +2181,6 @@
     // Implementation of BundleContext interface methods.
     //
 
-    protected void addRequirement(FelixBundle bundle, String s) throws BundleException
-    {
-        // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
-        //       to deal with code generation.
-        synchronized (m_factory)
-        {
-            IRequirement[] reqs = ManifestParser.parseImportHeader(s);
-            IRequirement[] dynamics = bundle.getInfo().getCurrentModule()
-                .getDefinition().getDynamicRequirements();
-            if (dynamics == null)
-            {
-                dynamics = reqs;
-            }
-            else
-            {
-                IRequirement[] tmp = new IRequirement[dynamics.length + reqs.length];
-                System.arraycopy(dynamics, 0, tmp, 0, dynamics.length);
-                System.arraycopy(reqs, 0, tmp, dynamics.length, reqs.length);
-                dynamics = tmp;
-            }
-            ((ModuleDefinition) bundle.getInfo().getCurrentModule().getDefinition())
-                .setDynamicRequirements(dynamics);
-        }
-    }
-
     /**
      * Implementation for BundleContext.getProperty(). Returns
      * environment property associated with the framework.
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
index 73eb14d..8774ea5 100644
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/ModuleDefinition.java
@@ -62,13 +62,6 @@
         return m_dynamicRequirements;
     }
 
-    // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
-    //       to deal with code generation.
-    public void setDynamicRequirements(IRequirement[] reqs)
-    {
-        m_dynamicRequirements = reqs;
-    }
-
     public R4Library[] getLibraries()
     {
         return m_libraries;
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
index ec22542..e22f08d 100755
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4SearchPolicyCore.java
@@ -1959,38 +1959,6 @@
                 ResolvedPackage rp = new ResolvedPackage(pkgName);
                 rp.m_sourceList.add(ps);
                 pkgMap.put(rp.m_name, rp);
-
-                // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
-                //       to deal with code generation.
-                // Get implicitly imported packages as defined by the provider
-                // of our imported package, unless we are the provider.
-                if (!targetModule.equals(ps.m_module))
-                {
-                    Map implicitPkgMap = calculateImplicitImportedPackages(
-                        ps.m_module, ps.m_capability, candidatesMap, new HashMap());
-                    // Merge the implicitly imported packages with our imports and
-                    // verify that there is no overlap.
-                    for (Iterator i = implicitPkgMap.entrySet().iterator(); i.hasNext(); )
-                    {
-                        Map.Entry entry = (Map.Entry) i.next();
-                        ResolvedPackage implicit = (ResolvedPackage) entry.getValue();
-                        ResolvedPackage existing = (ResolvedPackage) pkgMap.get(entry.getKey());
-                        if ((existing != null) &&
-                            !(existing.isSubset(implicit) && implicit.isSubset(existing)))
-                        {
-                            throw new ResolveException(
-                                "Implicit import of "
-                                + entry.getKey()
-                                + " from "
-                                + implicit
-                                + " duplicates an existing import from "
-                                + existing,
-                                targetModule,
-                                cs.m_requirement);
-                        }
-                        pkgMap.put(entry.getKey(), entry.getValue());
-                    }
-                }
             }
         }
 
@@ -2017,121 +1985,12 @@
                 rp = (rp == null) ? new ResolvedPackage(pkgName) : rp;
                 rp.m_sourceList.add(new PackageSource(wires[wireIdx].getExporter(), wires[wireIdx].getCapability()));
                 pkgMap.put(rp.m_name, rp);
-
-                // TODO: EXPERIMENTAL - Experimental implicit wire concept to try
-                //       to deal with code generation.
-                // Get implicitly imported packages as defined by the provider
-                // of our imported package, unless we are the provider.
-                if (!targetModule.equals(wires[wireIdx].getExporter()))
-                {
-                    Map implicitPkgMap = calculateImplicitImportedPackagesResolved(
-                        wires[wireIdx].getExporter(), wires[wireIdx].getCapability(), new HashMap());
-                    // Merge the implicitly imported packages with our imports.
-                    // No need to verify overlap since this is resolved and should
-                    // be consistent.
-                    for (Iterator i = implicitPkgMap.entrySet().iterator(); i.hasNext(); )
-                    {
-                        Map.Entry entry = (Map.Entry) i.next();
-                        pkgMap.put(entry.getKey(), entry.getValue());
-                    }
-                }
             }
         }
 
         return pkgMap;
     }
 
-    private Map calculateImplicitImportedPackages(
-        IModule targetModule, ICapability targetCapability,
-        Map candidatesMap, Map cycleMap)
-    {
-        return (candidatesMap.get(targetModule) == null)
-            ? calculateImplicitImportedPackagesResolved(
-                targetModule, targetCapability, cycleMap)
-            : calculateImplicitImportedPackagesUnresolved(
-                targetModule, targetCapability, candidatesMap, cycleMap);
-    }
-
-    // TODO: EXPERIMENTAL - This is currently not defined recursively, but it should be.
-    //       Currently, it only assumes that a provider can cause implicit imports for
-    //       packages that it exports.
-    private Map calculateImplicitImportedPackagesUnresolved(
-        IModule targetModule, ICapability targetCapability,
-        Map candidatesMap, Map cycleMap)
-    {
-        Map pkgMap = new HashMap();
-
-        R4Directive[] dirs = ((Capability) targetCapability).getDirectives();
-        if (dirs != null)
-        {
-            for (int dirIdx = 0; dirIdx < dirs.length; dirIdx++)
-            {
-                if (dirs[dirIdx].getName().equals("x-implicitwire"))
-                {
-                    String[] pkgs = ManifestParser.parseDelimitedString(dirs[dirIdx].getValue(), ",");
-                    for (int pkgIdx = 0; pkgIdx < pkgs.length; pkgIdx++)
-                    {
-                        ResolvedPackage rp = new ResolvedPackage(pkgs[pkgIdx].trim());
-                        rp.m_sourceList.add(
-                            new PackageSource(
-                                targetModule,
-                                getExportPackageCapability(targetModule, pkgs[pkgIdx])));
-                        pkgMap.put(rp.m_name, rp);
-                    }
-                }
-            }
-        }
-
-        return pkgMap;
-    }
-
-    // TODO: EXPERIMENTAL - This is currently not defined recursively, but it should be.
-    //       Currently, it only assumes that a provider can cause implicit imports for
-    //       packages that it exports.
-    private Map calculateImplicitImportedPackagesResolved(
-        IModule targetModule, ICapability targetCapability, Map cycleMap)
-    {
-        Map pkgMap = new HashMap();
-
-        R4Directive[] dirs = ((Capability) targetCapability).getDirectives();
-        if (dirs != null)
-        {
-            for (int dirIdx = 0; dirIdx < dirs.length; dirIdx++)
-            {
-                if (dirs[dirIdx].getName().equals("x-implicitwire"))
-                {
-                    String[] pkgs = ManifestParser.parseDelimitedString(dirs[dirIdx].getValue(), ",");
-                    for (int pkgIdx = 0; pkgIdx < pkgs.length; pkgIdx++)
-                    {
-                        ResolvedPackage rp = new ResolvedPackage(pkgs[pkgIdx].trim());
-                        rp.m_sourceList.add(
-                            new PackageSource(
-                                targetModule,
-                                getExportPackageCapability(targetModule, pkgs[pkgIdx])));
-                        pkgMap.put(rp.m_name, rp);
-                    }
-                }
-            }
-        }
-
-        return pkgMap;
-    }
-
-    private Map calculateCandidateImplicitImportedPackages(IModule module, PackageSource psTarget, Map candidatesMap)
-    {
-//System.out.println("calculateCandidateImplicitPackages("+module+")");
-        // Cannot implicitly wire to oneself.
-        if (!module.equals(psTarget.m_module))
-        {
-            Map cycleMap = new HashMap();
-            cycleMap.put(module, module);
-            return calculateImplicitImportedPackages(
-                psTarget.m_module, psTarget.m_capability, candidatesMap, cycleMap);
-        }
-
-        return null;
-    }
-
     private Map calculateExportedPackages(IModule targetModule)
     {
 //System.out.println("calculateExportedPackages("+targetModule+")");
@@ -2693,26 +2552,6 @@
                     cs.m_requirement,
                     cs.m_candidates[cs.m_idx].m_module,
                     cs.m_candidates[cs.m_idx].m_capability));
-
-                // TODO: EXPERIMENTAL - The following is part of an experimental
-                //       implicit imported wire concept. The above code is how
-                //       the wire should normally be created.
-                // Add wires for any implicitly imported package from provider.
-                Map pkgMap = calculateCandidateImplicitImportedPackages(
-                    importer, cs.m_candidates[cs.m_idx], candidatesMap);
-                if (pkgMap != null)
-                {
-                    for (Iterator i = pkgMap.entrySet().iterator(); i.hasNext(); )
-                    {
-                        Map.Entry entry = (Map.Entry) i.next();
-                        ResolvedPackage rp = (ResolvedPackage) entry.getValue();
-                        packageWires.add(new R4Wire(
-                            importer,
-                            cs.m_requirement, // TODO: This is not really correct.
-                            ((PackageSource) rp.m_sourceList.get(0)).m_module,
-                            ((PackageSource) rp.m_sourceList.get(0)).m_capability));
-                    }
-                }
             }
 
             // Create any necessary wires for the selected candidate module.
@@ -3341,7 +3180,7 @@
     }
 
     /**
-     * This utility class a resolved package, which is comprised of a
+     * This utility class is a resolved package, which is comprised of a
      * set of <tt>PackageSource</tt>s that is calculated by the resolver
      * algorithm. A given resolved package may have a single package source,
      * as is the case with imported packages, or it may have multiple
diff --git a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
index 2b2ead0..07ff41e 100755
--- a/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
+++ b/framework/src/main/java/org/apache/felix/framework/searchpolicy/R4Wire.java
@@ -88,18 +88,24 @@
         if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
             m_capability.getProperties().get(ICapability.PACKAGE_PROPERTY).equals(pkgName))
         {
-            // Before delegating to the exporting module to satisfy
-            // the class load, we must check the include/exclude filters
-            // from the target package to make sure that the class is
-            // actually visible. However, if the exporting module is the
-            // same as the requesting module, then filtering is not
-            // performed since a module has complete access to itself.
-            if ((m_exporter == m_importer) ||
-                (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE) &&
-                    ((Capability) m_capability).isIncluded(name)))
+            // If the importer and the exporter are the same, then
+            // just ask for the class from the exporting module's
+            // content directly.
+            if (m_exporter == m_importer)
             {
                 clazz = m_exporter.getContentLoader().getClass(name);
             }
+            // Otherwise, check the include/exclude filters from the target
+            // package to make sure that the class is actually visible. In
+            // this case since the importing and exporting modules are different,
+            // we delegate to the exporting module, rather than its content,
+            // so that it can follow any internal wires it may have (e.g.,
+            // if the package has multiple sources).
+            else if (m_capability.getNamespace().equals(ICapability.PACKAGE_NAMESPACE)
+                && ((Capability) m_capability).isIncluded(name))
+            {
+                clazz = m_exporter.getClass(name);
+            }
 
             // If no class was found, then we must throw an exception
             // since the exporter for this package did not contain the
