diff --git a/core/lib/Drupal/Component/Plugin/Discovery/AbstractAnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Plugin/Discovery/AbstractAnnotatedClassDiscovery.php
new file mode 100644
index 0000000..6112b6a
--- /dev/null
+++ b/core/lib/Drupal/Component/Plugin/Discovery/AbstractAnnotatedClassDiscovery.php
@@ -0,0 +1,128 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\Component\Plugin\Discovery\AnnotatedClassDiscovery.
+ */
+
+namespace Drupal\Component\Plugin\Discovery;
+
+use DirectoryIterator;
+use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
+use Drupal\Component\Reflection\MockFileFinder;
+use Doctrine\Common\Annotations\AnnotationReader;
+use Doctrine\Common\Annotations\AnnotationRegistry;
+use Doctrine\Common\Reflection\StaticReflectionParser;
+
+/**
+ * Defines a discovery mechanism to find annotated plugins in PSR-0 namespaces.
+ */
+abstract class AbstractAnnotatedClassDiscovery implements DiscoveryInterface {
+
+  /**
+   * The name of the annotation that contains the plugin definition.
+   *
+   * The class corresponding to this name must implement
+   * \Drupal\Component\Annotation\AnnotationInterface.
+   *
+   * @var string
+   */
+  protected $pluginDefinitionAnnotationName;
+
+  /**
+   * Constructs an AbstractAnnotatedClassDiscovery object.
+   *
+   * @param string $plugin_definition_annotation_name
+   *   (optional) The name of the annotation that contains the plugin definition.
+   *   Defaults to 'Drupal\Component\Annotation\Plugin'.
+   */
+  function __construct($plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
+    $this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name;
+  }
+
+  /**
+   * Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinition().
+   */
+  public function getDefinition($plugin_id) {
+    $plugins = $this->getDefinitions();
+    return isset($plugins[$plugin_id]) ? $plugins[$plugin_id] : NULL;
+  }
+
+  public function loadAnnotationClass($class) {
+
+    if (class_exists($class, FALSE)) {
+      return TRUE;
+    }
+
+    foreach ($this->getAnnotationNamespaces() as $namespace => $dirs) {
+      if (0 === strpos($class, $namespace)) {
+        $relativePath = str_replace('\\', '/', substr($class, strlen($namespace))) . '.php';
+        foreach ((array) $dirs as $dir) {
+          if (file_exists($file = $dir . '/' . $relativePath)) {
+            require $file;
+            return TRUE;
+          }
+        }
+      }
+    }
+
+    return FALSE;
+  }
+
+  /**
+   * Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
+   */
+  public function getDefinitions() {
+    $definitions = array();
+    $reader = new AnnotationReader();
+    // Prevent @endlink from being parsed as an annotation.
+    $reader->addGlobalIgnoredName('endlink');
+    $reader->addGlobalIgnoredName('file');
+
+    // Register the namespaces of classes that can be used for annotations.
+    AnnotationRegistry::registerLoader(array($this, 'loadAnnotationClass'));
+
+    // Search for classes within all PSR-0 namespace locations.
+    foreach ($this->getPluginNamespaces() as $namespace => $dirs) {
+      foreach ($dirs as $dir) {
+        if (file_exists($dir)) {
+          /**
+           * @var DirectoryIterator $fileinfo
+           */
+          foreach (new DirectoryIterator($dir) as $fileinfo) {
+            // @todo Once core requires 5.3.6, use $fileinfo->getExtension().
+            if (pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION) == 'php') {
+              $class = $namespace . '\\' . $fileinfo->getBasename('.php');
+
+              // The filename is already known, so there is no need to find the
+              // file. However, StaticReflectionParser needs a finder, so use a
+              // mock version.
+              $finder = MockFileFinder::create($fileinfo->getPathName());
+              $parser = new StaticReflectionParser($class, $finder);
+
+              if ($annotation = $reader->getClassAnnotation($parser->getReflectionClass(), $this->pluginDefinitionAnnotationName)) {
+                // AnnotationInterface::get() returns the array definition
+                // instead of requiring us to work with the annotation object.
+                $definition = $annotation->get();
+                $definition['class'] = $class;
+                $definitions[$definition['id']] = $definition;
+              }
+            }
+          }
+        }
+      }
+    }
+    return $definitions;
+  }
+
+  /**
+   * Returns an array of PSR-0 namespaces to search for plugin classes.
+   */
+  protected abstract function getPluginNamespaces();
+
+  /**
+   * Returns an array of PSR-0 namespaces to search for annotation classes.
+   */
+  protected abstract function getAnnotationNamespaces();
+
+}
diff --git a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php
index 13f853d..cf33fb8 100644
--- a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php
+++ b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php
@@ -7,17 +7,13 @@
 
 namespace Drupal\Component\Plugin\Discovery;
 
