diff --git a/core/core.services.yml b/core/core.services.yml
index 95c56a84de5b985969133b5b784d6ef19f870181..5284bce1e25607fa930d2cd9bcaa2068802b6227 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -143,12 +143,17 @@ services:
     calls:
       - [addSubscriber, ['@http_client_simpletest_subscriber']]
       - [setUserAgent, ['Drupal (+http://drupal.org/)']]
+  container.namespaces:
+    class: ArrayObject
+    arguments: [ '%container.namespaces%' ]
+    tags:
+      - { name: persist }
   plugin.manager.entity:
     class: Drupal\Core\Entity\EntityManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   plugin.manager.archiver:
     class: Drupal\Core\Archiver\ArchiverManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   request:
     class: Symfony\Component\HttpFoundation\Request
   event_dispatcher:
@@ -173,7 +178,7 @@ services:
       - [setValidationConstraintManager, ['@validation.constraint']]
   validation.constraint:
     class: Drupal\Core\Validation\ConstraintManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   lock:
     class: Drupal\Core\Lock\DatabaseLockBackend
   user.tempstore:
@@ -378,7 +383,7 @@ services:
     arguments: ['@database', '@request']
   plugin.manager.condition:
     class: Drupal\Core\Condition\ConditionManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   kernel_destruct_subscriber:
     class: Drupal\Core\EventSubscriber\KernelDestructionSubscriber
     tags:
@@ -391,7 +396,7 @@ services:
       - { name: event_subscriber }
   image.toolkit.manager:
     class: Drupal\system\Plugin\ImageToolkitManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   image.toolkit:
     class: Drupal\system\Plugin\ImageToolkitInterface
     factory_method: getDefaultToolkit
