diff --git a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php index d9c1bc3..2088ae1 100644 --- a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -7,9 +7,8 @@ namespace Drupal\Component\Plugin\Discovery; -use Drupal\Component\Plugin\Discovery\DiscoveryInterface; +use Doctrine\Common\Annotations\SimpleAnnotationReader; use Drupal\Component\Reflection\MockFileFinder; -use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Reflection\StaticReflectionParser; @@ -63,10 +62,16 @@ public function getDefinition($plugin_id) { */ public function getDefinitions() { $definitions = array(); - $reader = new AnnotationReader(); - // Prevent @endlink from being parsed as an annotation. - $reader->addGlobalIgnoredName('endlink'); - $reader->addGlobalIgnoredName('file'); + + $reader = new SimpleAnnotationReader(); + + // Add the Core annotation classes like @Translation. + $reader->addNamespace('Drupal\Core\Annotation', array(DRUPAL_ROOT . '/core/lib/Drupal/Core/Annotation')); + + // Add the namespaces from the main plugin annotation, like @EntityType. + $explode = explode('\\', $this->pluginDefinitionAnnotationName); + array_pop($explode); + $reader->addNamespace(implode('\\', $explode)); // Clear the annotation loaders of any previous annotation classes. AnnotationRegistry::reset(); diff --git a/core/modules/contact/lib/Drupal/contact/Entity/Message.php b/core/modules/contact/lib/Drupal/contact/Entity/Message.php index 0c3c622..f81b456 100644 --- a/core/modules/contact/lib/Drupal/contact/Entity/Message.php +++ b/core/modules/contact/lib/Drupal/contact/Entity/Message.php @@ -7,8 +7,6 @@ namespace Drupal\contact\Entity; -use Drupal\Core\Entity\Annotation\EntityType; -use Drupal\Core\Annotation\Translation; use Drupal\Core\Entity\EntityNG; use Drupal\contact\MessageInterface; diff --git a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php index d6493f5..de98bdc 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php @@ -11,8 +11,6 @@ use Symfony\Component\Routing\Route; use Symfony\Component\HttpFoundation\Request; -use Drupal\Core\Entity\Annotation\EntityType; -use Drupal\Core\Annotation\Translation; use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; diff --git a/core/modules/node/lib/Drupal/node/Entity/Node.php b/core/modules/node/lib/Drupal/node/Entity/Node.php index f69bf1a..7ac7c5f 100644 --- a/core/modules/node/lib/Drupal/node/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Entity/Node.php @@ -9,8 +9,6 @@ use Drupal\Core\Entity\EntityNG; use Drupal\Core\Entity\EntityStorageControllerInterface; -use Drupal\Core\Entity\Annotation\EntityType; -use Drupal\Core\Annotation\Translation; use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\node\NodeInterface; diff --git a/core/modules/user/lib/Drupal/user/Entity/Role.php b/core/modules/user/lib/Drupal/user/Entity/Role.php index 8529e87..802e7f3 100644 --- a/core/modules/user/lib/Drupal/user/Entity/Role.php +++ b/core/modules/user/lib/Drupal/user/Entity/Role.php @@ -7,8 +7,6 @@ namespace Drupal\user\Entity; -use Drupal\Core\Entity\Annotation\EntityType; -use Drupal\Core\Annotation\Translation; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\user\RoleInterface; diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php index 0a18545..c9d215e 100644 --- a/core/modules/user/lib/Drupal/user/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Entity/User.php @@ -10,8 +10,6 @@ use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Entity\EntityMalformedException; use Drupal\Core\Entity\EntityNG; -use Drupal\Core\Entity\Annotation\EntityType; -use Drupal\Core\Annotation\Translation; use Drupal\user\UserInterface; /** diff --git a/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php index b8e69bd..ef59223 100644 --- a/core/modules/views/lib/Drupal/views/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Entity/View.php @@ -13,8 +13,6 @@ use Drupal\views_ui\ViewUI; use Drupal\views\ViewStorageInterface; use Drupal\views\ViewExecutable; -use Drupal\Core\Entity\Annotation\EntityType; -use Drupal\Core\Annotation\Translation; /** * Defines a View configuration entity class. diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php b/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php index 293d6f6..8acef0b 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/row/EntityRow.php @@ -10,7 +10,6 @@ use Drupal\Core\Entity\EntityManager; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\ViewExecutable; -use Drupal\views\Annotation\ViewsRow; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultStyle.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultStyle.php index d379cde..e315c1c 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultStyle.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/DefaultStyle.php @@ -7,9 +7,6 @@ namespace Drupal\views\Plugin\views\style; -use Drupal\views\Annotation\ViewsStyle; -use Drupal\Core\Annotation\Translation; - /** * Unformatted style plugin to render rows one after another with no * decorations.