-use DirectoryIterator;
-use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
-use Drupal\Component\Reflection\MockFileFinder;
 use Doctrine\Common\Annotations\AnnotationReader;
 use Doctrine\Common\Annotations\AnnotationRegistry;
-use Doctrine\Common\Reflection\StaticReflectionParser;
 
 /**
  * Defines a discovery mechanism to find annotated plugins in PSR-0 namespaces.
  */
-class AnnotatedClassDiscovery implements DiscoveryInterface {
+class AnnotatedClassDiscovery extends AbstractAnnotatedClassDiscovery {
 
   /**
    * The namespaces within which to find plugin classes.
@@ -34,16 +30,6 @@ class AnnotatedClassDiscovery implements DiscoveryInterface {
   protected $annotationNamespaces;
 
   /**
-   * The name of the annotation that contains the plugin definition.
-   *
-   * The class corresponding to this name must implement
-   * \Drupal\Component\Annotation\AnnotationInterface.
-   *
-   * @var string
-   */
-  protected $pluginDefinitionAnnotationName;
-
-  /**
    * Constructs an AnnotatedClassDiscovery object.
    *
    * @param array $plugin_namespaces
@@ -59,70 +45,18 @@ class AnnotatedClassDiscovery implements DiscoveryInterface {
   function __construct($plugin_namespaces = array(), $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
     $this->pluginNamespaces = $plugin_namespaces;
     $this->annotationNamespaces = $annotation_namespaces;
-    $this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name;
-  }
-
-  /**
-   * Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinition().
-   */
-  public function getDefinition($plugin_id) {
-    $plugins = $this->getDefinitions();
-    return isset($plugins[$plugin_id]) ? $plugins[$plugin_id] : NULL;
-  }
-
-  /**
-   * Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
-   */
-  public function getDefinitions() {
-    $definitions = array();
-    $reader = new AnnotationReader();
-    // Prevent @endlink from being parsed as an annotation.
-    $reader->addGlobalIgnoredName('endlink');
-    $reader->addGlobalIgnoredName('file');
-
-    // Register the namespaces of classes that can be used for annotations.
-    AnnotationRegistry::registerAutoloadNamespaces($this->getAnnotationNamespaces());
-
-    // Search for classes within all PSR-0 namespace locations.
-    foreach ($this->getPluginNamespaces() as $namespace => $dirs) {
-      foreach ($dirs as $dir) {
-        $dir .= DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
-        if (file_exists($dir)) {
-          foreach (new DirectoryIterator($dir) as $fileinfo) {
-            // @todo Once core requires 5.3.6, use $fileinfo->getExtension().
-            if (pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION) == 'php') {
-              $class = $namespace . '\\' . $fileinfo->getBasename('.php');
-
-              // The filename is already known, so there is no need to find the
-              // file. However, StaticReflectionParser needs a finder, so use a
-              // mock version.
-              $finder = MockFileFinder::create($fileinfo->getPathName());
-              $parser = new StaticReflectionParser($class, $finder);
-
-              if ($annotation = $reader->getClassAnnotation($parser->getReflectionClass(), $this->pluginDefinitionAnnotationName)) {
-                // AnnotationInterface::get() returns the array definition
-                // instead of requiring us to work with the annotation object.
-                $definition = $annotation->get();
-                $definition['class'] = $class;
-                $definitions[$definition['id']] = $definition;
-              }
-            }
-          }
-        }
-      }
-    }
-    return $definitions;
+    parent::__construct($plugin_definition_annotation_name);
   }
 
   /**
-   * Returns an array of PSR-0 namespaces to search for plugin classes.
+   * @inheritdoc
    */
   protected function getPluginNamespaces() {
     return $this->pluginNamespaces;
   }
 
   /**
-   * Returns an array of PSR-0 namespaces to search for annotation classes.
+   * @inheritdoc
    */
   protected function getAnnotationNamespaces() {
     return $this->annotationNamespaces;
diff --git a/core/lib/Drupal/Core/Condition/ConditionManager.php b/core/lib/Drupal/Core/Condition/ConditionManager.php
index 7f5d630..a8b0c22 100644
--- a/core/lib/Drupal/Core/Condition/ConditionManager.php
+++ b/core/lib/Drupal/Core/Condition/ConditionManager.php
@@ -37,7 +37,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
     $this->setCacheBackend($cache_backend, $language_manager, 'condition');
 
     $annotation_namespaces = array(
-      'Drupal\Core\Condition\Annotation' => DRUPAL_ROOT . '/core/lib',
+      'Drupal\Core\Condition\Annotation' => DRUPAL_ROOT . '/core/lib/Drupal/Core/Condition/Annotation',
     );
     parent::__construct('Plugin/Condition', $namespaces, $annotation_namespaces, 'Drupal\Core\Condition\Annotation\Condition');
   }
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index af1fe52..4a702c6 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -507,14 +507,18 @@ protected function buildContainer() {
     $container->setParameter('container.modules', $this->getModuleFileNames());
 
     // Get a list of namespaces and put it onto the container.
-    $namespaces = $this->getModuleNamespaces($this->getModuleFileNames());
+    $namespaces = $this->getModuleNamespacesPsr4($this->getModuleFileNames());
     // Add all components in \Drupal\Core and \Drupal\Component that have a
     // Plugin directory.
     foreach (array('Core', 'Component') as $parent_directory) {
       $path = DRUPAL_ROOT . '/core/lib/Drupal/' . $parent_directory;
+      $parent_namespace = 'Drupal\\' . $parent_directory;
+      /**
+       * @var \DirectoryIterator $component
+       */
       foreach (new \DirectoryIterator($path) as $component) {
         if (!$component->isDot() && is_dir($component->getPathname() . '/Plugin')) {
-          $namespaces['Drupal\\' . $parent_directory  .'\\' . $component->getFilename()] = DRUPAL_ROOT . '/core/lib';
+          $namespaces[$parent_namespace . '\\' . $component->getFilename()] = $path . '/' . $component->getFilename();
         }
       }
     }
@@ -649,6 +653,17 @@ protected function getModuleFileNames() {
   /**
    * Gets the namespaces of each enabled module.
    */
+  protected function getModuleNamespacesPsr4($moduleFileNames) {
+    $namespaces = array();
+    foreach ($moduleFileNames as $module => $filename) {
+      $namespaces["Drupal\\$module"] = DRUPAL_ROOT . '/' . dirname($filename) . '/lib/Drupal/' . $module;
+    }
+    return $namespaces;
+  }
+
+  /**
+   * Gets the namespaces of each enabled module.
+   */
   protected function getModuleNamespaces($moduleFileNames) {
     $namespaces = array();
     foreach ($moduleFileNames as $module => $filename) {
diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php
index a662259..a14dcf9 100644
--- a/core/lib/Drupal/Core/Entity/EntityManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityManager.php
@@ -105,7 +105,7 @@ class EntityManager extends PluginManagerBase {
   public function __construct(\Traversable $namespaces, ContainerInterface $container, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManager $language_manager) {
     // Allow the plugin definition to be altered by hook_entity_info_alter().
     $annotation_namespaces = array(
-      'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib',
+      'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib/Drupal/Core/Entity/Annotation',
     );
 
     $this->moduleHandler = $module_handler;
@@ -148,6 +148,7 @@ public function hasController($entity_type, $controller_type) {
    *   (optional) If this controller definition is nested, the name of the key.
    *   Defaults to NULL.
    *
+   * @throws \InvalidArgumentException
    * @return string
    *   The class name for this controller instance.
    */
diff --git a/core/lib/Drupal/Core/Entity/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Entity/Field/FieldTypePluginManager.php
index 0be215e..d370004 100644
--- a/core/lib/Drupal/Core/Entity/Field/FieldTypePluginManager.php
+++ b/core/lib/Drupal/Core/Entity/Field/FieldTypePluginManager.php
@@ -43,7 +43,7 @@ class FieldTypePluginManager extends DefaultPluginManager {
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
     $annotation_namespaces = array(
-      'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib',
+      'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib/Drupal/Core/Entity/Annotation',
     );
     parent::__construct('Plugin/field/field_type', $namespaces, $annotation_namespaces, 'Drupal\Core\Entity\Annotation\FieldType');
     $this->alterInfo($module_handler, 'field_info');
diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
index 63c87ab..220422f 100644
--- a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
+++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
@@ -7,12 +7,12 @@
 
 namespace Drupal\Core\Plugin\Discovery;
 
-use Drupal\Component\Plugin\Discovery\AnnotatedClassDiscovery as ComponentAnnotatedClassDiscovery;
+use Drupal\Component\Plugin\Discovery\AbstractAnnotatedClassDiscovery;
 
 /**
  * Defines a discovery mechanism to find annotated plugins in PSR-0 namespaces.
  */
-class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
+class AnnotatedClassDiscovery extends AbstractAnnotatedClassDiscovery {
 
   /**
    * The subdirectory within a namespace to look for plugins.
@@ -22,7 +22,17 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
    *
    * @var string
    */
-  protected $subdir = '';
+  protected $directorySuffix = '';
+
+  /**
+   * The subdirectory within a namespace to look for plugins.
+   *
+   * If the plugins are in the top level of the namespace and not within a
+   * subdirectory, set this to an empty string.
+   *
+   * @var string
+   */
+  protected $namespaceSuffix = '';
 
   /**
    * An object containing the namespaces to look for plugin implementations.
@@ -32,6 +42,13 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
   protected $rootNamespacesIterator;
 
   /**
+   * The namespaces of classes that can be used as annotations.
+   *
+   * @var array
+   */
+  protected $annotationNamespaces;
+
+  /**
    * Constructs an AnnotatedClassDiscovery object.
    *
    * @param string $subdir
@@ -50,15 +67,18 @@ class AnnotatedClassDiscovery extends ComponentAnnotatedClassDiscovery {
    */
   function __construct($subdir, \Traversable $root_namespaces, $annotation_namespaces = array(), $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin') {
     if ($subdir) {
-      $this->subdir = str_replace('/', '\\', $subdir);
+      if ('/' !== $subdir[0]) {
+        $subdir = '/' . $subdir;
+      }
+      $this->directorySuffix = $subdir;
+      $this->namespaceSuffix = str_replace('/', '\\', $subdir);
     }
     $this->rootNamespacesIterator = $root_namespaces;
-    $annotation_namespaces += array(
-      'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib',
-      'Drupal\Core\Annotation' => DRUPAL_ROOT . '/core/lib',
+    $this->annotationNamespaces = $annotation_namespaces + array(
+      'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib/Drupal/Component/Annotation',
+      'Drupal\Core\Annotation' => DRUPAL_ROOT . '/core/lib/Drupal/Core/Annotation',
     );
-    $plugin_namespaces = array();
-    parent::__construct($plugin_namespaces, $annotation_namespaces, $plugin_definition_annotation_name);
+    parent::__construct($plugin_definition_annotation_name);
   }
 
   /**
@@ -99,14 +119,28 @@ protected function getProviderFromNamespace($namespace) {
    */
   protected function getPluginNamespaces() {
     $plugin_namespaces = array();
-    foreach ($this->rootNamespacesIterator as $namespace => $dir) {
-      if ($this->subdir) {
-        $namespace .= "\\{$this->subdir}";
+    if ($this->namespaceSuffix) {
+      foreach ($this->rootNamespacesIterator as $namespace => $dirs) {
+        $namespace .= $this->namespaceSuffix;
+        foreach ((array) $dirs as $dir) {
+          $plugin_namespaces[$namespace][] = $dir . $this->directorySuffix;
+        }
+      }
+    }
+    else {
+      foreach ($this->rootNamespacesIterator as $namespace => $dirs) {
+        $plugin_namespaces[$namespace] = (array) $dirs;
       }
-      $plugin_namespaces[$namespace] = array($dir);
     }
 
     return $plugin_namespaces;
   }
 
+  /**
+   * @inheritdoc
+   */
+  protected function getAnnotationNamespaces() {
+    return $this->annotationNamespaces;
+  }
+
 }
diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php
index f217fa5..c69bb28 100644
--- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php
+++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php
@@ -50,7 +50,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
     $this->setCacheBackend($cache_backend, $language_manager, 'typed_data:types');
 
     $annotation_namespaces = array(
-      'Drupal\Core\TypedData\Annotation' => DRUPAL_ROOT . '/core/lib',
+      'Drupal\Core\TypedData\Annotation' => DRUPAL_ROOT . '/core/lib/Drupal/Core/TypedData/Annotation',
     );
     parent::__construct('Plugin/DataType', $namespaces, $annotation_namespaces, 'Drupal\Core\TypedData\Annotation\DataType');
   }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php
index 67d8c4d..5b5c684 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/AggregatorPluginManager.php
@@ -35,7 +35,7 @@ public function __construct($type, \Traversable $namespaces) {
     );
 
     $annotation_namespaces = array(
-      'Drupal\aggregator\Annotation' => DRUPAL_ROOT . '/core/modules/aggregator/lib',
+      'Drupal\aggregator\Annotation' => DRUPAL_ROOT . '/core/modules/aggregator/lib/Drupal/aggregator/Annotation',
     );
 
     $this->discovery = new AnnotatedClassDiscovery("Plugin/aggregator/$type", $namespaces, $annotation_namespaces, $type_annotations[$type]);
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php b/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
index da2bcfd..439910c 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
@@ -33,7 +33,7 @@ class CKEditorPluginManager extends DefaultPluginManager {
    *   The module handler to invoke the alter hook with.
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
-    $annotation_namespaces = array('Drupal\ckeditor\Annotation' => $namespaces['Drupal\ckeditor']);
+    $annotation_namespaces = array('Drupal\ckeditor\Annotation' => $namespaces['Drupal\ckeditor'] . '/Annotation');
     parent::__construct('Plugin/CKEditorPlugin', $namespaces, $annotation_namespaces, 'Drupal\ckeditor\Annotation\CKEditorPlugin');
     $this->alterInfo($module_handler, 'ckeditor_plugin_info');
     $this->setCacheBackend($cache_backend, $language_manager, 'ckeditor_plugin');
diff --git a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditorManager.php b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditorManager.php
index 79f8013..8d4d8a6 100644
--- a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditorManager.php
+++ b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditorManager.php
@@ -29,7 +29,7 @@ class InPlaceEditorManager extends PluginManagerBase {
    *   keyed by the corresponding namespace to look for plugin implementations,
    */
   public function __construct(\Traversable $namespaces) {
-    $annotation_namespaces = array('Drupal\edit\Annotation' => $namespaces['Drupal\edit']);
+    $annotation_namespaces = array('Drupal\edit\Annotation' => $namespaces['Drupal\edit'] . '/Annotation');
     $this->discovery = new AnnotatedClassDiscovery('Plugin/InPlaceEditor', $namespaces, $annotation_namespaces, 'Drupal\edit\Annotation\InPlaceEditor');
     $this->discovery = new AlterDecorator($this->discovery, 'edit_editor');
     $this->discovery = new CacheDecorator($this->discovery, 'edit:editor');
diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
index 9adf267..93e998f 100644
--- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
+++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
@@ -31,7 +31,7 @@ class EditorManager extends DefaultPluginManager {
    *   The module handler to invoke the alter hook with.
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
-    $annotation_namespaces = array('Drupal\editor\Annotation' => $namespaces['Drupal\editor']);
+    $annotation_namespaces = array('Drupal\editor\Annotation' => $namespaces['Drupal\editor'] . '/Annotation');
     parent::__construct('Plugin/Editor', $namespaces, $annotation_namespaces, 'Drupal\editor\Annotation\Editor');
     $this->alterInfo($module_handler, 'editor_info');
     $this->setCacheBackend($cache_backend, $language_manager, 'editor');
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 11582f2..97a135d 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
@@ -27,7 +27,7 @@ class SelectionPluginManager extends DefaultPluginManager {
    * {@inheritdoc}
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
-    $annotation_namespaces = array('Drupal\entity_reference\Annotation' => $namespaces['Drupal\entity_reference']);
+    $annotation_namespaces = array('Drupal\entity_reference\Annotation' => $namespaces['Drupal\entity_reference'] . '/Annotation');
     $this->discovery = new AnnotatedClassDiscovery('Plugin/entity_reference/selection', $namespaces, $annotation_namespaces, 'Drupal\entity_reference\Annotation\EntityReferenceSelection');
 
     // We're not using the parent constructor because we use a different factory
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 3b5c813..02062c1 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
@@ -54,7 +54,7 @@ class FormatterPluginManager extends DefaultPluginManager {
    *   The 'field type' plugin manager.
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LanguageManager $language_manager, FieldTypePluginManager $field_type_manager) {
-    $annotation_namespaces = array('Drupal\field\Annotation' => $namespaces['Drupal\field']);
+    $annotation_namespaces = array('Drupal\field\Annotation' => $namespaces['Drupal\field'] . '/Annotation');
 
     parent::__construct('Plugin/field/formatter', $namespaces, $annotation_namespaces, 'Drupal\field\Annotation\FieldFormatter');
 
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 12bb296..0098a75 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
@@ -54,7 +54,7 @@ class WidgetPluginManager extends DefaultPluginManager {
    *   The 'field type' plugin manager.
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, LanguageManager $language_manager, FieldTypePluginManager $field_type_manager) {
-    $annotation_namespaces = array('Drupal\field\Annotation' => $namespaces['Drupal\field']);
+    $annotation_namespaces = array('Drupal\field\Annotation' => $namespaces['Drupal\field'] . '/Annotation');
 
     parent::__construct('Plugin/field/widget', $namespaces, $annotation_namespaces, 'Drupal\field\Annotation\FieldWidget');
 
diff --git a/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php b/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php
index 3d9b649..b897a18 100644
--- a/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php
+++ b/core/modules/filter/lib/Drupal/filter/FilterPluginManager.php
@@ -30,7 +30,7 @@ class FilterPluginManager extends PluginManagerBase {
    *   keyed by the corresponding namespace to look for plugin implementations.
    */
   public function __construct(\Traversable $namespaces) {
-    $annotation_namespaces = array('Drupal\filter\Annotation' => $namespaces['Drupal\filter']);
+    $annotation_namespaces = array('Drupal\filter\Annotation' => $namespaces['Drupal\filter'] . '/Annotation');
     $this->discovery = new AnnotatedClassDiscovery('Plugin/Filter', $namespaces, $annotation_namespaces, 'Drupal\filter\Annotation\Filter');
     $this->discovery = new AlterDecorator($this->discovery, 'filter_info');
     $cache_key = 'filter_plugins:' . language(Language::TYPE_INTERFACE)->id;
diff --git a/core/modules/image/lib/Drupal/image/ImageEffectManager.php b/core/modules/image/lib/Drupal/image/ImageEffectManager.php
index 64e251e..c07121d 100644
--- a/core/modules/image/lib/Drupal/image/ImageEffectManager.php
+++ b/core/modules/image/lib/Drupal/image/ImageEffectManager.php
@@ -21,7 +21,7 @@ class ImageEffectManager extends DefaultPluginManager {
    * {@inheritdoc}
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
-    $annotation_namespaces = array('Drupal\image\Annotation' => $namespaces['Drupal\image']);
+    $annotation_namespaces = array('Drupal\image\Annotation' => $namespaces['Drupal\image'] . '/Annotation');
     parent::__construct('Plugin/ImageEffect', $namespaces, $annotation_namespaces, 'Drupal\image\Annotation\ImageEffect');
 
     $this->alterInfo($module_handler, 'image_effect_info');
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 6f43b57..307582a 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
@@ -57,7 +57,9 @@ public function setUp() {
         'provider' => 'plugin_test',
       ),
     );
-    $namespaces = new \ArrayObject(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/Drupal/plugin_test',
+    ));
     $this->discovery = new AnnotatedClassDiscovery('Plugin/plugin_test/fruit', $namespaces);
     $this->emptyDiscovery = new AnnotatedClassDiscovery('Plugin/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 b572919..cf3babb 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
@@ -41,9 +41,11 @@ protected function setUp() {
         'provider' => 'plugin_test',
       ),
     );
-    $root_namespaces = new \ArrayObject(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/Drupal/plugin_test'
+    ));
     $annotation_namespaces = array(
-      'Drupal\plugin_test\Plugin\Annotation' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib',
+      'Drupal\plugin_test\Plugin\Annotation' => DRUPAL_ROOT . '/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Plugin/Annotation',
     );
 
     $this->discovery = new AnnotatedClassDiscovery('Plugin/plugin_test/custom_annotation', $root_namespaces, $annotation_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
index c005300..01e764a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php
@@ -39,7 +39,9 @@ protected function setUp() {
         'provider' => 'plugin_test',
       ),
     );
-    $namespaces = new \ArrayObject(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/Drupal/plugin_test',
+    ));
     $this->discovery = new AnnotatedClassDiscovery('', $namespaces);
     $empty_namespaces = new \ArrayObject();
     $this->emptyDiscovery = new AnnotatedClassDiscovery('', $empty_namespaces);
diff --git a/core/modules/tour/lib/Drupal/tour/TipPluginManager.php b/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
index fb18d3b..7bb9f35 100644
--- a/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
+++ b/core/modules/tour/lib/Drupal/tour/TipPluginManager.php
@@ -31,7 +31,7 @@ class TipPluginManager extends DefaultPluginManager {
    *   The module handler to invoke the alter hook with.
    */
   public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) {
-    $annotation_namespaces = array('Drupal\tour\Annotation' => $namespaces['Drupal\tour']);
+    $annotation_namespaces = array('Drupal\tour\Annotation' => $namespaces['Drupal\tour'] . '/Annotation');
     parent::__construct('Plugin/tour/tip', $namespaces, $annotation_namespaces, 'Drupal\tour\Annotation\Tip');
 
     $this->alterInfo($module_handler, 'tour_tips_info');
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 460ef5a..2069940 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/Discovery/ViewsHandlerDiscovery.php
@@ -22,13 +22,6 @@ 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
@@ -39,19 +32,9 @@ class ViewsHandlerDiscovery extends AnnotatedClassDiscovery {
    */
   function __construct($type, \Traversable $root_namespaces) {
     $this->type = $type;
-    $this->rootNamespacesIterator = $root_namespaces;
 
-    $annotation_namespaces = array(
-      'Drupal\Component\Annotation' => DRUPAL_ROOT . '/core/lib',
-    );
-    $plugin_namespaces = array();
-    foreach ($root_namespaces as $namespace => $dir) {
-      $plugin_namespaces["$namespace\\Plugin\\views\\{$type}"] = array($dir);
-    }
-
-    $this->pluginNamespaces = $plugin_namespaces;
-    $this->annotationNamespaces = $annotation_namespaces;
-    $this->pluginDefinitionAnnotationName = 'Drupal\Component\Annotation\PluginID';
+    parent::__construct("Plugin/views/$type", $root_namespaces, array(), 'Drupal\Component\Annotation\PluginID');
+    unset($this->annotationNamespaces['Drupal\Core\Annotation']);
   }
 
   /**
@@ -66,16 +49,4 @@ 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;
-  }
-
 }