diff --git a/core/lib/Drupal/Core/Archiver/ArchiverManager.php b/core/lib/Drupal/Core/Archiver/ArchiverManager.php
index 38851469d693dc6a5c19f7c7eaf3cd8b0694426f..fd1165bd6ebeccf3f1fa52521b2a0a5ecac1ed0f 100644
--- a/core/lib/Drupal/Core/Archiver/ArchiverManager.php
+++ b/core/lib/Drupal/Core/Archiver/ArchiverManager.php
@@ -20,10 +20,11 @@ class ArchiverManager extends PluginManagerBase {
   /**
    * Constructs a ArchiverManager object.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by its corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('Core', 'Archiver', $namespaces);
     $this->discovery = new AlterDecorator($this->discovery, 'archiver_info');
     $this->discovery = new CacheDecorator($this->discovery, 'archiver_info');
diff --git a/core/lib/Drupal/Core/Condition/ConditionManager.php b/core/lib/Drupal/Core/Condition/ConditionManager.php
index 2f4c060b1e63966655d67c8c4c3986359dda561f..ffa22fd212502cf6e8e8b763981987ad516af23b 100644
--- a/core/lib/Drupal/Core/Condition/ConditionManager.php
+++ b/core/lib/Drupal/Core/Condition/ConditionManager.php
@@ -24,10 +24,11 @@ class ConditionManager extends PluginManagerBase implements ExecutableManagerInt
   /**
    * Constructs aa ConditionManager object.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('Core', 'Condition', $namespaces);
     $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
     $this->discovery = new AlterDecorator($this->discovery, 'condition_info');
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index e600313c1b94e6ed510e5a440c7b01ca19aedc1b..bc46901ef9345f97c84e7b979214694f1d16ce3f 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -342,6 +342,14 @@ protected function initializeContainer() {
     if (!isset($this->container)) {
       $this->container = $this->buildContainer();
       $this->persistServices($persist);
+
+      // The namespaces are marked as persistent, so objects like the annotated
+      // class discovery still has the right object. We may have updated the
+      // list of modules, so set it.
+      if ($this->container->initialized('container.namespaces')) {
+        $this->container->get('container.namespaces')->exchangeArray($this->container->getParameter('container.namespaces'));
+      }
+
       if ($this->allowDumping) {
         $this->containerNeedsDumping = TRUE;
       }
diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php
index c5d72f2034fd4e5651732f3af0be2396bb87b021..d998c5034ccbfb9cc1395ce294eb366b0fe3105d 100644
--- a/core/lib/Drupal/Core/Entity/EntityManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityManager.php
@@ -41,10 +41,11 @@ class EntityManager extends PluginManagerBase {
   /**
    * Constructs a new Entity plugin manager.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     // Allow the plugin definition to be altered by hook_entity_info_alter().
     $annotation_namespaces = array(
       'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib',
diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
index 8ed9440324379d6ad3f34bc8dd6d3cc3266f936b..2694e33705fba5ca5b777781377898d09057e795 100644
--- a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
+++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
@@ -14,6 +14,27 @@
  */
 class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
 
+  /**
+   * The module name that defines the plugin type.
+   *
+   * @var string
+   */
+  protected $owner;
+
+  /**
+   * The plugin type, for example filter.
+   *
+   * @var string
+   */
+  protected $type;
+
+  /**
+   * An object containing the namespaces to look for plugin implementations.
+   *
+   * @var \Traversable
+   */
+  protected $rootNamespacesIterator;
+
   /**
    * Constructs an AnnotatedClassDiscovery object.
    *
@@ -21,34 +42,39 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
    *   The module name that defines the plugin type.
    * @param string $type
    *   The plugin type, for example filter.
-   * @param array $root_namespaces
-   *   (optional) An array of root paths keyed by the corresponding namespace to
-   *   look for plugin implementations. '\Plugin\$owner\$type' will be appended
-   *   to each namespace. Defaults to an empty array.
+   * @param \Traversable $root_namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
+   *   \Plugin\$owner\$type will be appended to each namespace.
    * @param array $annotation_namespaces
    *   (optional) The namespaces of classes that can be used as annotations.
    *   Defaults to an empty array.
    * @param string $plugin_definition_annotation_name
    *   (optional) The name of the annotation that contains the plugin definition.
    *   Defaults to 'Drupal\Component\Annotation\Plugin'.
-   *
-   * @todo Figure out how to make the following comment FALSE.
-   *   Drupal modules can be enabled (and therefore, namespaces registered)
-   *   during the lifetime of a plugin manager. Passing $root_namespaces into
-   *   the constructor means plugins in the new namespaces will not be available
-   *   until the next request. Additionally when a namespace is unregistered,
-   *   plugins will not be removed until the next request.
    */
-  function __construct($owner, $type, array $root_namespaces = array(), $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
+  function __construct($owner, $type, \Traversable $root_namespaces, $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
+    $this->owner = $owner;
+    $this->type = $type;
+    $this->rootNamespacesIterator = $root_namespaces;
     $annotation_namespaces += array(
       'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib',
       'Drupal\Core\Annotation' => DRUPAL_ROOT . '/core/lib',
     );
     $plugin_namespaces = array();
-    foreach ($root_namespaces as $namespace => $dir) {
-      $plugin_namespaces["$namespace\\Plugin\\{$owner}\\{$type}"] = array($dir);
-    }
     parent::__construct($plugin_namespaces, $annotation_namespaces, $plugin_definition_annotation_name);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  protected function getPluginNamespaces() {
+    $plugin_namespaces = array();
+    foreach ($this->rootNamespacesIterator as $namespace => $dir) {
+      $plugin_namespaces["$namespace\\Plugin\\{$this->owner}\\{$this->type}"] = array($dir);
+    }
+
+    return $plugin_namespaces;
+  }
+
 }
diff --git a/core/lib/Drupal/Core/Validation/ConstraintManager.php b/core/lib/Drupal/Core/Validation/ConstraintManager.php
index e0444ae268afb0612e9d009cdeb324394a5a78a3..5c8719bcfae403b495ce1a2434b7fb32d5cc92f2 100644
--- a/core/lib/Drupal/Core/Validation/ConstraintManager.php
+++ b/core/lib/Drupal/Core/Validation/ConstraintManager.php
@@ -39,10 +39,11 @@ class ConstraintManager extends PluginManagerBase {
   /**
    * Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('Validation', 'Constraint', $namespaces);
     $this->discovery = new StaticDiscoveryDecorator($this->discovery, array($this, 'registerDefinitions'));
     $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
diff --git a/core/modules/aggregator/aggregator.services.yml b/core/modules/aggregator/aggregator.services.yml
index 1cedc0f202d373139d5fa2ce6eeaf93bb8f80d95..639ed2d5b0a410c9dba08c99d259b8b5f63031f4 100644
--- a/core/modules/aggregator/aggregator.services.yml
+++ b/core/modules/aggregator/aggregator.services.yml
@@ -1,10 +1,10 @@
 services:
   plugin.manager.aggregator.fetcher:
     class: Drupal\aggregator\Plugin\AggregatorPluginManager
-    arguments: [fetcher, '%container.namespaces%']
+    arguments: [fetcher, '@container.namespaces']
   plugin.manager.aggregator.parser:
     class: Drupal\aggregator\Plugin\AggregatorPluginManager
-    arguments: [parser, '%container.namespaces%']
+    arguments: [parser, '@container.namespaces']
   plugin.manager.aggregator.processor:
     class: Drupal\aggregator\Plugin\AggregatorPluginManager
-    arguments: [processor, '%container.namespaces%']
+    arguments: [processor, '@container.namespaces']
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php
index 9f51a71ca3b89525eb9ccc3f699f804c1bf3ee31..aaa6e3e6a14f352df1ad60c4ed875f60c8934379 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php
@@ -22,10 +22,11 @@ class AggregatorPluginManager extends PluginManagerBase {
    *
    * @param string $type
    *   The plugin type, for example fetcher.
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($type, array $namespaces) {
+  public function __construct($type, \Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('aggregator', $type, $namespaces);
     $this->discovery = new CacheDecorator($this->discovery, "aggregator_$type:" . language(LANGUAGE_TYPE_INTERFACE)->langcode);
     $this->factory = new DefaultFactory($this->discovery);
diff --git a/core/modules/block/block.services.yml b/core/modules/block/block.services.yml
index ddc35568983f08a363af0f715cbed76434f2d7ad..745bf66b088b7f93331f79ec311a6d0e6adf5277 100644
--- a/core/modules/block/block.services.yml
+++ b/core/modules/block/block.services.yml
@@ -1,7 +1,7 @@
 services:
   plugin.manager.block:
     class: Drupal\block\Plugin\Type\BlockManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   cache.block:
     class: Drupal\Core\Cache\CacheBackendInterface
     tags:
diff --git a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php
index b102d4b5da52ee9500306850cfbb2b7516034e0f..f90766248d9beaba6a3a0631209aaf3714777d4c 100644
--- a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php
+++ b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php
@@ -27,10 +27,11 @@ class BlockManager extends PluginManagerBase {
   /**
    * Constructs a new \Drupal\block\Plugin\Type\BlockManager object.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('block', 'block', $namespaces);
     $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
     $this->discovery = new AlterDecorator($this->discovery, 'block');
diff --git a/core/modules/ckeditor/ckeditor.services.yml b/core/modules/ckeditor/ckeditor.services.yml
index 143aaa61764d7a3823ce1457488027ca85e6fe71..5cb1b5ed912b0cbfd219c173e3285912d15e9035 100644
--- a/core/modules/ckeditor/ckeditor.services.yml
+++ b/core/modules/ckeditor/ckeditor.services.yml
@@ -1,4 +1,4 @@
 services:
   plugin.manager.ckeditor.plugin:
     class: Drupal\ckeditor\CKEditorPluginManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php b/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
index 55002418a541731c5cb10093c8b16aa18c2c6b3d..5386a9f2d718cc12526678583c287442491245fe 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
@@ -24,10 +24,11 @@ class CKEditorPluginManager extends PluginManagerBase {
   /**
    * Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('ckeditor', 'plugin', $namespaces);
     $this->discovery = new AlterDecorator($this->discovery, 'ckeditor_plugin_info');
     $this->discovery = new CacheDecorator($this->discovery, 'ckeditor_plugin');
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
index b7383d74fcda4b293a4affdad72bbeb5d06843a4..8cee06ee7da33c3d7f707c81f0ddff48a8c874cd 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
@@ -63,7 +63,7 @@ function setUp() {
    * Tests the enabling of plugins.
    */
   function testEnabledPlugins() {
-    $this->manager = new CKEditorPluginManager($this->container->getParameter('container.namespaces'));
+    $this->manager = $this->container->get('plugin.manager.ckeditor.plugin');
     $editor = entity_load('editor', 'filtered_html');
 
     // Case 1: no CKEditor plugins.
@@ -77,7 +77,6 @@ function testEnabledPlugins() {
     // variations of it, to cover all possible ways a plugin can be enabled) and
     // clear the editor manager's cache so it is picked up.
     $this->enableModules(array('ckeditor_test'));
-    $this->manager = new CKEditorPluginManager($this->container->getParameter('container.namespaces'));
     $this->manager->clearCachedDefinitions();
 
     // Case 2: CKEditor plugins are available.
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php
index db4dbec65f042ea50d4f9723a40a91ebe2311966..98d15c2644046b724c3a305aae8fcc708ada0223 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorTest.php
@@ -64,7 +64,7 @@ function setUp() {
     $editor->save();
 
     // Create "CKEditor" text editor plugin instance.
-    $manager = new EditorManager($this->container->getParameter('container.namespaces'));
+    $manager = $this->container->get('plugin.manager.editor');
     $this->ckeditor = $manager->createInstance('ckeditor');
   }
 
diff --git a/core/modules/edit/edit.services.yml b/core/modules/edit/edit.services.yml
index 8f72c77afc4463ca9094569a5c4c77cb9af50923..91c37b180c97079ed667ca8108088e4a773f210b 100644
--- a/core/modules/edit/edit.services.yml
+++ b/core/modules/edit/edit.services.yml
@@ -1,7 +1,7 @@
 services:
   plugin.manager.edit.editor:
     class: Drupal\edit\Plugin\EditorManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   access_check.edit.entity_field:
     class: Drupal\edit\Access\EditEntityFieldAccessCheck
     tags:
diff --git a/core/modules/edit/lib/Drupal/edit/Plugin/EditorManager.php b/core/modules/edit/lib/Drupal/edit/Plugin/EditorManager.php
index ce2d650ff665bfc04906e4ee3e380ae3b46f16ed..8d0032fa0a01e26d73aa10c9da865c9a3846ce70 100644
--- a/core/modules/edit/lib/Drupal/edit/Plugin/EditorManager.php
+++ b/core/modules/edit/lib/Drupal/edit/Plugin/EditorManager.php
@@ -24,10 +24,11 @@ class EditorManager extends PluginManagerBase {
   /**
    * Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('edit', 'editor', $namespaces);
     $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
     $this->discovery = new AlterDecorator($this->discovery, 'edit_editor');
diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php b/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php
index e7a6db1fda70ec55839319e3d2a1cc70ccde658b..26ec6c0837d81447910cc77f48e6d4e43065f596 100644
--- a/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php
+++ b/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php
@@ -40,7 +40,7 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
 
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
+    $this->editorManager = $this->container->get('plugin.manager.edit.editor');
     $this->editorSelector = new EditorSelector($this->editorManager);
   }
 
@@ -109,8 +109,6 @@ function testTextWysiwyg() {
     // Enable edit_test module so that the 'wysiwyg' Create.js PropertyEditor
     // widget becomes available.
     $this->enableModules(array('edit_test'));
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
-    $this->editorSelector = new EditorSelector($this->editorManager);
 
     $field_name = 'field_textarea';
     $this->createFieldWithInstance(
diff --git a/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php b/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php
index 5a4faef76c65c171bf1293ab0ce9f0ac85d63e7d..6c4569fde416dd75bda0c01b4054df4a4b9ef368 100644
--- a/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php
+++ b/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php
@@ -56,7 +56,7 @@ public static function getInfo() {
   function setUp() {
     parent::setUp();
 
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
+    $this->editorManager = $this->container->get('plugin.manager.edit.editor');
     $this->accessChecker = new MockEditEntityFieldAccessCheck();
     $this->editorSelector = new EditorSelector($this->editorManager);
     $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager);
@@ -131,9 +131,6 @@ function testEditorWithCustomMetadata() {
     // Enable edit_test module so that the WYSIWYG Create.js PropertyEditor
     // widget becomes available.
     $this->enableModules(array('edit_test'));
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
-    $this->editorSelector = new EditorSelector($this->editorManager);
-    $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager);
 
     // Create a rich text field.
     $field_name = 'field_rich';
diff --git a/core/modules/editor/editor.services.yml b/core/modules/editor/editor.services.yml
index 60f160957eb911c486db5c185b8249d639ffc475..db19922a3a92cc2278c0fb09b22a1c1812c38e51 100644
--- a/core/modules/editor/editor.services.yml
+++ b/core/modules/editor/editor.services.yml
@@ -1,4 +1,4 @@
 services:
   plugin.manager.editor:
     class: Drupal\editor\Plugin\EditorManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
index c267b5fd35165f6b946293f4512a186a7925b4cd..989af1fc7a20049fc3157efe94a0f7bf2190f398 100644
--- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
+++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
@@ -22,10 +22,11 @@ class EditorManager extends PluginManagerBase {
   /**
    * Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('editor', 'editor', $namespaces);
     $this->discovery = new AlterDecorator($this->discovery, 'editor_info');
     $this->discovery = new CacheDecorator($this->discovery, 'editor');
diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php
index 9e443f8d3a3f3dc1021dc9fcfd6388c6da5f7c17..1dcadc8383fea6e2843e1e662dafaea5aad7f81f 100644
--- a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php
+++ b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php
@@ -122,7 +122,7 @@ protected function getSelectedEditor($items, $field_name, $view_mode = 'default'
    * format compatibility.
    */
   function testEditorSelection() {
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
+    $this->editorManager = new EditorManager($this->container->get('container.namespaces'));
     $this->editorSelector = new EditorSelector($this->editorManager);
 
     // Pretend there is an entity with these items for the field.
@@ -146,7 +146,7 @@ function testEditorSelection() {
    * Tests (custom) metadata when the "Editor" Create.js editor is used.
    */
   function testMetadata() {
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
+    $this->editorManager = new EditorManager($this->container->get('container.namespaces'));
     $this->accessChecker = new MockEditEntityFieldAccessCheck();
     $this->editorSelector = new EditorSelector($this->editorManager);
     $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager);
diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php
index 567db78f03e900d14f7c3c0e7a7a223cff469a32..1fee82351bd7eaa6b4e754c599ee18fce8fea65d 100644
--- a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php
+++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php
@@ -66,7 +66,7 @@ function setUp() {
    * Tests the configurable text editor manager.
    */
   function testManager() {
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
+    $this->editorManager = new EditorManager($this->container->get('container.namespaces'));
 
     // Case 1: no text editor available:
     // - listOptions() should return an empty list of options
@@ -79,7 +79,6 @@ function testManager() {
     // Enable the Text Editor Test module, which has the Unicorn Editor and
     // clear the editor manager's cache so it is picked up.
     $this->enableModules(array('editor_test'));
-    $this->editorManager = new EditorManager($this->container->getParameter('container.namespaces'));
     $this->editorManager->clearCachedDefinitions();
 
     // Case 2: a text editor available.
diff --git a/core/modules/entity_reference/entity_reference.services.yml b/core/modules/entity_reference/entity_reference.services.yml
index 6198f73096b8be2be8c0f493ee524529d2397dde..02c3106999da324d72fa184467c6b5772ced24d9 100644
--- a/core/modules/entity_reference/entity_reference.services.yml
+++ b/core/modules/entity_reference/entity_reference.services.yml
@@ -1,7 +1,7 @@
 services:
   plugin.manager.entity_reference.selection:
     class: Drupal\entity_reference\Plugin\Type\SelectionPluginManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   entity_reference.autocomplete:
     class: Drupal\entity_reference\EntityReferenceAutocomplete
     arguments: ['@plugin.manager.entity']
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
index db3bd4790f2d7577266db77036c2e59f008c6568..bd140a9642f741be1905084b163cd4a892e506c7 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Type/SelectionPluginManager.php
@@ -23,10 +23,11 @@ class SelectionPluginManager extends PluginManagerBase {
   /**
    * Constructs a SelectionPluginManager object.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->baseDiscovery = new AlterDecorator(new AnnotatedClassDiscovery('entity_reference', 'selection', $namespaces), 'entity_reference_selection');
     $this->discovery = new CacheDecorator($this->baseDiscovery, 'entity_reference_selection');
     $this->factory = new ReflectionFactory($this);
diff --git a/core/modules/field/field.services.yml b/core/modules/field/field.services.yml
index 2313254c9b5244bf6d9e7636d566c6720cb1b9a0..f4c28db1bcbc08566141eabbe3d87724f456e324 100644
--- a/core/modules/field/field.services.yml
+++ b/core/modules/field/field.services.yml
@@ -1,10 +1,10 @@
 services:
   plugin.manager.field.widget:
     class: Drupal\field\Plugin\Type\Widget\WidgetPluginManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   plugin.manager.field.formatter:
     class: Drupal\field\Plugin\Type\Formatter\FormatterPluginManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   field.info:
     class: Drupal\field\FieldInfo
     arguments: ['@cache.field', '@config.factory', '@module_handler']
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php
index 93950e6969ee1f66779df517f4441c853fa554ff..90722d592ec465942b8f5ee41951785a5d7d820f 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php
@@ -30,10 +30,11 @@ class FormatterPluginManager extends PluginManagerBase {
   /**
    * Constructs a FormatterPluginManager object.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('field', 'formatter', $namespaces);
     $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
     $this->discovery = new AlterDecorator($this->discovery, 'field_formatter_info');
diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
index 6ea187949fccfb1ec3c8e59533f3cf77ccf06bd6..6cbad1fa4c421ea806db80a5a801a098a3ecf968 100644
--- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
+++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php
@@ -31,10 +31,11 @@ class WidgetPluginManager extends PluginManagerBase {
   /**
    * Constructs a WidgetPluginManager object.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('field', 'widget', $namespaces);
     $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
     $this->discovery = new AlterDecorator($this->discovery, 'field_widget_info');
diff --git a/core/modules/layout/layout.services.yml b/core/modules/layout/layout.services.yml
index 68d989c2173adb40336191a9eee59d05c69ad1fa..d387b77b1617ae22c2b1c265ef8225dcbd330b61 100644
--- a/core/modules/layout/layout.services.yml
+++ b/core/modules/layout/layout.services.yml
@@ -1,4 +1,4 @@
 services:
   plugin.manager.layout:
     class: Drupal\layout\Plugin\Type\LayoutManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
diff --git a/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php b/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php
index 0dcb14c1db602d7a2ec715a88279b968e53c8c4f..179ea4ba08e19fce9e60f112d78f455567983580 100644
--- a/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php
+++ b/core/modules/layout/lib/Drupal/layout/Plugin/Type/LayoutManager.php
@@ -25,10 +25,11 @@ class LayoutManager extends PluginManagerBase {
   /**
    * Overrides Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($namespaces) {
+  public function __construct(\Traversable $namespaces) {
     // Create layout plugin derivatives from declaratively defined layouts.
     $this->discovery = new AnnotatedClassDiscovery('layout', 'layout', $namespaces);
     $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
diff --git a/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php b/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
index c33134babed9b5e0917dff33f9495cf3be742d29..f6c818074999088128655a323506d0e44f34d27a 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Condition/NodeConditionTest.php
@@ -35,7 +35,7 @@ protected function setUp() {
    * Tests conditions.
    */
   function testConditions() {
-    $manager = $this->container->get('plugin.manager.condition');
+    $manager = $this->container->get('plugin.manager.condition', $this->container->get('container.namespaces'));
 
     // Get some nodes of various types to check against.
     $page = entity_create('node', array('type' => 'page', 'title' => $this->randomName()));
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php b/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php
index ec5e31e1a120fa8d119ab2ea4d6471abad030cd0..c23e9709dc25f5944ba0274f6a8729f3f2daa76f 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/Type/ResourcePluginManager.php
@@ -20,10 +20,11 @@ class ResourcePluginManager extends PluginManagerBase {
   /**
    * Overrides Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($namespaces) {
+  public function __construct(\Traversable $namespaces) {
     // Create resource plugin derivatives from declaratively defined resources.
     $this->discovery = new DerivativeDiscoveryDecorator(new AnnotatedClassDiscovery('rest', 'resource', $namespaces));
     $this->factory = new ReflectionFactory($this->discovery);
diff --git a/core/modules/rest/rest.services.yml b/core/modules/rest/rest.services.yml
index af0f68ca8a0b62cfba2122af6c584c097c338b65..97817addae641602fef8faf398c7f9a08140ef9d 100644
--- a/core/modules/rest/rest.services.yml
+++ b/core/modules/rest/rest.services.yml
@@ -1,7 +1,7 @@
 services:
   plugin.manager.rest:
     class: Drupal\rest\Plugin\Type\ResourcePluginManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
   rest.route_subscriber:
     class: Drupal\rest\EventSubscriber\RouteSubscriber
     tags:
diff --git a/core/modules/simpletest/tests/Drupal/simpletest/Tests/PhpUnitErrorTest.php b/core/modules/simpletest/tests/Drupal/simpletest/Tests/PhpUnitErrorTest.php
index 224e921471bd1a08f5052366f2a9bb82b15db76d..49fcb0294c38077cab65788733b29beaff584342 100644
--- a/core/modules/simpletest/tests/Drupal/simpletest/Tests/PhpUnitErrorTest.php
+++ b/core/modules/simpletest/tests/Drupal/simpletest/Tests/PhpUnitErrorTest.php
@@ -14,6 +14,7 @@ public static function getInfo() {
       'name' => 'PHPUnit errors',
       'description' => 'Test PHPUnit errors getting converted to Simpletest errors.',
       'group' => 'Simpletest',
+
     );
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php
index 158b6d4ea232da346b4a6543098f19e8307b502d..c33f79a3946f9c9b88b95a5aef5ef74c52f28ef5 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/ImageToolkitManager.php
@@ -18,8 +18,12 @@ class ImageToolkitManager extends PluginManagerBase {
 
   /**
    * Constructs the ImageToolkitManager object.
+   *
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('system', 'imagetoolkit', $namespaces);
     $this->factory = new DefaultFactory($this->discovery);
   }
diff --git a/core/modules/system/lib/Drupal/system/Plugin/Type/PluginUIManager.php b/core/modules/system/lib/Drupal/system/Plugin/Type/PluginUIManager.php
index dd7fca3036b2d061732713fb759b77cbc5e59d0e..bc371c0aee8644315064ce0ab36d22b6223dd3a0 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/Type/PluginUIManager.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/Type/PluginUIManager.php
@@ -24,10 +24,11 @@ class PluginUIManager extends PluginManagerBase {
   /**
    * Constructs a \Drupal\system\Plugin\Type\PluginUIManager object.
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('system', 'plugin_ui', $namespaces);
     $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
     $this->discovery = new AlterDecorator($this->discovery, 'plugin_ui');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php
index 1dac11c92c0e8698c7cbdc2b6d2ab4b9261086c1..6f4075d4e7bb03d145ca4527d102238de7aef1b4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitGdTest.php
@@ -215,7 +215,7 @@ function testManipulations() {
       );
     }
 
-    $manager = new ImageToolkitManager($this->container->getParameter('container.namespaces'));
+    $manager = new ImageToolkitManager($this->container->get('container.namespaces'));
     foreach ($files as $file) {
       foreach ($operations as $op => $values) {
         // Load up a fresh image.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
index 7077023c9db67ee0a4a48b6bd99e6935b35d13fd..d0d64a36bdce697c1099c01ae00cc1dfc653035a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTest.php
@@ -26,7 +26,7 @@ public static function getInfo() {
    * available toolkits.
    */
   function testGetAvailableToolkits() {
-    $manager = new ImageToolkitManager($this->container->getParameter('container.namespaces'));
+    $manager = new ImageToolkitManager($this->container->get('container.namespaces'));
     $toolkits = $manager->getAvailableToolkits();
     $this->assertTrue(isset($toolkits['test']), 'The working toolkit was returned.');
     $this->assertFalse(isset($toolkits['broken']), 'The toolkit marked unavailable was not returned');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php
index d365f9796dbdf5d2fdf44c823301e80a064848eb..260b2da53233f926c604d9e102aab338713a8466 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Image/ToolkitTestBase.php
@@ -31,7 +31,7 @@ function setUp() {
     parent::setUp();
 
     // Use the image_test.module's test toolkit.
-    $manager = new ImageToolkitManager($this->container->getParameter('container.namespaces'));
+    $manager = new ImageToolkitManager($this->container->get('container.namespaces'));
     $this->toolkit = $manager->createInstance('test');
 
     // Pick a file for testing.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
index fb026e95f168c8470ced8e696f4b5eb1aad6423b..b54b0646b6d746418ec52243215fbf38e18ea088 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/AnnotatedClassDiscoveryTest.php
@@ -53,7 +53,7 @@ public function setUp() {
         'class' => 'Drupal\plugin_test\Plugin\plugin_test\fruit\Orange',
       ),
     );
-    $namespaces = array('Drupal\plugin_test' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib');
+    $namespaces = new \ArrayObject(array('Drupal\plugin_test' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib'));
     $this->discovery = new AnnotatedClassDiscovery('plugin_test', 'fruit', $namespaces);
     $this->emptyDiscovery = new AnnotatedClassDiscovery('non_existing_module', 'non_existing_plugin_type', $namespaces);
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
index 792f8a74cb8729e270f3e7b83d73b1b54edaccfa..849933bfd5fd3a85d1205ec830600f4c018b4101 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php
@@ -39,7 +39,7 @@ protected function setUp() {
         'class' => 'Drupal\plugin_test\Plugin\plugin_test\custom_annotation\Example2',
       ),
     );
-    $root_namespaces = array('Drupal\plugin_test' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib');
+    $root_namespaces = new \ArrayObject(array('Drupal\plugin_test' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib'));
     $annotation_namespaces = array(
       'Drupal\plugin_test\Plugin\Annotation' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib',
     );
diff --git a/core/modules/system/system.services.yml b/core/modules/system/system.services.yml
index bf43cd4309c43cde9b2d17cac9ceee5f9b44ff04..c049b0a70d87553af2802e72c73216ac0c103966 100644
--- a/core/modules/system/system.services.yml
+++ b/core/modules/system/system.services.yml
@@ -5,4 +5,4 @@ services:
       - { name: access_check }
   plugin.manager.system.plugin_ui:
     class: Drupal\system\Plugin\Type\PluginUIManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
diff --git a/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php b/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php
index 93c360339fd5e4fe8847bb4364775b4cea60b5cf..b1012c2ee520a72bb6793e777c4afb1032d35f85 100644
--- a/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php
+++ b/core/modules/system/tests/modules/condition_test/lib/Drupal/condition_test/FormController.php
@@ -33,7 +33,7 @@ public function getFormID() {
    * Constructs a \Drupal\condition_test\FormController object.
    */
   public function __construct() {
-    $manager = new ConditionManager(drupal_container()->getParameter('container.namespaces'));
+    $manager = new ConditionManager(\Drupal::service('container.namespaces'));
     $this->condition = $manager->createInstance('node_type');
   }
 
diff --git a/core/modules/tour/lib/Drupal/tour/TipPluginManager.php b/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
index f4a10165da6d19ce65cbbe83890872af4443badc..fd8c1c4505911fcf8313c92366fc415a00114ab5 100644
--- a/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
+++ b/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
@@ -21,10 +21,11 @@ class TipPluginManager extends PluginManagerBase {
   /**
    * Overrides \Drupal\Component\Plugin\PluginManagerBase::__construct().
    *
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct(array $namespaces) {
+  public function __construct(\Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('tour', 'tip', $namespaces);
     $this->discovery = new CacheDecorator($this->discovery, 'tour');
 
diff --git a/core/modules/tour/tour.services.yml b/core/modules/tour/tour.services.yml
index 36a5df2ede39731df6af7c6d9a97965308dc9aa3..c4cf3fa4ba4c42b154cf1b3b8d6bb767402746e2 100644
--- a/core/modules/tour/tour.services.yml
+++ b/core/modules/tour/tour.services.yml
@@ -1,4 +1,4 @@
 services:
   plugin.manager.tour.tip:
     class: Drupal\tour\TipPluginManager
-    arguments: ['%container.namespaces%']
+    arguments: ['@container.namespaces']
diff --git a/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php b/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
index 291ad44b56beaf24c7cb32c90bb6688fdc72b89f..51664cb743173e0481f9ba4f43f6bd615ec69a52 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
@@ -21,18 +21,26 @@ class ViewsHandlerDiscovery extends AnnotatedClassDiscovery {
    */
   protected $type;
 
+  /**
+   * An object containing the namespaces to look for plugin implementations.
+   *
+   * @var \Traversable
+   */
+  protected $rootNamespacesIterator;
+
   /**
    * Constructs a ViewsHandlerDiscovery object.
    *
    * @param string $type
    *   The plugin type, for example filter.
-   * @param array $root_namespaces
-   *   (optional) Array of root paths keyed by the corresponding namespace to
-   *   look for plugin implementations, \Plugin\views\$type will be appended to
-   *   each namespace. Defaults to an empty array.
+   * @param \Traversable $root_namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  function __construct($type, array $root_namespaces = array()) {
+  function __construct($type, \Traversable $root_namespaces) {
     $this->type = $type;
+    $this->rootNamespacesIterator = $root_namespaces;
+
     $annotation_namespaces = array(
       'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib',
     );
@@ -55,4 +63,16 @@ public function getDefinitions() {
     return $definitions;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  protected function getPluginNamespaces() {
+    $plugin_namespaces = array();
+    foreach ($this->rootNamespacesIterator as $namespace => $dir) {
+      $plugin_namespaces["$namespace\\Plugin\\views\\{$this->type}"] = array($dir);
+    }
+
+    return $plugin_namespaces;
+  }
+
 }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php
index b515452913db67a08d77de2ade7fdad37897e11f..5768aa94d7272bf1fe85543c6cd48a8bb68661d1 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsHandlerManager.php
@@ -22,10 +22,11 @@ class ViewsHandlerManager extends PluginManagerBase {
    *
    * @param string $type
    *   The plugin type, for example filter.
-   * @param array $namespaces
-   *   (optional) An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($type, array $namespaces = array()) {
+  public function __construct($type, \Traversable $namespaces) {
     $this->discovery = new ViewsHandlerDiscovery($type, $namespaces);
     $this->discovery = new CacheDecorator($this->discovery, "views:$type", 'views_info');
 
diff --git a/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php b/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php
index b1c6866597efbdfb53d670eea5a965fec79c4b6a..4413b00cb9e12b67cded4138deed32d83222c467 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/ViewsPluginManager.php
@@ -26,10 +26,11 @@ class ViewsPluginManager extends PluginManagerBase {
    *
    * @param string $type
    *   The plugin type, for example filter.
-   * @param array $namespaces
-   *   An array of paths keyed by it's corresponding namespaces.
+   * @param \Traversable $namespaces
+   *   An object that implements \Traversable which contains the root paths
+   *   keyed by the corresponding namespace to look for plugin implementations,
    */
-  public function __construct($type, array $namespaces = array()) {
+  public function __construct($type, \Traversable $namespaces) {
     $this->discovery = new AnnotatedClassDiscovery('views', $type, $namespaces);
     $this->discovery = new DerivativeDiscoveryDecorator($this->discovery);
     $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition'));
diff --git a/core/modules/views/views.services.yml b/core/modules/views/views.services.yml
index 7263f6714335a3bdc4358430559603dd8f633efd..657f2c6d88db97f750586b736e39cc6a3be82fed 100644
--- a/core/modules/views/views.services.yml
+++ b/core/modules/views/views.services.yml
@@ -1,61 +1,61 @@
 services:
   plugin.manager.views.access:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [access, '%container.namespaces%']
+    arguments: [access, '@container.namespaces']
   plugin.manager.views.area:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [area, '%container.namespaces%']
+    arguments: [area, '@container.namespaces']
   plugin.manager.views.argument:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [argument, '%container.namespaces%']
+    arguments: [argument, '@container.namespaces']
   plugin.manager.views.argument_default:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [argument_default, '%container.namespaces%']
+    arguments: [argument_default, '@container.namespaces']
   plugin.manager.views.argument_validator:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [argument_validator, '%container.namespaces%']
+    arguments: [argument_validator, '@container.namespaces']
   plugin.manager.views.cache:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [cache, '%container.namespaces%']
+    arguments: [cache, '@container.namespaces']
   plugin.manager.views.display_extender:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [display_extender, '%container.namespaces%']
+    arguments: [display_extender, '@container.namespaces']
   plugin.manager.views.display:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [display, '%container.namespaces%']
+    arguments: [display, '@container.namespaces']
   plugin.manager.views.exposed_form:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [exposed_form, '%container.namespaces%']
+    arguments: [exposed_form, '@container.namespaces']
   plugin.manager.views.field:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [field, '%container.namespaces%']
+    arguments: [field, '@container.namespaces']
   plugin.manager.views.filter:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [filter, '%container.namespaces%']
+    arguments: [filter, '@container.namespaces']
   plugin.manager.views.join:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [join, '%container.namespaces%']
+    arguments: [join, '@container.namespaces']
   plugin.manager.views.pager:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [pager, '%container.namespaces%']
+    arguments: [pager, '@container.namespaces']
   plugin.manager.views.query:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [query, '%container.namespaces%']
+    arguments: [query, '@container.namespaces']
   plugin.manager.views.relationship:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [relationship, '%container.namespaces%']
+    arguments: [relationship, '@container.namespaces']
   plugin.manager.views.row:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [row, '%container.namespaces%']
+    arguments: [row, '@container.namespaces']
   plugin.manager.views.sort:
     class: Drupal\views\Plugin\ViewsHandlerManager
-    arguments: [sort, '%container.namespaces%']
+    arguments: [sort, '@container.namespaces']
   plugin.manager.views.style:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [style, '%container.namespaces%']
+    arguments: [style, '@container.namespaces']
   plugin.manager.views.wizard:
     class: Drupal\views\Plugin\ViewsPluginManager
-    arguments: [wizard, '%container.namespaces%']
+    arguments: [wizard, '@container.namespaces']
   views.views_data:
     class: Drupal\views\ViewsDataCache
     arguments: ['@cache.views_info', '@config.factory', '@module_handler']