diff --git a/core/config/schema/core.entity.schema.yml b/core/config/schema/core.entity.schema.yml
index f6442f7..aab3c1a 100644
--- a/core/config/schema/core.entity.schema.yml
+++ b/core/config/schema/core.entity.schema.yml
@@ -272,26 +272,3 @@ field.formatter.settings.timestamp_ago:
   type: mapping
   label: 'Timestamp ago display format settings'
 
-field.formatter.settings.entity_reference_entity_view:
-  type: mapping
-  label: 'Entity reference rendered entity display format settings'
-  mapping:
-    view_mode:
-      type: string
-      label: 'View mode'
-    link:
-      type: boolean
-      label: 'Show links'
-
-field.formatter.settings.entity_reference_entity_id:
-  type: mapping
-  label: 'Entity reference entity ID display format settings'
-
-field.formatter.settings.entity_reference_label:
-  type: mapping
-  label: 'Entity reference label display format settings'
-  mapping:
-    link:
-      type: boolean
-      label: 'Link label to the referenced entity'
-
diff --git a/core/core.services.yml b/core/core.services.yml
index 9f35c9d..f6fd440 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -179,7 +179,6 @@ services:
   cron:
     class: Drupal\Core\Cron
     arguments: ['@module_handler', '@lock', '@queue', '@state', '@account_switcher', '@logger.channel.cron', '@plugin.manager.queue_worker']
-    lazy: true
   diff.formatter:
     class: Drupal\Core\Diff\DiffFormatter
     arguments: ['@config.factory']
@@ -398,7 +397,6 @@ services:
     parent: default_plugin_manager
   plugin.cache_clearer:
     class: Drupal\Core\Plugin\CachedDiscoveryClearer
-    lazy: true
   paramconverter.menu_link:
     class: Drupal\Core\ParamConverter\MenuLinkPluginConverter
     tags:
diff --git a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php b/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php
deleted file mode 100644
index f2e25c5..0000000
--- a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php
+++ /dev/null
@@ -1,277 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Component\ProxyBuilder\ProxyBuilder.
- */
-
-namespace Drupal\Component\ProxyBuilder;
-
-/**
- * Generates the string representation of the proxy service.
- */
-class ProxyBuilder {
-
-  /**
-   * Generates the used proxy class name from a given class name.
-   *
-   * @param string $class_name
-   *   The class name of the actual service.
-   *
-   * @return string
-   *   The class name of the proxy.
-   */
-  public static function buildProxyClassName($class_name) {
-    return str_replace('\\', '_', $class_name) . '_Proxy';
-  }
-
-  /**
-   * Builds a proxy class string.
-   *
-   * @param string $class_name
-   *   The class name of the actual service.
-   *
-   * @return string
-   *   The full string with namespace class and methods.
-   */
-  public function build($class_name) {
-    $reflection = new \ReflectionClass($class_name);
-
-    $output = '';
-    $class_documentation = <<<'EOS'
-/**
- * Provides a proxy class for \{{ class_name }}.
- *
- * @see \Drupal\Component\ProxyBuilder
- */
-
-EOS;
-    $class_start = 'class {{ proxy_class_name }}';
-
-    if ($interfaces = $reflection->getInterfaceNames()) {
-      foreach ($interfaces as &$interface) {
-        $interface = '\\' . $interface;
-      }
-      $class_start .= ' implements ' . implode(', ', $interfaces);
-    }
-
-    $output .= $this->buildUseStatements();
-
-    // The actual class;
-    $properties = <<<'EOS'
-/**
- * @var string
- */
-protected $serviceId;
-
-/**
- * @var \{{ class_name }}
- */
-protected $service;
-
-/**
- * The service container.
- *
- * @var \Symfony\Component\DependencyInjection\ContainerInterface
- */
-protected $container;
-
-
-EOS;
-
-    $output .= $properties;
-
-    // Add all the methods.
-    $methods = [];
-    $methods[] = $this->buildConstructorMethod();
-    $methods[] = $this->buildLazyLoadItselfMethod();
-
-    // Add all the methods of the proxied service.
-    $reflection_methods = $reflection->getMethods();
-
-    foreach ($reflection_methods as $method) {
-      if ($method->getName() === '__construct') {
-        continue;
-      }
-
-      if ($method->isPublic()) {
-        $methods[] = $this->buildMethod($method) . "\n";
-      }
-    }
-
-    $output .= implode("\n", $methods);
-
-    // Indent the output.
-    $output = implode("\n", array_map(function($value) {
-      if ($value === '') {
-        return $value;
-      }
-      return "    $value";
-    }, explode("\n", $output)));
-
-    $final_output = $class_documentation . $class_start . "\n{\n\n" . $output . "\n}\n";
-
-    $final_output = str_replace('{{ class_name }}', $class_name, $final_output);
-    $final_output = str_replace('{{ proxy_class_name }}', $this->buildProxyClassName($class_name), $final_output);
-
-    return $final_output;
-  }
-
-  /**
-   * Generates the string for the method which loads the actual service.
-   *
-   * @return string
-   */
-  protected function buildLazyLoadItselfMethod() {
-    $output = <<<'EOS'
-protected function lazyLoadItself()
-{
-    if (!isset($this->service)) {
-        $method_name = 'get' . Container::camelize($this->serviceId) . 'Service';
-        $this->service = $this->container->$method_name(false);
-    }
-
-    return $this->service;
-}
-
-EOS;
-
-    return $output;
-  }
-
-  /**
-   * Generates the string representation of a single method: signature, body.
-   *
-   * @param \ReflectionMethod $reflection_method
-   *   A reflection method for the method.
-   *
-   * @return string
-   */
-  protected function buildMethod(\ReflectionMethod $reflection_method) {
-
-    $parameters = [];
-    foreach ($reflection_method->getParameters() as $parameter) {
-      $parameters[] = $this->buildParameter($parameter);
-    }
-
-    $function_name = $reflection_method->getName();
-
-    $reference = '';
-    if ($reflection_method->returnsReference()) {
-      $reference = '&';
-    }
-    if ($reflection_method->isStatic()) {
-      $signature_line = 'public static function ' . $reference . $function_name . '(';
-    }
-    else {
-      $signature_line = 'public function ' . $reference . $function_name . '(';
-    }
-
-    $signature_line .= implode(', ', $parameters);
-    $signature_line .= ')';
-
-    $output = $signature_line . "\n{\n";
-
-    $output .= $this->buildMethodBody($reflection_method);
-
-    $output .= "\n". '}';
-    return $output;
-  }
-
-  /**
-   * Builds a string for a single parameter of a method.
-   *
-   * @param \ReflectionParameter $parameter
-   *   A reflection object of the parameter.
-   *
-   * @return string
-   */
-  protected function buildParameter(\ReflectionParameter $parameter) {
-    $parameter_string = '';
-
-    if ($parameter->isArray()) {
-      $parameter_string .= 'array ';
-    }
-    elseif ($parameter->isCallable()) {
-      $parameter_string .= 'callable ';
-    }
-    elseif ($class = $parameter->getClass()) {
-      $parameter_string .= '\\' . $class->getName() . ' ';
-    }
-
-    if ($parameter->isPassedByReference()) {
-      $parameter_string .= '&';
-    }
-
-    $parameter_string .= '$' . $parameter->getName();
-
-    if ($parameter->isDefaultValueAvailable()) {
-      $parameter_string .= ' = ';
-      $parameter_string .= var_export($parameter->getDefaultValue(), TRUE);
-    }
-
-    return $parameter_string;
-  }
-
-  /**
-   * Builds the body of a wrapped method.
-   *
-   * @param \ReflectionMethod $reflection_method
-   *   A reflection method for the method.
-   *
-   * @return string
-   */
-  protected function buildMethodBody(\ReflectionMethod $reflection_method) {
-    $output = '';
-
-    $function_name = $reflection_method->getName();
-
-    if (!$reflection_method->isStatic()) {
-      $output .= '    return $this->lazyLoadItself()->' . $function_name . '(';
-    }
-    else {
-      $class_name = $reflection_method->getDeclaringClass()->getName();
-      $output .= "    \\$class_name::$function_name(";
-    }
-
-    // Add parameters;
-    $parameters = [];
-    foreach ($reflection_method->getParameters() as $parameter) {
-      $parameters[] = '$' . $parameter->getName();
-    }
-
-    $output .= implode(', ', $parameters) . ');';
-
-    return $output;
-  }
-
-  /**
-   * Builds the constructor used to inject the actual service ID.
-   *
-   * @return string
-   */
-  protected function buildConstructorMethod() {
-    $output = <<<'EOS'
-public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, $serviceId)
-{
-    $this->container = $container;
-    $this->serviceId = $serviceId;
-}
-
-EOS;
-
-    return $output;
-  }
-
-  /**
-   * Build the required use statements of the proxy class.
-   *
-   * @return string
-   */
-  protected function buildUseStatements() {
-    $output = '';
-
-    return $output;
-  }
-
-}
diff --git a/core/lib/Drupal/Component/ProxyBuilder/ProxyDumper.php b/core/lib/Drupal/Component/ProxyBuilder/ProxyDumper.php
deleted file mode 100644
index 99eae59..0000000
--- a/core/lib/Drupal/Component/ProxyBuilder/ProxyDumper.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Component\ProxyBuilder\ProxyDumper.
- */
-
-namespace Drupal\Component\ProxyBuilder;
-
-use Symfony\Component\DependencyInjection\Definition;
-use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
-
-/**
- * Dumps the proxy service into the dumped PHP container file.
- */
-class ProxyDumper implements DumperInterface {
-
-  /**
-   * The proxy builder.
-   *
-   * @var \Drupal\Component\ProxyBuilder\ProxyBuilder
-   */
-  protected $builder;
-
-  public function __construct(ProxyBuilder $builder) {
-    $this->builder = $builder;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isProxyCandidate(Definition $definition) {
-    return $definition->isLazy() && ($class = $definition->getClass()) && class_exists($class);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getProxyFactoryCode(Definition $definition, $id) {
-    // Note: the specific get method is called initially with $lazyLoad=TRUE;
-    // When you want to retrieve the actual service, the code generated in
-    // ProxyBuilder calls the method with lazy loading disabled.
-    $output = <<<'EOS'
-        if ($lazyLoad) {
-            return $this->services['{{ id }}'] = new {{ class_name }}($this, '{{ id }}');
-        }
-
-EOS;
-    $output = str_replace('{{ id }}', $id, $output);
-    $output = str_replace('{{ class_name }}', $this->builder->buildProxyClassName($definition->getClass()), $output);
-
-    return $output;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getProxyCode(Definition $definition) {
-    return $this->builder->build($definition->getClass());
-  }
-
-}
diff --git a/core/lib/Drupal/Component/ProxyBuilder/composer.json b/core/lib/Drupal/Component/ProxyBuilder/composer.json
deleted file mode 100644
index 0d3e5eb..0000000
--- a/core/lib/Drupal/Component/ProxyBuilder/composer.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
-  "name": "drupal/proxy-builder",
-  "description": "Provides a lightweight mechanism to provide lazy loaded proxies.",
-  "keywords": ["drupal", "proxy"],
-  "homepage": "https://drupal.org/project/drupal",
-  "license": "GPL-2.0+",
-  "require": {
-    "php": ">=5.4.2",
-    "symfony/dependency-injection": "~2.6"
-  },
-  "autoload": {
-    "psr-4": {
-      "Drupal\\Component\\ProxyBuilder\\": ""
-    }
-  }
-}
\ No newline at end of file
diff --git a/core/lib/Drupal/Core/Block/BlockBase.php b/core/lib/Drupal/Core/Block/BlockBase.php
index 6874543..ba1026b 100644
--- a/core/lib/Drupal/Core/Block/BlockBase.php
+++ b/core/lib/Drupal/Core/Block/BlockBase.php
@@ -119,7 +119,7 @@ public function calculateDependencies() {
   /**
    * {@inheritdoc}
    */
-  public function access(AccountInterface $account, $return_as_object = FALSE) {
+  public function access(AccountInterface $account) {
     // @todo Remove self::blockAccess() and force individual plugins to return
     //   their own AccessResult logic. Until that is done in
     //   https://www.drupal.org/node/2375689 the access will be set uncacheable.
@@ -129,9 +129,7 @@ public function access(AccountInterface $account, $return_as_object = FALSE) {
     else {
       $access = AccessResult::forbidden();
     }
-
-    $access->setCacheable(FALSE);
-    return $return_as_object ? $access : $access->isAllowed();
+    return $access->setCacheable(FALSE);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Block/BlockPluginInterface.php b/core/lib/Drupal/Core/Block/BlockPluginInterface.php
index 10ec23e..a42027e 100644
--- a/core/lib/Drupal/Core/Block/BlockPluginInterface.php
+++ b/core/lib/Drupal/Core/Block/BlockPluginInterface.php
@@ -46,19 +46,13 @@ public function label();
    *
    * @param \Drupal\Core\Session\AccountInterface $account
    *   The user session for which to check access.
-   * @param bool $return_as_object
-   *   (optional) Defaults to FALSE.
    *
-   * @return bool|\Drupal\Core\Access\AccessResultInterface
-   *   The access result. Returns a boolean if $return_as_object is FALSE (this
-   *   is the default) and otherwise an AccessResultInterface object.
-   *   When a boolean is returned, the result of AccessInterface::isAllowed() is
-   *   returned, i.e. TRUE means access is explicitly allowed, FALSE means
-   *   access is either explicitly forbidden or "no opinion".
+   * @return \Drupal\Core\Access\AccessResultInterface
+   *   An access result object instantiated and configured by the block plugin.
    *
    * @see \Drupal\block\BlockAccessControlHandler
    */
-  public function access(AccountInterface $account, $return_as_object = FALSE);
+  public function access(AccountInterface $account);
 
   /**
    * Builds and returns the renderable array for this block plugin.
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php
index 6cf82fc..a0ecdcf 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php
@@ -21,7 +21,7 @@ class ConfigEntityListBuilder extends EntityListBuilder {
    * {@inheritdoc}
    */
   public function load() {
-    $entities = $this->storage->loadMultipleOverrideFree();
+    $entities = parent::load();
 
     // Sort the entities using the entity class's sort() method.
     // See \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
index 7057491..ca6ed7a 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
@@ -420,26 +420,4 @@ public function updateFromStorageRecord(ConfigEntityInterface $entity, array $va
     return $entity;
   }
 
-  /**
-   * {@inheritdoc}
-   */
-  public function loadOverrideFree($id) {
-    $old_state = $this->configFactory->getOverrideState();
-    $this->configFactory->setOverrideState(FALSE);
-    $entity = $this->load($id);
-    $this->configFactory->setOverrideState($old_state);
-    return $entity;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function loadMultipleOverrideFree(array $ids = NULL) {
-    $old_state = $this->configFactory->getOverrideState();
-    $this->configFactory->setOverrideState(FALSE);
-    $entities = $this->loadMultiple($ids);
-    $this->configFactory->setOverrideState($old_state);
-    return $entities;
-  }
-
 }
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php
index 78d86df..62c36f9 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorageInterface.php
@@ -65,27 +65,4 @@ public function createFromStorageRecord(array $values);
    */
   public function updateFromStorageRecord(ConfigEntityInterface $entity, array $values);
 
-  /**
-   * Loads one entity in their original form without overrides.
-   *
-   * @param mixed $id
-   *   The ID of the entity to load.
-   *
-   * @return \Drupal\Core\Entity\EntityInterface|null
-   *   An entity object. NULL if no matching entity is found.
-   */
-  public function loadOverrideFree($id);
-
-  /**
-   * Loads one or more entities in their original form without overrides.
-   *
-   * @param $ids
-   *   An array of entity IDs, or NULL to load all entities.
-   *
-   * @return \Drupal\Core\Entity\EntityInterface[]
-   *   An array of entity objects indexed by their IDs. Returns an empty array
-   *   if no matching entities found.
-   */
-  public function loadMultipleOverrideFree(array $ids = NULL);
-
 }
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 6971718..5c8fe7e 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -7,7 +7,6 @@
 
 namespace Drupal\Core;
 
-use Drupal\Component\ProxyBuilder\ProxyDumper;
 use Drupal\Component\Utility\Crypt;
 use Drupal\Component\Utility\Timer;
 use Drupal\Component\Utility\Unicode;
@@ -23,7 +22,6 @@
 use Drupal\Core\Language\Language;
 use Drupal\Core\PageCache\RequestPolicyInterface;
 use Drupal\Core\PhpStorage\PhpStorageFactory;
-use Drupal\Core\ProxyBuilder\ProxyBuilder;
 use Drupal\Core\Site\Settings;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -1091,7 +1089,6 @@ protected function dumpDrupalContainer(ContainerBuilder $container, $baseClass)
     }
     // Cache the container.
     $dumper = new PhpDumper($container);
-    $dumper->setProxyDumper(new ProxyDumper(new ProxyBuilder()));
     $class = $this->getClassName();
     $content = $dumper->dump(array('class' => $class, 'base_class' => $baseClass));
     return $this->storage()->save($class . '.php', $content);
diff --git a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueConfigEntityStorage.php b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueConfigEntityStorage.php
deleted file mode 100644
index 858ff51..0000000
--- a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueConfigEntityStorage.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Entity\KeyValueStore\KeyValueConfigEntityStorage.
- */
-
-namespace Drupal\Core\Entity\KeyValueStore;
-
-use Drupal\Component\Uuid\UuidInterface;
-use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
-use Drupal\Core\Entity\EntityTypeInterface;
-use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
-use Drupal\Core\Language\LanguageManagerInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Config\Entity\ConfigEntityInterface;
-
-/**
- * Provides a key value backend for configuration entities.
- */
-class KeyValueConfigEntityStorage extends KeyValueEntityStorage implements ConfigEntityStorageInterface {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function getIDFromConfigName($config_name, $config_prefix) {
-    // @todo Implement and test. See https://www.drupal.org/node/2406645
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function createFromStorageRecord(array $values) {
-    // @todo Implement and test. See https://www.drupal.org/node/2406645
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function updateFromStorageRecord(ConfigEntityInterface $entity, array $values) {
-    // @todo Implement and test. See https://www.drupal.org/node/2406645
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function loadOverrideFree($id) {
-    // KeyValueEntityStorage does not support storing and retrieving overrides,
-    // it does not use the configuration factory. This is just a test method.
-    // See https://www.drupal.org/node/2393751.
-    return $this->load($id);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function loadMultipleOverrideFree(array $ids = NULL) {
-    // KeyValueEntityStorage does not support storing and retrieving overrides,
-    // it does not use the configuration factory. This is just a test method.
-    // See https://www.drupal.org/node/2393751.
-    return $this->loadMultiple($ids);
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
deleted file mode 100644
index 1328f65..0000000
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
+++ /dev/null
@@ -1,165 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter.
- */
-
-namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
-
-use Drupal\Core\Field\FieldDefinitionInterface;
-use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Logger\LoggerChannelFactoryInterface;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Plugin implementation of the 'entity reference rendered entity' formatter.
- *
- * @FieldFormatter(
- *   id = "entity_reference_entity_view",
- *   label = @Translation("Rendered entity"),
- *   description = @Translation("Display the referenced entities rendered by entity_view()."),
- *   field_types = {
- *     "entity_reference"
- *   }
- * )
- */
-class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implements ContainerFactoryPluginInterface {
-
-  /**
-   * The logger factory.
-   *
-   * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
-   */
-  protected $loggerFactory;
-
-  /**
-   * Constructs a StringFormatter instance.
-   *
-   * @param string $plugin_id
-   *   The plugin_id for the formatter.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
-   *   The definition of the field to which the formatter is associated.
-   * @param array $settings
-   *   The formatter settings.
-   * @param string $label
-   *   The formatter label display setting.
-   * @param string $view_mode
-   *   The view mode.
-   * @param array $third_party_settings
-   *   Any third party settings settings.
-   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
-   *   The entity manager.
-   * @param LoggerChannelFactoryInterface $logger_factory
-   *   The logger factory.
-   */
-  public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, LoggerChannelFactoryInterface $logger_factory) {
-    parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
-    $this->loggerFactory = $logger_factory;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
-    return new static(
-      $plugin_id,
-      $plugin_definition,
-      $configuration['field_definition'],
-      $configuration['settings'],
-      $configuration['label'],
-      $configuration['view_mode'],
-      $configuration['third_party_settings'],
-      $container->get('logger.factory')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function defaultSettings() {
-    return array(
-      'view_mode' => 'default',
-      'link' => FALSE,
-    ) + parent::defaultSettings();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function settingsForm(array $form, FormStateInterface $form_state) {
-    $elements['view_mode'] = array(
-      '#type' => 'select',
-      '#options' => \Drupal::entityManager()->getViewModeOptions($this->getFieldSetting('target_type')),
-      '#title' => t('View mode'),
-      '#default_value' => $this->getSetting('view_mode'),
-      '#required' => TRUE,
-    );
-
-    return $elements;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function settingsSummary() {
-    $summary = array();
-
-    $view_modes = \Drupal::entityManager()->getViewModeOptions($this->getFieldSetting('target_type'));
-    $view_mode = $this->getSetting('view_mode');
-    $summary[] = t('Rendered as @mode', array('@mode' => isset($view_modes[$view_mode]) ? $view_modes[$view_mode] : $view_mode));
-
-    return $summary;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function viewElements(FieldItemListInterface $items) {
-    $view_mode = $this->getSetting('view_mode');
-    $elements = array();
-
-    foreach ($this->getEntitiesToView($items) as $delta => $entity) {
-      // Protect ourselves from recursive rendering.
-      static $depth = 0;
-      $depth++;
-      if ($depth > 20) {
-        $this->loggerFactory->get('entity')->error('Recursive rendering detected when rendering entity @entity_type @entity_id. Aborting rendering.', array('@entity_type' => $entity->getEntityTypeId(), '@entity_id' => $entity->id()));
-        return $elements;
-      }
-
-      if ($entity->id()) {
-        $elements[$delta] = entity_view($entity, $view_mode, $entity->language()->getId());
-
-        // Add a resource attribute to set the mapping property's value to the
-        // entity's url. Since we don't know what the markup of the entity will
-        // be, we shouldn't rely on it for structured data such as RDFa.
-        if (!empty($items[$delta]->_attributes)) {
-          $items[$delta]->_attributes += array('resource' => $entity->url());
-        }
-      }
-      else {
-        // This is an "auto_create" item.
-        $elements[$delta] = array('#markup' => $entity->label());
-      }
-      $depth = 0;
-    }
-
-    return $elements;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function isApplicable(FieldDefinitionInterface $field_definition) {
-    // This formatter is only available for entity types that have a view
-    // builder.
-    $target_type = $field_definition->getFieldStorageDefinition()->getSetting('target_type');
-    return \Drupal::entityManager()->getDefinition($target_type)->hasViewBuilderClass();
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
deleted file mode 100644
index 0609b18..0000000
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase.
- */
-
-namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
-
-use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Core\Field\FormatterBase;
-use Drupal\Core\TypedData\TranslatableInterface;
-
-/**
- * Parent plugin for entity reference formatters.
- */
-abstract class EntityReferenceFormatterBase extends FormatterBase {
-
-  /**
-   * Returns the accessible and translated entities for view.
-   *
-   * @param \Drupal\Core\Field\FieldItemListInterface $items
-   *   The item list.
-   *
-   * @return \Drupal\Core\Entity\EntityInterface[]
-   *   The entities to view.
-   */
-  protected function getEntitiesToView(FieldItemListInterface $items) {
-    $entities = array();
-
-    $parent_entity_langcode = $items->getEntity()->language()->getId();
-    foreach ($items as $delta => $item) {
-      // The "originalEntity" property is assigned in self::prepareView() and
-      // its absence means that the referenced entity was neither found in the
-      // persistent storage nor is it a new entity (e.g. from "autocreate").
-      if (!isset($item->originalEntity)) {
-        $item->access = FALSE;
-        continue;
-      }
-
-      if ($item->originalEntity instanceof TranslatableInterface && $item->originalEntity->hasTranslation($parent_entity_langcode)) {
-        $entity = $item->originalEntity->getTranslation($parent_entity_langcode);
-      }
-      else {
-        $entity = $item->originalEntity;
-      }
-
-      if ($item->access || $entity->access('view')) {
-        $entities[$delta] = $entity;
-
-        // Mark item as accessible.
-        $item->access = TRUE;
-      }
-    }
-
-    return $entities;
-  }
-
-  /**
-   * {@inheritdoc}
-   *
-   * Loads the entities referenced in that field across all the entities being
-   * viewed, and places them in a custom item property for getEntitiesToView().
-   */
-  public function prepareView(array $entities_items) {
-    // Load the existing (non-autocreate) entities. For performance, we want to
-    // use a single "multiple entity load" to load all the entities for the
-    // multiple "entity reference item lists" that are being displayed. We thus
-    // cannot use
-    // \Drupal\Core\Field\EntityReferenceFieldItemList::referencedEntities().
-    $ids = array();
-    foreach ($entities_items as $items) {
-      foreach ($items as $item) {
-        if ($item->target_id !== NULL) {
-          $ids[] = $item->target_id;
-        }
-      }
-    }
-    if ($ids) {
-      $target_type = $this->getFieldSetting('target_type');
-      $target_entities = \Drupal::entityManager()->getStorage($target_type)->loadMultiple($ids);
-    }
-
-    // For each item, place the referenced entity where getEntitiesToView()
-    // reads it.
-    foreach ($entities_items as $items) {
-      foreach ($items as $item) {
-        if (isset($target_entities[$item->target_id])) {
-          $item->originalEntity = $target_entities[$item->target_id];
-        }
-        elseif ($item->hasNewEntity()) {
-          $item->originalEntity = $item->entity;
-        }
-      }
-    }
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php
deleted file mode 100644
index 5b3b171..0000000
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceIdFormatter.
- */
-
-namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
-
-use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Component\Utility\String;
-
-/**
- * Plugin implementation of the 'entity reference ID' formatter.
- *
- * @FieldFormatter(
- *   id = "entity_reference_entity_id",
- *   label = @Translation("Entity ID"),
- *   description = @Translation("Display the ID of the referenced entities."),
- *   field_types = {
- *     "entity_reference"
- *   }
- * )
- */
-class EntityReferenceIdFormatter extends EntityReferenceFormatterBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function viewElements(FieldItemListInterface $items) {
-    $elements = array();
-
-    foreach ($this->getEntitiesToView($items) as $delta => $entity) {
-      if ($entity->id()) {
-        $elements[$delta] = array(
-          '#markup' => String::checkPlain($entity->id()),
-          // Create a cache tag entry for the referenced entity. In the case
-          // that the referenced entity is deleted, the cache for referring
-          // entities must be cleared.
-          '#cache' => array(
-            'tags' => $entity->getCacheTags(),
-          ),
-        );
-      }
-    }
-
-    return $elements;
-  }
-}
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
deleted file mode 100644
index dbc8958..0000000
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceLabelFormatter.
- */
-
-namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
-
-use Drupal\Component\Utility\String;
-use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
-use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Core\Form\FormStateInterface;
-
-/**
- * Plugin implementation of the 'entity reference label' formatter.
- *
- * @FieldFormatter(
- *   id = "entity_reference_label",
- *   label = @Translation("Label"),
- *   description = @Translation("Display the label of the referenced entities."),
- *   field_types = {
- *     "entity_reference"
- *   }
- * )
- */
-class EntityReferenceLabelFormatter extends EntityReferenceFormatterBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function defaultSettings() {
-    return array(
-      'link' => TRUE,
-    ) + parent::defaultSettings();
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function settingsForm(array $form, FormStateInterface $form_state) {
-    $elements['link'] = array(
-      '#title' => t('Link label to the referenced entity'),
-      '#type' => 'checkbox',
-      '#default_value' => $this->getSetting('link'),
-    );
-
-    return $elements;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function settingsSummary() {
-    $summary = array();
-    $summary[] = $this->getSetting('link') ? t('Link to the referenced entity') : t('No link');
-    return $summary;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function viewElements(FieldItemListInterface $items) {
-    $elements = array();
-    $output_as_link = $this->getSetting('link');
-
-    foreach ($this->getEntitiesToView($items) as $delta => $entity) {
-      $label = $entity->label();
-      // If the link is to be displayed and the entity has a uri, display a
-      // link.
-      if ($output_as_link && !$entity->isNew()) {
-        try {
-          $uri = $entity->urlInfo();
-        }
-        catch (UndefinedLinkTemplateException $e) {
-          // This exception is thrown by \Drupal\Core\Entity\Entity::urlInfo()
-          // and it means that the entity type doesn't have a link template nor
-          // a valid "uri_callback", so don't bother trying to output a link for
-          // the rest of the referenced entities.
-          $output_as_link = FALSE;
-        }
-      }
-
-      if ($output_as_link && isset($uri) && !$entity->isNew()) {
-        $elements[$delta] = [
-          '#type' => 'link',
-          '#title' => $label,
-          '#url' => $uri,
-          '#options' => $uri->getOptions(),
-        ];
-
-        if (!empty($items[$delta]->_attributes)) {
-          $elements[$delta]['#options'] += array('attributes' => array());
-          $elements[$delta]['#options']['attributes'] += $items[$delta]->_attributes;
-          // Unset field item attributes since they have been included in the
-          // formatter output and shouldn't be rendered in the field template.
-          unset($items[$delta]->_attributes);
-        }
-      }
-      else {
-        $elements[$delta] = array('#markup' => String::checkPlain($label));
-      }
-      $elements[$delta]['#cache']['tags'] = $entity->getCacheTags();
-    }
-
-    return $elements;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/ProxyBuilder/ProxyBuilder.php b/core/lib/Drupal/Core/ProxyBuilder/ProxyBuilder.php
deleted file mode 100644
index 8d6a271..0000000
--- a/core/lib/Drupal/Core/ProxyBuilder/ProxyBuilder.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\ProxyBuilder\ProxyBuilder.
- */
-
-namespace Drupal\Core\ProxyBuilder;
-
-use Drupal\Component\ProxyBuilder\ProxyBuilder as BaseProxyBuilder;
-
-/**
- * Extend the component proxy builder by using the DependencySerialziationTrait.
- */
-class ProxyBuilder extends BaseProxyBuilder {
-
-  /**
-   * {@inheritdoc{
-   */
-  protected function buildUseStatements() {
-    $output = parent::buildUseStatements();
-
-    $output .= 'use \Drupal\Core\DependencyInjection\DependencySerializationTrait;' . "\n\n";
-
-    return $output;
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php
index 433abec..a4b17e2 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilder.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php
@@ -206,6 +206,13 @@ public function rebuild() {
   /**
    * {@inheritdoc}
    */
+  public function getCollectionDuringRebuild() {
+    return $this->routeCollection ?: FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function rebuildIfNeeded() {
     if ($this->routeBuilderIndicator->isRebuildNeeded()) {
       return $this->rebuild();
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php b/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php
index 29a4bfe..849d4ad 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilderInterface.php
@@ -18,6 +18,18 @@
   public function rebuild();
 
   /**
+   * Returns the route collection during the rebuild.
+   *
+   * Don't use this function unless you really have to! Better pass along the
+   * collection for yourself during the rebuild.
+   *
+   * Every use of this function is a design flaw of your code.
+   *
+   * @return \Symfony\Component\Routing\RouteCollection|FALSE
+   */
+  public function getCollectionDuringRebuild();
+
+  /**
    * Rebuilds the route info and dumps to dumper if necessary.
    *
    * @return bool
diff --git a/core/modules/block/src/BlockAccessControlHandler.php b/core/modules/block/src/BlockAccessControlHandler.php
index 6ec53f6..6160f84 100644
--- a/core/modules/block/src/BlockAccessControlHandler.php
+++ b/core/modules/block/src/BlockAccessControlHandler.php
@@ -100,7 +100,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A
       }
       if ($this->resolveConditions($conditions, 'and') !== FALSE) {
         // Delegate to the plugin.
-        $access = $entity->getPlugin()->access($account, TRUE);
+        $access = $entity->getPlugin()->access($account);
       }
       else {
         $access = AccessResult::forbidden();
diff --git a/core/modules/block/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php
index 5c8d900..53d1e57 100644
--- a/core/modules/block/src/Tests/BlockTest.php
+++ b/core/modules/block/src/Tests/BlockTest.php
@@ -436,18 +436,4 @@ public function testUninstallTheme() {
     $this->assertIdentical(NULL, Block::load($block->id()));
   }
 
-  /**
-   * Tests the block access.
-   */
-  public function testBlockAccess() {
-    $this->drupalPlaceBlock('test_access', ['region' => 'help']);
-
-    $this->drupalGet('<front>');
-    $this->assertNoText('Hello test world');
-
-    \Drupal::state()->set('test_block_access', TRUE);
-    $this->drupalGet('<front>');
-    $this->assertText('Hello test world');
-  }
-
 }
diff --git a/core/modules/block/src/Tests/BlockTestBase.php b/core/modules/block/src/Tests/BlockTestBase.php
index 1f3cb74..0aabffa 100644
--- a/core/modules/block/src/Tests/BlockTestBase.php
+++ b/core/modules/block/src/Tests/BlockTestBase.php
@@ -19,7 +19,7 @@
    *
    * @var array
    */
-  public static $modules = array('block', 'filter', 'test_page_test', 'help', 'block_test');
+  public static $modules = array('block', 'filter', 'test_page_test', 'help');
 
   /**
    * A list of theme regions to test.
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php
deleted file mode 100644
index b3ed511..0000000
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\block_test\Plugin\Block\TestAccessBlock.
- */
-
-namespace Drupal\block_test\Plugin\Block;
-
-use Drupal\Core\Block\BlockBase;
-use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
-use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\State\StateInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Provides a block to test access.
- *
- * @Block(
- *   id = "test_access",
- *   admin_label = @Translation("Test block access")
- * )
- */
-class TestAccessBlock extends BlockBase implements ContainerFactoryPluginInterface {
-
-  /**
-   * Tests the test access block.
-   *
-   *
-   * @param array $configuration
-   *   The plugin configuration, i.e. an array with configuration values keyed
-   *   by configuration option name. The special key 'context' may be used to
-   *   initialize the defined contexts by setting it to an array of context
-   *   values keyed by context names.
-   * @param string $plugin_id
-   *   The plugin_id for the plugin instance.
-   * @param mixed $plugin_definition
-   *   The plugin implementation definition.
-   * @param \Drupal\Core\State\StateInterface $state
-   *   The state.
-   */
-  public function __construct(array $configuration, $plugin_id, $plugin_definition, StateInterface $state) {
-    parent::__construct($configuration, $plugin_id, $plugin_definition);
-
-    $this->state = $state;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
-    return new static(
-      $configuration,
-      $plugin_id,
-      $plugin_definition,
-      $container->get('state')
-    );
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function blockAccess(AccountInterface $account) {
-    return $this->state->get('test_block_access', FALSE);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function build() {
-    return ['#markup' => 'Hello test world'];
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function isCacheable() {
-    return TRUE;
-  }
-
-}
-
diff --git a/core/modules/config/src/Tests/ConfigEntityFormOverrideTest.php b/core/modules/config/src/Tests/ConfigEntityFormOverrideTest.php
index 6f3d8e6..5ccd8ff 100644
--- a/core/modules/config/src/Tests/ConfigEntityFormOverrideTest.php
+++ b/core/modules/config/src/Tests/ConfigEntityFormOverrideTest.php
@@ -10,7 +10,7 @@
 use Drupal\simpletest\WebTestBase;
 
 /**
- * Tests that config overrides do not bleed through in entity forms and lists.
+ * Tests that config overrides do not bleed through in entity forms.
  *
  * @group config
  */
@@ -22,50 +22,39 @@ class ConfigEntityFormOverrideTest extends WebTestBase {
   public static $modules = array('config_test');
 
   /**
-   * Tests that overrides do not affect forms or listing screens.
+   * Tests that overrides do not affect forms.
    */
   public function testFormsWithOverrides() {
-    $original_label = 'Default';
-    $overridden_label = 'Overridden label';
-    $edited_label = 'Edited label';
+    $overridden_name = 'Overridden label';
 
     // Set up an override.
     $settings['config']['config_test.dynamic.dotted.default']['label'] = (object) array(
-      'value' => $overridden_label,
+      'value' => $overridden_name,
       'required' => TRUE,
     );
     $this->writeSettings($settings);
 
-    // Test that the overridden label is loaded with the entity.
-    $this->assertEqual(config_test_load('dotted.default')->label(), $overridden_label);
-
-    // Test that the original label on the listing page is intact.
+    // Test that everything on the form is the same, but that the override
+    // worked for the config entity label.
     $this->drupalGet('admin/structure/config_test');
-    $this->assertText($original_label);
-    $this->assertNoText($overridden_label);
+    $this->assertText($overridden_name);
 
-    // Test that the original label on the editing page is intact.
     $this->drupalGet('admin/structure/config_test/manage/dotted.default');
     $elements = $this->xpath('//input[@name="label"]');
-    $this->assertIdentical((string) $elements[0]['value'], $original_label);
-    $this->assertNoText($overridden_label);
-
-    // Change to a new label and test that the listing now has the edited label.
+    $this->assertIdentical((string) $elements[0]['value'], 'Default');
+    $this->assertNoText($overridden_name);
     $edit = array(
-      'label' => $edited_label,
+      'label' => 'Custom label',
     );
+
     $this->drupalPostForm(NULL, $edit, t('Save'));
     $this->drupalGet('admin/structure/config_test');
-    $this->assertNoText($overridden_label);
-    $this->assertText($edited_label);
+    $this->assertText($overridden_name);
+    $this->assertNoText($edit['label']);
 
-    // Test that the editing page now has the edited label.
     $this->drupalGet('admin/structure/config_test/manage/dotted.default');
     $elements = $this->xpath('//input[@name="label"]');
-    $this->assertIdentical((string) $elements[0]['value'], $edited_label);
-
-    // Test that the overridden label is still loaded with the entity.
-    $this->assertEqual(config_test_load('dotted.default')->label(), $overridden_label);
+    $this->assertIdentical((string) $elements[0]['value'], $edit['label']);
   }
 
 }
diff --git a/core/modules/dblog/src/Controller/DbLogController.php b/core/modules/dblog/src/Controller/DbLogController.php
index e8b1ba5..1042015 100644
--- a/core/modules/dblog/src/Controller/DbLogController.php
+++ b/core/modules/dblog/src/Controller/DbLogController.php
@@ -329,7 +329,7 @@ protected function buildFilterQuery() {
   /**
    * Formats a database log message.
    *
-   * @param stdClass $row
+   * @param object $row
    *   The record from the watchdog table. The object properties are: wid, uid,
    *   severity, type, timestamp, message, variables, link, name.
    *
diff --git a/core/modules/dblog/src/Form/DblogFilterForm.php b/core/modules/dblog/src/Form/DblogFilterForm.php
index 1401893..c18b2b3 100644
--- a/core/modules/dblog/src/Form/DblogFilterForm.php
+++ b/core/modules/dblog/src/Form/DblogFilterForm.php
@@ -88,6 +88,11 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
 
   /**
    * Resets the filter form.
+   *
+   * @param array $form
+   *   An associative array containing the structure of the form.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   The current state of the form.
    */
   public function resetForm(array &$form, FormStateInterface $form_state) {
     $_SESSION['dblog_overview_filter'] = array();
diff --git a/core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php b/core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php
index 14893bb..62510e2 100644
--- a/core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php
+++ b/core/modules/dblog/src/Plugin/rest/resource/DBLogResource.php
@@ -30,6 +30,9 @@ class DBLogResource extends ResourceBase {
    *
    * Returns a watchdog log entry for the specified ID.
    *
+   * @param int $id
+   *   The ID of the watchdog log entry.
+   *
    * @return \Drupal\rest\ResourceResponse
    *   The response containing the log entry.
    *
diff --git a/core/modules/entity_reference/config/schema/entity_reference.schema.yml b/core/modules/entity_reference/config/schema/entity_reference.schema.yml
index 1ee04d1..e71c487 100644
--- a/core/modules/entity_reference/config/schema/entity_reference.schema.yml
+++ b/core/modules/entity_reference/config/schema/entity_reference.schema.yml
@@ -37,6 +37,29 @@ entity_reference.default.handler_settings:
       type: boolean
       label: 'Create referenced entities if they don''t already exist'
 
+field.formatter.settings.entity_reference_entity_view:
+  type: mapping
+  label: 'Entity reference rendered entity display format settings'
+  mapping:
+    view_mode:
+      type: string
+      label: 'View mode'
+    link:
+      type: boolean
+      label: 'Show links'
+
+field.formatter.settings.entity_reference_entity_id:
+  type: mapping
+  label: 'Entity reference entity ID display format settings'
+
+field.formatter.settings.entity_reference_label:
+  type: mapping
+  label: 'Entity reference label display format settings'
+  mapping:
+    link:
+      type: boolean
+      label: 'Link label to the referenced entity'
+
 field.widget.settings.entity_reference_autocomplete_tags:
   type: mapping
   label: 'Entity reference autocomplete (Tags style) display format settings'
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
new file mode 100644
index 0000000..4c09ecf
--- /dev/null
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
@@ -0,0 +1,112 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter.
+ */
+
+namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
+
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\entity_reference\RecursiveRenderingException;
+
+/**
+ * Plugin implementation of the 'entity reference rendered entity' formatter.
+ *
+ * @FieldFormatter(
+ *   id = "entity_reference_entity_view",
+ *   label = @Translation("Rendered entity"),
+ *   description = @Translation("Display the referenced entities rendered by entity_view()."),
+ *   field_types = {
+ *     "entity_reference"
+ *   }
+ * )
+ */
+class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultSettings() {
+    return array(
+      'view_mode' => 'default',
+      'link' => FALSE,
+    ) + parent::defaultSettings();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, FormStateInterface $form_state) {
+    $elements['view_mode'] = array(
+      '#type' => 'select',
+      '#options' => \Drupal::entityManager()->getViewModeOptions($this->getFieldSetting('target_type')),
+      '#title' => t('View mode'),
+      '#default_value' => $this->getSetting('view_mode'),
+      '#required' => TRUE,
+    );
+
+    return $elements;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = array();
+
+    $view_modes = \Drupal::entityManager()->getViewModeOptions($this->getFieldSetting('target_type'));
+    $view_mode = $this->getSetting('view_mode');
+    $summary[] = t('Rendered as @mode', array('@mode' => isset($view_modes[$view_mode]) ? $view_modes[$view_mode] : $view_mode));
+
+    return $summary;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(FieldItemListInterface $items) {
+    $view_mode = $this->getSetting('view_mode');
+    $elements = array();
+
+    foreach ($this->getEntitiesToView($items) as $delta => $entity) {
+      // Protect ourselves from recursive rendering.
+      static $depth = 0;
+      $depth++;
+      if ($depth > 20) {
+        throw new RecursiveRenderingException(format_string('Recursive rendering detected when rendering entity @entity_type(@entity_id). Aborting rendering.', array('@entity_type' => $entity->getEntityTypeId(), '@entity_id' => $entity->id())));
+      }
+
+      if ($entity->id()) {
+        $elements[$delta] = entity_view($entity, $view_mode, $entity->language()->getId());
+
+        // Add a resource attribute to set the mapping property's value to the
+        // entity's url. Since we don't know what the markup of the entity will
+        // be, we shouldn't rely on it for structured data such as RDFa.
+        if (!empty($items[$delta]->_attributes)) {
+          $items[$delta]->_attributes += array('resource' => $entity->url());
+        }
+      }
+      else {
+        // This is an "auto_create" item.
+        $elements[$delta] = array('#markup' => $entity->label());
+      }
+      $depth = 0;
+    }
+
+    return $elements;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function isApplicable(FieldDefinitionInterface $field_definition) {
+    // This formatter is only available for entity types that have a view
+    // builder.
+    $target_type = $field_definition->getFieldStorageDefinition()->getSetting('target_type');
+    return \Drupal::entityManager()->getDefinition($target_type)->hasViewBuilderClass();
+  }
+
+}
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
new file mode 100644
index 0000000..1534499
--- /dev/null
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase.
+ */
+
+namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
+
+use Drupal\Core\Field\FormatterBase;
+use Drupal\Core\TypedData\TranslatableInterface;
+use Drupal\Core\Field\FieldItemListInterface;
+
+/**
+ * Parent plugin for entity reference formatters.
+ */
+abstract class EntityReferenceFormatterBase extends FormatterBase {
+
+  /**
+   * Returns the accessible and translated entities for view.
+   *
+   * @param \Drupal\Core\Field\FieldItemListInterface $items
+   *   The item list.
+   *
+   * @return \Drupal\Core\Entity\EntityInterface[]
+   *   The entities to view.
+   */
+  protected function getEntitiesToView(FieldItemListInterface $items) {
+    $entities = array();
+
+    $parent_entity_langcode = $items->getEntity()->language()->getId();
+    foreach ($items as $delta => $item) {
+      // The "originalEntity" property is assigned in self::prepareView() and
+      // its absence means that the referenced entity was neither found in the
+      // persistent storage nor is it a new entity (e.g. from "autocreate").
+      if (!isset($item->originalEntity)) {
+        $item->access = FALSE;
+        continue;
+      }
+
+      if ($item->originalEntity instanceof TranslatableInterface && $item->originalEntity->hasTranslation($parent_entity_langcode)) {
+        $entity = $item->originalEntity->getTranslation($parent_entity_langcode);
+      }
+      else {
+        $entity = $item->originalEntity;
+      }
+
+      if ($item->access || $entity->access('view')) {
+        $entities[$delta] = $entity;
+
+        // Mark item as accessible.
+        $item->access = TRUE;
+      }
+    }
+
+    return $entities;
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * Loads the entities referenced in that field across all the entities being
+   * viewed, and places them in a custom item property for getEntitiesToView().
+   */
+  public function prepareView(array $entities_items) {
+    // Load the existing (non-autocreate) entities. For performance, we want to
+    // use a single "multiple entity load" to load all the entities for the
+    // multiple "entity reference item lists" that are being displayed. We thus
+    // cannot use
+    // \Drupal\Core\Field\EntityReferenceFieldItemList::referencedEntities().
+    $ids = array();
+    foreach ($entities_items as $items) {
+      foreach ($items as $item) {
+        if ($item->target_id !== NULL) {
+          $ids[] = $item->target_id;
+        }
+      }
+    }
+    if ($ids) {
+      $target_type = $this->getFieldSetting('target_type');
+      $target_entities = \Drupal::entityManager()->getStorage($target_type)->loadMultiple($ids);
+    }
+
+    // For each item, place the referenced entity where getEntitiesToView()
+    // reads it.
+    foreach ($entities_items as $items) {
+      foreach ($items as $item) {
+        if (isset($target_entities[$item->target_id])) {
+          $item->originalEntity = $target_entities[$item->target_id];
+        }
+        elseif ($item->hasNewEntity()) {
+          $item->originalEntity = $item->entity;
+        }
+      }
+    }
+  }
+
+}
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php
new file mode 100644
index 0000000..98c3166
--- /dev/null
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\Plugin\Field\FieldFormatter\EntityReferenceIdFormatter.
+ */
+
+namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
+
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Component\Utility\String;
+
+/**
+ * Plugin implementation of the 'entity reference ID' formatter.
+ *
+ * @FieldFormatter(
+ *   id = "entity_reference_entity_id",
+ *   label = @Translation("Entity ID"),
+ *   description = @Translation("Display the ID of the referenced entities."),
+ *   field_types = {
+ *     "entity_reference"
+ *   }
+ * )
+ */
+class EntityReferenceIdFormatter extends EntityReferenceFormatterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(FieldItemListInterface $items) {
+    $elements = array();
+
+    foreach ($this->getEntitiesToView($items) as $delta => $entity) {
+      if ($entity->id()) {
+        $elements[$delta] = array(
+          '#markup' => String::checkPlain($entity->id()),
+          // Create a cache tag entry for the referenced entity. In the case
+          // that the referenced entity is deleted, the cache for referring
+          // entities must be cleared.
+          '#cache' => array(
+            'tags' => $entity->getCacheTags(),
+          ),
+        );
+      }
+    }
+
+    return $elements;
+  }
+}
diff --git a/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
new file mode 100644
index 0000000..22d0403
--- /dev/null
+++ b/core/modules/entity_reference/src/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
@@ -0,0 +1,109 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\Plugin\Field\FieldFormatter\EntityReferenceLabelFormatter.
+ */
+
+namespace Drupal\entity_reference\Plugin\Field\FieldFormatter;
+
+use Drupal\Component\Utility\String;
+use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Plugin implementation of the 'entity reference label' formatter.
+ *
+ * @FieldFormatter(
+ *   id = "entity_reference_label",
+ *   label = @Translation("Label"),
+ *   description = @Translation("Display the label of the referenced entities."),
+ *   field_types = {
+ *     "entity_reference"
+ *   }
+ * )
+ */
+class EntityReferenceLabelFormatter extends EntityReferenceFormatterBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function defaultSettings() {
+    return array(
+      'link' => TRUE,
+    ) + parent::defaultSettings();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsForm(array $form, FormStateInterface $form_state) {
+    $elements['link'] = array(
+      '#title' => t('Link label to the referenced entity'),
+      '#type' => 'checkbox',
+      '#default_value' => $this->getSetting('link'),
+    );
+
+    return $elements;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function settingsSummary() {
+    $summary = array();
+    $summary[] = $this->getSetting('link') ? t('Link to the referenced entity') : t('No link');
+    return $summary;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function viewElements(FieldItemListInterface $items) {
+    $elements = array();
+    $output_as_link = $this->getSetting('link');
+
+    foreach ($this->getEntitiesToView($items) as $delta => $entity) {
+      $label = $entity->label();
+      // If the link is to be displayed and the entity has a uri, display a
+      // link.
+      if ($output_as_link && !$entity->isNew()) {
+        try {
+          $uri = $entity->urlInfo();
+        }
+        catch (UndefinedLinkTemplateException $e) {
+          // This exception is thrown by \Drupal\Core\Entity\Entity::urlInfo()
+          // and it means that the entity type doesn't have a link template nor
+          // a valid "uri_callback", so don't bother trying to output a link for
+          // the rest of the referenced entities.
+          $output_as_link = FALSE;
+        }
+      }
+
+      if ($output_as_link && isset($uri) && !$entity->isNew()) {
+        $elements[$delta] = [
+          '#type' => 'link',
+          '#title' => $label,
+          '#url' => $uri,
+          '#options' => $uri->getOptions(),
+        ];
+
+        if (!empty($items[$delta]->_attributes)) {
+          $elements[$delta]['#options'] += array('attributes' => array());
+          $elements[$delta]['#options']['attributes'] += $items[$delta]->_attributes;
+          // Unset field item attributes since they have been included in the
+          // formatter output and shouldn't be rendered in the field template.
+          unset($items[$delta]->_attributes);
+        }
+      }
+      else {
+        $elements[$delta] = array('#markup' => String::checkPlain($label));
+      }
+      $elements[$delta]['#cache']['tags'] = $entity->getCacheTags();
+    }
+
+    return $elements;
+  }
+
+}
diff --git a/core/modules/entity_reference/src/RecursiveRenderingException.php b/core/modules/entity_reference/src/RecursiveRenderingException.php
new file mode 100644
index 0000000..e0fce9c
--- /dev/null
+++ b/core/modules/entity_reference/src/RecursiveRenderingException.php
@@ -0,0 +1,14 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\RecursiveRenderingException.
+ */
+
+namespace Drupal\entity_reference;
+
+/**
+ * Exception thrown when the entity view renderer goes into a potentially
+ * infinite loop.
+ */
+class RecursiveRenderingException extends \Exception {}
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php
new file mode 100644
index 0000000..2d7e938
--- /dev/null
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceFormatterTest.php
@@ -0,0 +1,278 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\Tests\EntityReferenceFormatterTest.
+ */
+
+namespace Drupal\entity_reference\Tests;
+
+use Drupal\Core\Cache\Cache;
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\filter\Entity\FilterFormat;
+use Drupal\system\Tests\Entity\EntityUnitTestBase;
+
+/**
+ * Tests the formatters functionality.
+ *
+ * @group entity_reference
+ */
+class EntityReferenceFormatterTest extends EntityUnitTestBase {
+
+  /**
+   * The entity type used in this test.
+   *
+   * @var string
+   */
+  protected $entityType = 'entity_test';
+
+  /**
+   * The bundle used in this test.
+   *
+   * @var string
+   */
+  protected $bundle = 'entity_test';
+
+  /**
+   * The name of the field used in this test.
+   *
+   * @var string
+   */
+  protected $fieldName = 'field_test';
+
+  /**
+   * The entity to be referenced in this test.
+   *
+   * @var \Drupal\Core\Entity\EntityInterface
+   */
+  protected $referencedEntity;
+
+  /**
+   * The entity that is not yet saved to its persistent storage to be referenced
+   * in this test.
+   *
+   * @var \Drupal\Core\Entity\EntityInterface
+   */
+  protected $unsavedReferencedEntity;
+
+  /**
+   * Modules to install.
+   *
+   * @var array
+   */
+  public static $modules = array('entity_reference');
+
+  protected function setUp() {
+    parent::setUp();
+
+    // The label formatter rendering generates links, so build the router.
+    $this->installSchema('system', 'router');
+    $this->container->get('router.builder')->rebuild();
+
+    entity_reference_create_field($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType, 'default', array(), FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
+
+    // Set up a field, so that the entity that'll be referenced bubbles up a
+    // cache tag when rendering it entirely.
+    entity_create('field_storage_config', array(
+      'field_name' => 'body',
+      'entity_type' => $this->entityType,
+      'type' => 'text',
+      'settings' => array(),
+    ))->save();
+    entity_create('field_config', array(
+      'entity_type' => $this->entityType,
+      'bundle' => $this->bundle,
+      'field_name' => 'body',
+      'label' => 'Body',
+    ))->save();
+    entity_get_display($this->entityType, $this->bundle, 'default')
+      ->setComponent('body', array(
+        'type' => 'text_default',
+        'settings' => array(),
+      ))
+      ->save();
+
+    entity_create('filter_format', array(
+      'format' => 'full_html',
+      'name' => 'Full HTML',
+    ))->save();
+
+    // Create the entity to be referenced.
+    $this->referencedEntity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
+    $this->referencedEntity->body = array(
+      'value' => '<p>Hello, world!</p>',
+      'format' => 'full_html',
+    );
+    $this->referencedEntity->save();
+
+    // Create another entity to be referenced but do not save it.
+    $this->unsavedReferencedEntity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
+    $this->unsavedReferencedEntity->body = array(
+      'value' => '<p>Hello, unsaved world!</p>',
+      'format' => 'full_html',
+    );
+  }
+
+  /**
+   * Assert unaccessible items don't change the data of the fields.
+   */
+  public function testAccess() {
+    $field_name = $this->fieldName;
+
+    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
+    $referencing_entity->save();
+    $referencing_entity->{$field_name}->entity = $this->referencedEntity;
+
+    // Assert user doesn't have access to the entity.
+    $this->assertFalse($this->referencedEntity->access('view'), 'Current user does not have access to view the referenced entity.');
+
+    $formatter_manager = $this->container->get('plugin.manager.field.formatter');
+
+    // Get all the existing formatters.
+    foreach ($formatter_manager->getOptions('entity_reference') as $formatter => $name) {
+      // Set formatter type for the 'full' view mode.
+      entity_get_display($this->entityType, $this->bundle, 'default')
+        ->setComponent($field_name, array(
+          'type' => $formatter,
+        ))
+        ->save();
+
+      // Invoke entity view.
+      entity_view($referencing_entity, 'default');
+
+      // Verify the un-accessible item still exists.
+      $this->assertEqual($referencing_entity->{$field_name}->target_id, $this->referencedEntity->id(), format_string('The un-accessible item still exists after @name formatter was executed.', array('@name' => $name)));
+    }
+  }
+
+  /**
+   * Tests the ID formatter.
+   */
+  public function testIdFormatter() {
+    $formatter = 'entity_reference_entity_id';
+    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter);
+
+    $this->assertEqual($build[0]['#markup'], $this->referencedEntity->id(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
+    $this->assertEqual($build[0]['#cache']['tags'], $this->referencedEntity->getCacheTags(), sprintf('The %s formatter has the expected cache tags.', $formatter));
+    $this->assertTrue(!isset($build[1]), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
+  }
+
+  /**
+   * Tests the entity formatter.
+   */
+  public function testEntityFormatter() {
+    $formatter = 'entity_reference_entity_view';
+    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter);
+
+    // Test the first field item.
+    $expected_rendered_name_field_1 = '<div class="field field-entity-test--name field-name-name field-type-string field-label-hidden">
+    <div class="field-items">
+          <div class="field-item">' . $this->referencedEntity->label() . '</div>
+      </div>
+</div>
+';
+    $expected_rendered_body_field_1 = '<div class="clearfix field field-entity-test--body field-name-body field-type-text field-label-above">
+      <div class="field-label">Body</div>
+    <div class="field-items">
+          <div class="field-item"><p>Hello, world!</p></div>
+      </div>
+</div>
+';
+    drupal_render($build[0]);
+    $this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() .  $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
+    $expected_cache_tags = Cache::mergeTags(
+      \Drupal::entityManager()->getViewBuilder($this->entityType)->getCacheTags(),
+      $this->referencedEntity->getCacheTags(),
+      FilterFormat::load('full_html')->getCacheTags()
+    );
+    $this->assertEqual($build[0]['#cache']['tags'], $expected_cache_tags, format_string('The @formatter formatter has the expected cache tags.', array('@formatter' => $formatter)));
+
+    // Test the second field item.
+    drupal_render($build[1]);
+    $this->assertEqual($build[1]['#markup'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
+  }
+
+  /**
+   * Tests the label formatter.
+   */
+  public function testLabelFormatter() {
+    $formatter = 'entity_reference_label';
+
+    // The 'link' settings is TRUE by default.
+    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter);
+
+    $expected_item_1 = array(
+      '#type' => 'link',
+      '#title' => $this->referencedEntity->label(),
+      '#url' => $this->referencedEntity->urlInfo(),
+      '#options' => $this->referencedEntity->urlInfo()->getOptions(),
+      '#cache' => array(
+        'tags' => $this->referencedEntity->getCacheTags(),
+      ),
+    );
+    $this->assertEqual(drupal_render($build[0]), drupal_render($expected_item_1), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
+
+    // The second referenced entity is "autocreated", therefore not saved and
+    // lacking any URL info.
+    $expected_item_2 = array(
+      '#markup' => $this->unsavedReferencedEntity->label(),
+      '#cache' => array(
+        'tags' => $this->unsavedReferencedEntity->getCacheTags(),
+      ),
+    );
+    $this->assertEqual($build[1], $expected_item_2, sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
+
+    // Test with the 'link' setting set to FALSE.
+    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter, array('link' => FALSE));
+    $this->assertEqual($build[0]['#markup'], $this->referencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
+    $this->assertEqual($build[1]['#markup'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
+
+    // Test an entity type that doesn't have any link templates, which means
+    // \Drupal\Core\Entity\EntityInterface::urlInfo() will throw an exception
+    // and the label formatter will output only the label instead of a link.
+    $field_storage_config = FieldStorageConfig::loadByName($this->entityType, $this->fieldName);
+    $field_storage_config->settings['target_type'] = 'entity_test_label';
+    $field_storage_config->save();
+
+    $referenced_entity_with_no_link_template = entity_create('entity_test_label', array(
+      'name' => $this->randomMachineName(),
+    ));
+    $referenced_entity_with_no_link_template->save();
+
+    $build = $this->buildRenderArray([$referenced_entity_with_no_link_template], $formatter, array('link' => TRUE));
+    $this->assertEqual($build[0]['#markup'], $referenced_entity_with_no_link_template->label(), sprintf('The markup returned by the %s formatter is correct for an entity type with no valid link template.', $formatter));
+  }
+
+  /**
+   * Sets field values and returns a render array as built by
+   * \Drupal\Core\Field\FieldItemListInterface::view().
+   *
+   * @param \Drupal\Core\Entity\EntityInterface[] $referenced_entities
+   *   An array of entity objects that will be referenced.
+   * @param string $formatter
+   *   The formatted plugin that will be used for building the render array.
+   * @param array $formatter_options
+   *   Settings specific to the formatter. Defaults to the formatter's default
+   *   settings.
+   *
+   * @return array
+   *   A render array.
+   */
+  protected function buildRenderArray(array $referenced_entities, $formatter, $formatter_options = array()) {
+    // Create the entity that will have the entity reference field.
+    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
+
+    $delta = 0;
+    foreach ($referenced_entities as $referenced_entity) {
+      $referencing_entity->{$this->fieldName}[$delta]->entity = $referenced_entity;
+      $referencing_entity->{$this->fieldName}[$delta++]->access = TRUE;
+    }
+
+    // Build the renderable array for the entity reference field.
+    $items = $referencing_entity->get($this->fieldName);
+
+    return $items->view(array('type' => $formatter, 'settings' => $formatter_options));
+  }
+
+}
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
new file mode 100644
index 0000000..bddea8d
--- /dev/null
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceItemTest.php
@@ -0,0 +1,217 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\entity_reference\Tests\EntityReferenceItemTest.
+ */
+
+namespace Drupal\entity_reference\Tests;
+
+use Drupal\Component\Utility\Unicode;
+use Drupal\Core\Field\FieldItemListInterface;
+use Drupal\Core\Field\FieldItemInterface;
+use Drupal\Core\Language\LanguageInterface;
+use Drupal\field\Tests\FieldUnitTestBase;
+use Drupal\taxonomy\Entity\Term;
+use Drupal\taxonomy\Entity\Vocabulary;
+
+/**
+ * Tests the new entity API for the entity reference field type.
+ *
+ * @group entity_reference
+ */
+class EntityReferenceItemTest extends FieldUnitTestBase {
+
+  /**
+   * Modules to install.
+   *
+   * @var array
+   */
+  public static $modules = array('entity_reference', 'taxonomy', 'text', 'filter');
+
+  /**
+   * The taxonomy vocabulary to test with.
+   *
+   * @var \Drupal\taxonomy\VocabularyInterface
+   */
+  protected $vocabulary;
+
+  /**
+   * The taxonomy term to test with.
+   *
+   * @var \Drupal\taxonomy\TermInterface
+   */
+  protected $term;
+
+  /**
+   * Sets up the test.
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->installEntitySchema('taxonomy_term');
+
+    $this->vocabulary = entity_create('taxonomy_vocabulary', array(
+      'name' => $this->randomMachineName(),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+    ));
+    $this->vocabulary->save();
+
+    $this->term = entity_create('taxonomy_term', array(
+      'name' => $this->randomMachineName(),
+      'vid' => $this->vocabulary->id(),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+    ));
+    $this->term->save();
+
+    // Use the util to create an instance.
+    entity_reference_create_field('entity_test', 'entity_test', 'field_test_taxonomy_term', 'Test content entity reference', 'taxonomy_term');
+    entity_reference_create_field('entity_test', 'entity_test', 'field_test_taxonomy_vocabulary', 'Test config entity reference', 'taxonomy_vocabulary');
+  }
+
+  /**
+   * Tests the entity reference field type for referencing content entities.
+   */
+  public function testContentEntityReferenceItem() {
+    $tid = $this->term->id();
+
+    // Just being able to create the entity like this verifies a lot of code.
+    $entity = entity_create('entity_test');
+    $entity->field_test_taxonomy_term->target_id = $tid;
+    $entity->name->value = $this->randomMachineName();
+    $entity->save();
+
+    $entity = entity_load('entity_test', $entity->id());
+    $this->assertTrue($entity->field_test_taxonomy_term instanceof FieldItemListInterface, 'Field implements interface.');
+    $this->assertTrue($entity->field_test_taxonomy_term[0] instanceof FieldItemInterface, 'Field item implements interface.');
+    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $tid);
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $this->term->getName());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $tid);
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->uuid(), $this->term->uuid());
+
+    // Change the name of the term via the reference.
+    $new_name = $this->randomMachineName();
+    $entity->field_test_taxonomy_term->entity->setName($new_name);
+    $entity->field_test_taxonomy_term->entity->save();
+    // Verify it is the correct name.
+    $term = Term::load($tid);
+    $this->assertEqual($term->getName(), $new_name);
+
+    // Make sure the computed term reflects updates to the term id.
+    $term2 = entity_create('taxonomy_term', array(
+      'name' => $this->randomMachineName(),
+      'vid' => $this->term->bundle(),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+    ));
+    $term2->save();
+
+    // Test all the possible ways of assigning a value.
+    $entity->field_test_taxonomy_term->target_id = $term->id();
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term->id());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term->getName());
+
+    $entity->field_test_taxonomy_term = [['target_id' => $term2->id()]];
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term2->id());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term2->getName());
+
+    // Test value assignment via the computed 'entity' property.
+    $entity->field_test_taxonomy_term->entity = $term;
+    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $term->id());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term->getName());
+
+    $entity->field_test_taxonomy_term = [['entity' => $term2]];
+    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $term2->id());
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term2->getName());
+
+    // Test assigning an invalid item throws an exception.
+    try {
+      $entity->field_test_taxonomy_term = ['target_id' => 'invalid', 'entity' => $term2];
+      $this->fail('Assigning an invalid item throws an exception.');
+    }
+    catch (\InvalidArgumentException $e) {
+      $this->pass('Assigning an invalid item throws an exception.');
+    }
+
+    // Delete terms so we have nothing to reference and try again
+    $term->delete();
+    $term2->delete();
+    $entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
+    $entity->save();
+
+    // Test the generateSampleValue() method.
+    $entity = entity_create('entity_test');
+    $entity->field_test_taxonomy_term->generateSampleItems();
+    $entity->field_test_taxonomy_vocabulary->generateSampleItems();
+    $this->entityValidateAndSave($entity);
+  }
+
+  /**
+   * Tests the entity reference field type for referencing config entities.
+   */
+  public function testConfigEntityReferenceItem() {
+    $referenced_entity_id = $this->vocabulary->id();
+
+    // Just being able to create the entity like this verifies a lot of code.
+    $entity = entity_create('entity_test');
+    $entity->field_test_taxonomy_vocabulary->target_id = $referenced_entity_id;
+    $entity->name->value = $this->randomMachineName();
+    $entity->save();
+
+    $entity = entity_load('entity_test', $entity->id());
+    $this->assertTrue($entity->field_test_taxonomy_vocabulary instanceof FieldItemListInterface, 'Field implements interface.');
+    $this->assertTrue($entity->field_test_taxonomy_vocabulary[0] instanceof FieldItemInterface, 'Field item implements interface.');
+    $this->assertEqual($entity->field_test_taxonomy_vocabulary->target_id, $referenced_entity_id);
+    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->label(), $this->vocabulary->label());
+    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->id(), $referenced_entity_id);
+    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->uuid(), $this->vocabulary->uuid());
+
+    // Change the name of the term via the reference.
+    $new_name = $this->randomMachineName();
+    $entity->field_test_taxonomy_vocabulary->entity->set('name', $new_name);
+    $entity->field_test_taxonomy_vocabulary->entity->save();
+    // Verify it is the correct name.
+    $vocabulary = Vocabulary::load($referenced_entity_id);
+    $this->assertEqual($vocabulary->label(), $new_name);
+
+    // Make sure the computed term reflects updates to the term id.
+    $vocabulary2 = entity_create('taxonomy_vocabulary', array(
+      'name' => $this->randomMachineName(),
+      'vid' => Unicode::strtolower($this->randomMachineName()),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+    ));
+    $vocabulary2->save();
+
+    $entity->field_test_taxonomy_vocabulary->target_id = $vocabulary2->id();
+    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->id(), $vocabulary2->id());
+    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->label(), $vocabulary2->label());
+
+    // Delete terms so we have nothing to reference and try again
+    $this->vocabulary->delete();
+    $vocabulary2->delete();
+    $entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
+    $entity->save();
+  }
+
+  /**
+   * Test saving order sequence doesn't matter.
+   */
+  public function testEntitySaveOrder() {
+    // The term entity is unsaved here.
+    $term = entity_create('taxonomy_term', array(
+      'name' => $this->randomMachineName(),
+      'vid' => $this->term->bundle(),
+      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
+    ));
+    $entity = entity_create('entity_test');
+    // Now assign the unsaved term to the field.
+    $entity->field_test_taxonomy_term->entity = $term;
+    $entity->name->value = $this->randomMachineName();
+    // Now save the term.
+    $term->save();
+    // And then the entity.
+    $entity->save();
+    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term->id());
+  }
+
+}
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
deleted file mode 100644
index 45f7bdc..0000000
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
+++ /dev/null
@@ -1,278 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\field\Tests\EntityReference\EntityReferenceFormatterTest.
- */
-
-namespace Drupal\field\Tests\EntityReference;
-
-use Drupal\Core\Cache\Cache;
-use Drupal\Core\Field\FieldStorageDefinitionInterface;
-use Drupal\field\Entity\FieldStorageConfig;
-use Drupal\filter\Entity\FilterFormat;
-use Drupal\system\Tests\Entity\EntityUnitTestBase;
-
-/**
- * Tests the formatters functionality.
- *
- * @group entity_reference
- */
-class EntityReferenceFormatterTest extends EntityUnitTestBase {
-
-  /**
-   * The entity type used in this test.
-   *
-   * @var string
-   */
-  protected $entityType = 'entity_test';
-
-  /**
-   * The bundle used in this test.
-   *
-   * @var string
-   */
-  protected $bundle = 'entity_test';
-
-  /**
-   * The name of the field used in this test.
-   *
-   * @var string
-   */
-  protected $fieldName = 'field_test';
-
-  /**
-   * The entity to be referenced in this test.
-   *
-   * @var \Drupal\Core\Entity\EntityInterface
-   */
-  protected $referencedEntity;
-
-  /**
-   * The entity that is not yet saved to its persistent storage to be referenced
-   * in this test.
-   *
-   * @var \Drupal\Core\Entity\EntityInterface
-   */
-  protected $unsavedReferencedEntity;
-
-  /**
-   * Modules to install.
-   *
-   * @var array
-   */
-  public static $modules = array('entity_reference');
-
-  protected function setUp() {
-    parent::setUp();
-
-    // The label formatter rendering generates links, so build the router.
-    $this->installSchema('system', 'router');
-    $this->container->get('router.builder')->rebuild();
-
-    entity_reference_create_field($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType, 'default', array(), FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
-
-    // Set up a field, so that the entity that'll be referenced bubbles up a
-    // cache tag when rendering it entirely.
-    entity_create('field_storage_config', array(
-      'field_name' => 'body',
-      'entity_type' => $this->entityType,
-      'type' => 'text',
-      'settings' => array(),
-    ))->save();
-    entity_create('field_config', array(
-      'entity_type' => $this->entityType,
-      'bundle' => $this->bundle,
-      'field_name' => 'body',
-      'label' => 'Body',
-    ))->save();
-    entity_get_display($this->entityType, $this->bundle, 'default')
-      ->setComponent('body', array(
-        'type' => 'text_default',
-        'settings' => array(),
-      ))
-      ->save();
-
-    entity_create('filter_format', array(
-      'format' => 'full_html',
-      'name' => 'Full HTML',
-    ))->save();
-
-    // Create the entity to be referenced.
-    $this->referencedEntity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
-    $this->referencedEntity->body = array(
-      'value' => '<p>Hello, world!</p>',
-      'format' => 'full_html',
-    );
-    $this->referencedEntity->save();
-
-    // Create another entity to be referenced but do not save it.
-    $this->unsavedReferencedEntity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
-    $this->unsavedReferencedEntity->body = array(
-      'value' => '<p>Hello, unsaved world!</p>',
-      'format' => 'full_html',
-    );
-  }
-
-  /**
-   * Assert unaccessible items don't change the data of the fields.
-   */
-  public function testAccess() {
-    $field_name = $this->fieldName;
-
-    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
-    $referencing_entity->save();
-    $referencing_entity->{$field_name}->entity = $this->referencedEntity;
-
-    // Assert user doesn't have access to the entity.
-    $this->assertFalse($this->referencedEntity->access('view'), 'Current user does not have access to view the referenced entity.');
-
-    $formatter_manager = $this->container->get('plugin.manager.field.formatter');
-
-    // Get all the existing formatters.
-    foreach ($formatter_manager->getOptions('entity_reference') as $formatter => $name) {
-      // Set formatter type for the 'full' view mode.
-      entity_get_display($this->entityType, $this->bundle, 'default')
-        ->setComponent($field_name, array(
-          'type' => $formatter,
-        ))
-        ->save();
-
-      // Invoke entity view.
-      entity_view($referencing_entity, 'default');
-
-      // Verify the un-accessible item still exists.
-      $this->assertEqual($referencing_entity->{$field_name}->target_id, $this->referencedEntity->id(), format_string('The un-accessible item still exists after @name formatter was executed.', array('@name' => $name)));
-    }
-  }
-
-  /**
-   * Tests the ID formatter.
-   */
-  public function testIdFormatter() {
-    $formatter = 'entity_reference_entity_id';
-    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter);
-
-    $this->assertEqual($build[0]['#markup'], $this->referencedEntity->id(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
-    $this->assertEqual($build[0]['#cache']['tags'], $this->referencedEntity->getCacheTags(), sprintf('The %s formatter has the expected cache tags.', $formatter));
-    $this->assertTrue(!isset($build[1]), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
-  }
-
-  /**
-   * Tests the entity formatter.
-   */
-  public function testEntityFormatter() {
-    $formatter = 'entity_reference_entity_view';
-    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter);
-
-    // Test the first field item.
-    $expected_rendered_name_field_1 = '<div class="field field-entity-test--name field-name-name field-type-string field-label-hidden">
-    <div class="field-items">
-          <div class="field-item">' . $this->referencedEntity->label() . '</div>
-      </div>
-</div>
-';
-    $expected_rendered_body_field_1 = '<div class="clearfix field field-entity-test--body field-name-body field-type-text field-label-above">
-      <div class="field-label">Body</div>
-    <div class="field-items">
-          <div class="field-item"><p>Hello, world!</p></div>
-      </div>
-</div>
-';
-    drupal_render($build[0]);
-    $this->assertEqual($build[0]['#markup'], 'default | ' . $this->referencedEntity->label() .  $expected_rendered_name_field_1 . $expected_rendered_body_field_1, sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
-    $expected_cache_tags = Cache::mergeTags(
-      \Drupal::entityManager()->getViewBuilder($this->entityType)->getCacheTags(),
-      $this->referencedEntity->getCacheTags(),
-      FilterFormat::load('full_html')->getCacheTags()
-    );
-    $this->assertEqual($build[0]['#cache']['tags'], $expected_cache_tags, format_string('The @formatter formatter has the expected cache tags.', array('@formatter' => $formatter)));
-
-    // Test the second field item.
-    drupal_render($build[1]);
-    $this->assertEqual($build[1]['#markup'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
-  }
-
-  /**
-   * Tests the label formatter.
-   */
-  public function testLabelFormatter() {
-    $formatter = 'entity_reference_label';
-
-    // The 'link' settings is TRUE by default.
-    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter);
-
-    $expected_item_1 = array(
-      '#type' => 'link',
-      '#title' => $this->referencedEntity->label(),
-      '#url' => $this->referencedEntity->urlInfo(),
-      '#options' => $this->referencedEntity->urlInfo()->getOptions(),
-      '#cache' => array(
-        'tags' => $this->referencedEntity->getCacheTags(),
-      ),
-    );
-    $this->assertEqual(drupal_render($build[0]), drupal_render($expected_item_1), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
-
-    // The second referenced entity is "autocreated", therefore not saved and
-    // lacking any URL info.
-    $expected_item_2 = array(
-      '#markup' => $this->unsavedReferencedEntity->label(),
-      '#cache' => array(
-        'tags' => $this->unsavedReferencedEntity->getCacheTags(),
-      ),
-    );
-    $this->assertEqual($build[1], $expected_item_2, sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
-
-    // Test with the 'link' setting set to FALSE.
-    $build = $this->buildRenderArray([$this->referencedEntity, $this->unsavedReferencedEntity], $formatter, array('link' => FALSE));
-    $this->assertEqual($build[0]['#markup'], $this->referencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a saved entity.', $formatter));
-    $this->assertEqual($build[1]['#markup'], $this->unsavedReferencedEntity->label(), sprintf('The markup returned by the %s formatter is correct for an item with a unsaved entity.', $formatter));
-
-    // Test an entity type that doesn't have any link templates, which means
-    // \Drupal\Core\Entity\EntityInterface::urlInfo() will throw an exception
-    // and the label formatter will output only the label instead of a link.
-    $field_storage_config = FieldStorageConfig::loadByName($this->entityType, $this->fieldName);
-    $field_storage_config->settings['target_type'] = 'entity_test_label';
-    $field_storage_config->save();
-
-    $referenced_entity_with_no_link_template = entity_create('entity_test_label', array(
-      'name' => $this->randomMachineName(),
-    ));
-    $referenced_entity_with_no_link_template->save();
-
-    $build = $this->buildRenderArray([$referenced_entity_with_no_link_template], $formatter, array('link' => TRUE));
-    $this->assertEqual($build[0]['#markup'], $referenced_entity_with_no_link_template->label(), sprintf('The markup returned by the %s formatter is correct for an entity type with no valid link template.', $formatter));
-  }
-
-  /**
-   * Sets field values and returns a render array as built by
-   * \Drupal\Core\Field\FieldItemListInterface::view().
-   *
-   * @param \Drupal\Core\Entity\EntityInterface[] $referenced_entities
-   *   An array of entity objects that will be referenced.
-   * @param string $formatter
-   *   The formatted plugin that will be used for building the render array.
-   * @param array $formatter_options
-   *   Settings specific to the formatter. Defaults to the formatter's default
-   *   settings.
-   *
-   * @return array
-   *   A render array.
-   */
-  protected function buildRenderArray(array $referenced_entities, $formatter, $formatter_options = array()) {
-    // Create the entity that will have the entity reference field.
-    $referencing_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
-
-    $delta = 0;
-    foreach ($referenced_entities as $referenced_entity) {
-      $referencing_entity->{$this->fieldName}[$delta]->entity = $referenced_entity;
-      $referencing_entity->{$this->fieldName}[$delta++]->access = TRUE;
-    }
-
-    // Build the renderable array for the entity reference field.
-    $items = $referencing_entity->get($this->fieldName);
-
-    return $items->view(array('type' => $formatter, 'settings' => $formatter_options));
-  }
-
-}
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
deleted file mode 100644
index c1179f0..0000000
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceItemTest.php
+++ /dev/null
@@ -1,217 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\field\Tests\EntityReference\EntityReferenceItemTest.
- */
-
-namespace Drupal\field\Tests\EntityReference;
-
-use Drupal\Component\Utility\Unicode;
-use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Core\Field\FieldItemInterface;
-use Drupal\Core\Language\LanguageInterface;
-use Drupal\field\Tests\FieldUnitTestBase;
-use Drupal\taxonomy\Entity\Term;
-use Drupal\taxonomy\Entity\Vocabulary;
-
-/**
- * Tests the new entity API for the entity reference field type.
- *
- * @group entity_reference
- */
-class EntityReferenceItemTest extends FieldUnitTestBase {
-
-  /**
-   * Modules to install.
-   *
-   * @var array
-   */
-  public static $modules = array('entity_reference', 'taxonomy', 'text', 'filter');
-
-  /**
-   * The taxonomy vocabulary to test with.
-   *
-   * @var \Drupal\taxonomy\VocabularyInterface
-   */
-  protected $vocabulary;
-
-  /**
-   * The taxonomy term to test with.
-   *
-   * @var \Drupal\taxonomy\TermInterface
-   */
-  protected $term;
-
-  /**
-   * Sets up the test.
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $this->installEntitySchema('taxonomy_term');
-
-    $this->vocabulary = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomMachineName(),
-      'vid' => Unicode::strtolower($this->randomMachineName()),
-      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-    ));
-    $this->vocabulary->save();
-
-    $this->term = entity_create('taxonomy_term', array(
-      'name' => $this->randomMachineName(),
-      'vid' => $this->vocabulary->id(),
-      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-    ));
-    $this->term->save();
-
-    // Use the util to create an instance.
-    entity_reference_create_field('entity_test', 'entity_test', 'field_test_taxonomy_term', 'Test content entity reference', 'taxonomy_term');
-    entity_reference_create_field('entity_test', 'entity_test', 'field_test_taxonomy_vocabulary', 'Test config entity reference', 'taxonomy_vocabulary');
-  }
-
-  /**
-   * Tests the entity reference field type for referencing content entities.
-   */
-  public function testContentEntityReferenceItem() {
-    $tid = $this->term->id();
-
-    // Just being able to create the entity like this verifies a lot of code.
-    $entity = entity_create('entity_test');
-    $entity->field_test_taxonomy_term->target_id = $tid;
-    $entity->name->value = $this->randomMachineName();
-    $entity->save();
-
-    $entity = entity_load('entity_test', $entity->id());
-    $this->assertTrue($entity->field_test_taxonomy_term instanceof FieldItemListInterface, 'Field implements interface.');
-    $this->assertTrue($entity->field_test_taxonomy_term[0] instanceof FieldItemInterface, 'Field item implements interface.');
-    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $tid);
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $this->term->getName());
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $tid);
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->uuid(), $this->term->uuid());
-
-    // Change the name of the term via the reference.
-    $new_name = $this->randomMachineName();
-    $entity->field_test_taxonomy_term->entity->setName($new_name);
-    $entity->field_test_taxonomy_term->entity->save();
-    // Verify it is the correct name.
-    $term = Term::load($tid);
-    $this->assertEqual($term->getName(), $new_name);
-
-    // Make sure the computed term reflects updates to the term id.
-    $term2 = entity_create('taxonomy_term', array(
-      'name' => $this->randomMachineName(),
-      'vid' => $this->term->bundle(),
-      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-    ));
-    $term2->save();
-
-    // Test all the possible ways of assigning a value.
-    $entity->field_test_taxonomy_term->target_id = $term->id();
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term->id());
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term->getName());
-
-    $entity->field_test_taxonomy_term = [['target_id' => $term2->id()]];
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term2->id());
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term2->getName());
-
-    // Test value assignment via the computed 'entity' property.
-    $entity->field_test_taxonomy_term->entity = $term;
-    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $term->id());
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term->getName());
-
-    $entity->field_test_taxonomy_term = [['entity' => $term2]];
-    $this->assertEqual($entity->field_test_taxonomy_term->target_id, $term2->id());
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->getName(), $term2->getName());
-
-    // Test assigning an invalid item throws an exception.
-    try {
-      $entity->field_test_taxonomy_term = ['target_id' => 'invalid', 'entity' => $term2];
-      $this->fail('Assigning an invalid item throws an exception.');
-    }
-    catch (\InvalidArgumentException $e) {
-      $this->pass('Assigning an invalid item throws an exception.');
-    }
-
-    // Delete terms so we have nothing to reference and try again
-    $term->delete();
-    $term2->delete();
-    $entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
-    $entity->save();
-
-    // Test the generateSampleValue() method.
-    $entity = entity_create('entity_test');
-    $entity->field_test_taxonomy_term->generateSampleItems();
-    $entity->field_test_taxonomy_vocabulary->generateSampleItems();
-    $this->entityValidateAndSave($entity);
-  }
-
-  /**
-   * Tests the entity reference field type for referencing config entities.
-   */
-  public function testConfigEntityReferenceItem() {
-    $referenced_entity_id = $this->vocabulary->id();
-
-    // Just being able to create the entity like this verifies a lot of code.
-    $entity = entity_create('entity_test');
-    $entity->field_test_taxonomy_vocabulary->target_id = $referenced_entity_id;
-    $entity->name->value = $this->randomMachineName();
-    $entity->save();
-
-    $entity = entity_load('entity_test', $entity->id());
-    $this->assertTrue($entity->field_test_taxonomy_vocabulary instanceof FieldItemListInterface, 'Field implements interface.');
-    $this->assertTrue($entity->field_test_taxonomy_vocabulary[0] instanceof FieldItemInterface, 'Field item implements interface.');
-    $this->assertEqual($entity->field_test_taxonomy_vocabulary->target_id, $referenced_entity_id);
-    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->label(), $this->vocabulary->label());
-    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->id(), $referenced_entity_id);
-    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->uuid(), $this->vocabulary->uuid());
-
-    // Change the name of the term via the reference.
-    $new_name = $this->randomMachineName();
-    $entity->field_test_taxonomy_vocabulary->entity->set('name', $new_name);
-    $entity->field_test_taxonomy_vocabulary->entity->save();
-    // Verify it is the correct name.
-    $vocabulary = Vocabulary::load($referenced_entity_id);
-    $this->assertEqual($vocabulary->label(), $new_name);
-
-    // Make sure the computed term reflects updates to the term id.
-    $vocabulary2 = entity_create('taxonomy_vocabulary', array(
-      'name' => $this->randomMachineName(),
-      'vid' => Unicode::strtolower($this->randomMachineName()),
-      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-    ));
-    $vocabulary2->save();
-
-    $entity->field_test_taxonomy_vocabulary->target_id = $vocabulary2->id();
-    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->id(), $vocabulary2->id());
-    $this->assertEqual($entity->field_test_taxonomy_vocabulary->entity->label(), $vocabulary2->label());
-
-    // Delete terms so we have nothing to reference and try again
-    $this->vocabulary->delete();
-    $vocabulary2->delete();
-    $entity = entity_create('entity_test', array('name' => $this->randomMachineName()));
-    $entity->save();
-  }
-
-  /**
-   * Test saving order sequence doesn't matter.
-   */
-  public function testEntitySaveOrder() {
-    // The term entity is unsaved here.
-    $term = entity_create('taxonomy_term', array(
-      'name' => $this->randomMachineName(),
-      'vid' => $this->term->bundle(),
-      'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
-    ));
-    $entity = entity_create('entity_test');
-    // Now assign the unsaved term to the field.
-    $entity->field_test_taxonomy_term->entity = $term;
-    $entity->name->value = $this->randomMachineName();
-    // Now save the term.
-    $term->save();
-    // And then the entity.
-    $entity->save();
-    $this->assertEqual($entity->field_test_taxonomy_term->entity->id(), $term->id());
-  }
-
-}
diff --git a/core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php b/core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php
index e23aaf6..8693d3d 100644
--- a/core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php
+++ b/core/modules/file/src/Plugin/Field/FieldFormatter/FileFormatterBase.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase.
+ * Contains \Drupal\file\Plugin\field\formatter\FileFormatterBase.
  */
 
 namespace Drupal\file\Plugin\Field\FieldFormatter;
diff --git a/core/modules/file/src/Plugin/Field/FieldFormatter/GenericFileFormatter.php b/core/modules/file/src/Plugin/Field/FieldFormatter/GenericFileFormatter.php
index cdbf1c2..daa6bd6 100644
--- a/core/modules/file/src/Plugin/Field/FieldFormatter/GenericFileFormatter.php
+++ b/core/modules/file/src/Plugin/Field/FieldFormatter/GenericFileFormatter.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\file\Plugin\Field\FieldFormatter\GenericFileFormatter.
+ * Contains \Drupal\file\Plugin\field\formatter\GenericFileFormatter.
  */
 
 namespace Drupal\file\Plugin\Field\FieldFormatter;
diff --git a/core/modules/file/src/Plugin/Field/FieldFormatter/RSSEnclosureFormatter.php b/core/modules/file/src/Plugin/Field/FieldFormatter/RSSEnclosureFormatter.php
index 73e0494..89787d3 100644
--- a/core/modules/file/src/Plugin/Field/FieldFormatter/RSSEnclosureFormatter.php
+++ b/core/modules/file/src/Plugin/Field/FieldFormatter/RSSEnclosureFormatter.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\file\Plugin\Field\FieldFormatter\RSSEnclosureFormatter.
+ * Contains \Drupal\file\Plugin\field\formatter\RSSEnclosureFormatter.
  */
 
 namespace Drupal\file\Plugin\Field\FieldFormatter;
diff --git a/core/modules/file/src/Plugin/Field/FieldFormatter/TableFormatter.php b/core/modules/file/src/Plugin/Field/FieldFormatter/TableFormatter.php
index f05f89f..b5346c6 100644
--- a/core/modules/file/src/Plugin/Field/FieldFormatter/TableFormatter.php
+++ b/core/modules/file/src/Plugin/Field/FieldFormatter/TableFormatter.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\file\Plugin\Field\FieldFormatter\TableFormatter.
+ * Contains \Drupal\file\Plugin\field\formatter\TableFormatter.
  */
 
 namespace Drupal\file\Plugin\Field\FieldFormatter;
diff --git a/core/modules/file/src/Plugin/Field/FieldFormatter/UrlPlainFormatter.php b/core/modules/file/src/Plugin/Field/FieldFormatter/UrlPlainFormatter.php
index 978f95b..d29c582 100644
--- a/core/modules/file/src/Plugin/Field/FieldFormatter/UrlPlainFormatter.php
+++ b/core/modules/file/src/Plugin/Field/FieldFormatter/UrlPlainFormatter.php
@@ -2,7 +2,7 @@
 
 /**
  * @file
- * Contains \Drupal\file\Plugin\Field\FieldFormatter\UrlPlainFormatter.
+ * Contains \Drupal\file\Plugin\field\formatter\UrlPlainFormatter.
  */
 
 namespace Drupal\file\Plugin\Field\FieldFormatter;
diff --git a/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php b/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php
new file mode 100644
index 0000000..b7f02a7
--- /dev/null
+++ b/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php
@@ -0,0 +1,147 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\rest\Plugin\Derivative\EntityDerivative.
+ */
+
+namespace Drupal\rest\Plugin\Derivative;
+
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
+use Drupal\Core\Routing\RouteBuilderInterface;
+use Drupal\Core\Routing\RouteProviderInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\Routing\Exception\RouteNotFoundException;
+
+/**
+ * Provides a resource plugin definition for every entity type.
+ *
+ * @see \Drupal\rest\Plugin\rest\resource\EntityResource
+ */
+class EntityDerivative implements ContainerDeriverInterface {
+
+  /**
+   * List of derivative definitions.
+   *
+   * @var array
+   */
+  protected $derivatives;
+
+  /**
+   * The entity manager.
+   *
+   * @var \Drupal\Core\Entity\EntityManagerInterface
+   */
+  protected $entityManager;
+
+  /**
+   * The route provider.
+   *
+   * @var \Drupal\Core\Routing\RouteProviderInterface
+   */
+  protected $routeProvider;
+
+  /**
+   * The route builder.
+   *
+   * @var \Drupal\Core\Routing\RouteBuilderInterface
+   */
+  protected $routeBuilder;
+
+  /**
+   * Constructs an EntityDerivative object.
+   *
+   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+   *   The entity manager.
+   * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
+   *   The route provider.
+   * @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
+   *   The route builder.
+   */
+  public function __construct(EntityManagerInterface $entity_manager, RouteProviderInterface $route_provider, RouteBuilderInterface $route_builder) {
+    $this->entityManager = $entity_manager;
+    $this->routeProvider = $route_provider;
+    $this->routeBuilder = $route_builder;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, $base_plugin_id) {
+    return new static(
+      $container->get('entity.manager'),
+      $container->get('router.route_provider'),
+      $container->get('router.builder')
+    );
+  }
+
+  /**
+   * Implements DerivativeInterface::getDerivativeDefinition().
+   */
+  public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
+    if (!isset($this->derivatives)) {
+      $this->getDerivativeDefinitions($base_plugin_definition);
+    }
+    if (isset($this->derivatives[$derivative_id])) {
+      return $this->derivatives[$derivative_id];
+    }
+  }
+
+  /**
+   * Implements DerivativeInterface::getDerivativeDefinitions().
+   */
+  public function getDerivativeDefinitions($base_plugin_definition) {
+    if (!isset($this->derivatives)) {
+      // Add in the default plugin configuration and the resource type.
+      foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
+        $this->derivatives[$entity_type_id] = array(
+          'id' => 'entity:' . $entity_type_id,
+          'entity_type' => $entity_type_id,
+          'serialization_class' => $entity_type->getClass(),
+          'label' => $entity_type->getLabel(),
+        );
+
+        $default_uris = array(
+          'canonical' => "/entity/$entity_type_id/" . '{' . $entity_type_id . '}',
+          'http://drupal.org/link-relations/create' => "/entity/$entity_type_id",
+        );
+
+        foreach ($default_uris as $link_relation => $default_uri) {
+          // Check if there are link templates defined for the entity type and
+          // use the path from the route instead of the default.
+          $link_template = $entity_type->getLinkTemplate($link_relation);
+          if (strpos($link_template, '/') !== FALSE) {
+            $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = '/' . $link_template;
+          }
+          elseif ($route_name = $link_template) {
+            // @todo remove the try/catch as part of
+            // http://drupal.org/node/2281645
+            try {
+              if (($collection = $this->routeBuilder->getCollectionDuringRebuild()) && $route = $collection->get($route_name)) {
+              }
+              else {
+                $route = $this->routeProvider->getRouteByName($route_name);
+              }
+              $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = $route->getPath();
+            }
+            catch (RouteNotFoundException $e) {
+              // If the route does not exist it means we are in a brittle state
+              // of module installing/uninstalling, so we simply exclude this
+              // entity type.
+              unset($this->derivatives[$entity_type_id]);
+              // Continue with the next entity type;
+              continue 2;
+            }
+          }
+          else {
+            $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = $default_uri;
+          }
+        }
+
+        $this->derivatives[$entity_type_id] += $base_plugin_definition;
+      }
+    }
+    return $this->derivatives;
+  }
+}
diff --git a/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php b/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php
deleted file mode 100644
index 3d987a2..0000000
--- a/core/modules/rest/src/Plugin/Deriver/EntityDeriver.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\rest\Plugin\Deriver\EntityDerivative.
- */
-
-namespace Drupal\rest\Plugin\Deriver;
-
-use Drupal\Core\Entity\EntityManagerInterface;
-use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
-use Drupal\Core\Routing\RouteBuilderInterface;
-use Drupal\Core\Routing\RouteProviderInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\Routing\Exception\RouteNotFoundException;
-
-/**
- * Provides a resource plugin definition for every entity type.
- *
- * @see \Drupal\rest\Plugin\rest\resource\EntityResource
- */
-class EntityDeriver implements ContainerDeriverInterface {
-
-  /**
-   * List of derivative definitions.
-   *
-   * @var array
-   */
-  protected $derivatives;
-
-  /**
-   * The entity manager.
-   *
-   * @var \Drupal\Core\Entity\EntityManagerInterface
-   */
-  protected $entityManager;
-
-  /**
-   * Constructs an EntityDerivative object.
-   *
-   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
-   *   The entity manager.
-   */
-  public function __construct(EntityManagerInterface $entity_manager) {
-    $this->entityManager = $entity_manager;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public static function create(ContainerInterface $container, $base_plugin_id) {
-    return new static(
-      $container->get('entity.manager')
-    );
-  }
-
-  /**
-   * Implements DerivativeInterface::getDerivativeDefinition().
-   */
-  public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
-    if (!isset($this->derivatives)) {
-      $this->getDerivativeDefinitions($base_plugin_definition);
-    }
-    if (isset($this->derivatives[$derivative_id])) {
-      return $this->derivatives[$derivative_id];
-    }
-  }
-
-  /**
-   * Implements DerivativeInterface::getDerivativeDefinitions().
-   */
-  public function getDerivativeDefinitions($base_plugin_definition) {
-    if (!isset($this->derivatives)) {
-      // Add in the default plugin configuration and the resource type.
-      foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) {
-        $this->derivatives[$entity_type_id] = array(
-          'id' => 'entity:' . $entity_type_id,
-          'entity_type' => $entity_type_id,
-          'serialization_class' => $entity_type->getClass(),
-          'label' => $entity_type->getLabel(),
-        );
-
-        $default_uris = array(
-          'canonical' => "/entity/$entity_type_id/" . '{' . $entity_type_id . '}',
-          'http://drupal.org/link-relations/create' => "/entity/$entity_type_id",
-        );
-
-        foreach ($default_uris as $link_relation => $default_uri) {
-          // Check if there are link templates defined for the entity type and
-          // use the path from the route instead of the default.
-          if ($link_template = $entity_type->getLinkTemplate($link_relation)) {
-            $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = '/' . $link_template;
-          }
-          else {
-            $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = $default_uri;
-          }
-        }
-
-        $this->derivatives[$entity_type_id] += $base_plugin_definition;
-      }
-    }
-    return $this->derivatives;
-  }
-}
diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
index 0f2a785..b7d0264 100644
--- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php
@@ -23,7 +23,7 @@
  *   id = "entity",
  *   label = @Translation("Entity"),
  *   serialization_class = "Drupal\Core\Entity\Entity",
- *   deriver = "Drupal\rest\Plugin\Deriver\EntityDeriver",
+ *   deriver = "Drupal\rest\Plugin\Derivative\EntityDerivative",
  *   uri_paths = {
  *     "canonical" = "/entity/{entity_type}/{entity}",
  *     "http://drupal.org/link-relations/create" = "/entity/{entity_type}"
diff --git a/core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module b/core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module
index 74549db..97d1269 100644
--- a/core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module
+++ b/core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module
@@ -11,7 +11,7 @@
 function keyvalue_test_entity_type_alter(array &$entity_types) {
   /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
   if (isset($entity_types['config_test'])) {
-    $entity_types['config_test']->setStorageClass('Drupal\Core\Entity\KeyValueStore\KeyValueConfigEntityStorage');
+    $entity_types['config_test']->setStorageClass('Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage');
   }
   if (isset($entity_types['entity_test_label'])) {
     $entity_types['entity_test_label']->setStorageClass('Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage');
diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php
index 82e9e09..c083f7f 100644
--- a/core/modules/system/theme.api.php
+++ b/core/modules/system/theme.api.php
@@ -874,21 +874,18 @@ function hook_css_alter(&$css) {
  * depends on the elements of other modules, use hook_page_attachments_alter()
  * instead, which runs after this hook.
  *
- * If you try to add anything but #attached and #post_render_cache to the array
- * an exception is thrown.
- *
- * @param array &$attachments
- *   An array that you can add attachments to.
+ * @param array &$page
+ *   An empty renderable array representing the page.
  *
  * @see hook_page_attachments_alter()
  */
-function hook_page_attachments(array &$attachments) {
+function hook_page_attachments(array &$page) {
   // Unconditionally attach an asset to the page.
-  $attachments['#attached']['library'][] = 'core/domready';
+  $page['#attached']['library'][] = 'core/domready';
 
   // Conditionally attach an asset to the page.
   if (!\Drupal::currentUser()->hasPermission('may pet kittens')) {
-    $attachments['#attached']['library'][] = 'core/jquery';
+    $page['#attached']['library'][] = 'core/jquery';
   }
 }
 
@@ -899,19 +896,20 @@ function hook_page_attachments(array &$attachments) {
  * add attachments to the page that depend on another module's attachments (this
  * hook runs after hook_page_attachments().
  *
- * If you try to add anything but #attached and #post_render_cache to the array
- * an exception is thrown.
+ * If you want to alter the attachments added by other modules or if your module
+ * depends on the elements of other modules, use hook_page_attachments_alter()
+ * instead, which runs after this hook.
  *
- * @param array &$attachments
- *   Array of all attachments provided by hook_page_attachments() implementations.
+ * @param array &$page
+ *   An empty renderable array representing the page.
  *
  * @see hook_page_attachments_alter()
  */
-function hook_page_attachments_alter(array &$attachments) {
+function hook_page_attachments_alter(array &$page) {
   // Conditionally remove an asset.
-  if (in_array('core/jquery', $attachments['#attached']['library'])) {
-    $index = array_search('core/jquery', $attachments['#attached']['library']);
-    unset($attachments['#attached']['library'][$index]);
+  if (in_array('core/jquery', $page['#attached']['library'])) {
+    $index = array_search('core/jquery', $page['#attached']['library']);
+    unset($page['#attached']['library'][$index]);
   }
 }
 
diff --git a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/EntityReferenceTaxonomyTermRssFormatter.php b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/EntityReferenceTaxonomyTermRssFormatter.php
index 9f062a9..02fc472 100644
--- a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/EntityReferenceTaxonomyTermRssFormatter.php
+++ b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/EntityReferenceTaxonomyTermRssFormatter.php
@@ -9,7 +9,7 @@
 
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;
+use Drupal\entity_reference\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;
 
 /**
  * Plugin implementation of the 'entity reference taxonomy term RSS' formatter.
diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php
index 31863c3..cad7eb9 100644
--- a/core/modules/views/src/Plugin/views/filter/Combine.php
+++ b/core/modules/views/src/Plugin/views/filter/Combine.php
@@ -77,7 +77,15 @@ public function query() {
       }
     }
     if ($fields) {
-      $expression = implode(', ', $fields);
+      $count = count($fields);
+      $separated_fields = array();
+      foreach ($fields as $key => $field) {
+        $separated_fields[] = $field;
+        if ($key < $count-1) {
+          $separated_fields[] = "' '";
+        }
+      }
+      $expression = implode(', ', $separated_fields);
       $expression = "CONCAT_WS(' ', $expression)";
 
       $info = $this->operators();
diff --git a/core/modules/views/src/Tests/Handler/FilterCombineTest.php b/core/modules/views/src/Tests/Handler/FilterCombineTest.php
index 4decd83..516c773 100644
--- a/core/modules/views/src/Tests/Handler/FilterCombineTest.php
+++ b/core/modules/views/src/Tests/Handler/FilterCombineTest.php
@@ -82,49 +82,6 @@ public function testFilterCombineContains() {
   }
 
   /**
-   * Tests filtering result using a phrase that matches combined fields.
-   */
-  public function testFilterCombineContainsPhrase() {
-    $view = Views::getView('test_view');
-    $view->setDisplay();
-
-    $fields = $view->displayHandlers->get('default')->getOption('fields');
-    $view->displayHandlers->get('default')->overrideOption('fields', $fields + array(
-      'job' => array(
-        'id' => 'job',
-        'table' => 'views_test_data',
-        'field' => 'job',
-        'relationship' => 'none',
-      ),
-    ));
-
-    // Change the filtering.
-    $view->displayHandlers->get('default')->overrideOption('filters', array(
-      'age' => array(
-        'id' => 'combine',
-        'table' => 'views',
-        'field' => 'combine',
-        'relationship' => 'none',
-        'operator' => 'contains',
-        'fields' => array(
-          'name',
-          'job',
-        ),
-        'value' => 'ohn Si',
-      ),
-    ));
-
-    $this->executeView($view);
-    $resultset = array(
-      array(
-        'name' => 'John',
-        'job' => 'Singer',
-      ),
-    );
-    $this->assertIdenticalResultset($view, $resultset, $this->column_map);
-  }
-
-  /**
    * Tests if the filter can handle removed fields.
    *
    * Tests the combined filter handler when a field overwrite is done
diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
deleted file mode 100644
index 45074a5..0000000
--- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
+++ /dev/null
@@ -1,350 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Component\ProxyBuilder\ProxyBuilderTest.
- */
-
-namespace Drupal\Tests\Component\ProxyBuilder;
-
-use Drupal\Component\ProxyBuilder\ProxyBuilder;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * @coversDefaultClass \Drupal\Component\ProxyBuilder\ProxyBuilder
- * @group proxy_builder
- */
-class ProxyBuilderTest extends UnitTestCase {
-
-  /**
-   * The tested proxy builder.
-   *
-   * @var \Drupal\Component\ProxyBuilder\ProxyBuilder
-   */
-  protected $proxyBuilder;
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $this->proxyBuilder = new ProxyBuilder();
-  }
-
-  /**
-   * @covers ::buildProxyClassName()
-   */
-  public function testBuildProxyClassName() {
-    $class_name = $this->proxyBuilder->buildProxyClassName('Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod');
-    $this->assertEquals('Drupal_Tests_Component_ProxyBuilder_TestServiceNoMethod_Proxy', $class_name);
-  }
-
-  /**
-   * Tests the basic methods like the constructor and the lazyLoadItself method.
-   *
-   * @covers ::build()
-   * @covers ::buildConstructorMethod()
-   * @covers ::buildLazyLoadItselfMethod()
-   */
-  public function testBuildNoMethod() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod';
-
-    $result = $this->proxyBuilder->build($class);
-    $this->assertEquals($this->buildExpectedClass($class, ''), $result);
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildSimpleMethod() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceSimpleMethod';
-
-    $result = $this->proxyBuilder->build($class);
-
-    $method_body = <<<'EOS'
-
-    public function method()
-    {
-        return $this->lazyLoadItself()->method();
-    }
-
-EOS;
-    $this->assertEquals($this->buildExpectedClass($class, $method_body), $result);
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildParameter()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildMethodWithParameter() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceMethodWithParameter';
-
-    $result = $this->proxyBuilder->build($class);
-
-    $method_body = <<<'EOS'
-
-    public function methodWithParameter($parameter)
-    {
-        return $this->lazyLoadItself()->methodWithParameter($parameter);
-    }
-
-EOS;
-    $this->assertEquals($this->buildExpectedClass($class, $method_body), $result);
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildParameter()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildComplexMethod() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceComplexMethod';
-
-    $result = $this->proxyBuilder->build($class);
-
-    // @todo Solve the silly linebreak for array()
-    $method_body = <<<'EOS'
-
-    public function complexMethod($parameter, callable $function, \Drupal\Tests\Component\ProxyBuilder\TestServiceNoMethod $test_service = NULL, array &$elements = array (
-    ))
-    {
-        return $this->lazyLoadItself()->complexMethod($parameter, $function, $test_service, $elements);
-    }
-
-EOS;
-
-    $this->assertEquals($this->buildExpectedClass($class, $method_body), $result);
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildReturnReference() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceReturnReference';
-
-    $result = $this->proxyBuilder->build($class);
-
-    // @todo Solve the silly linebreak for array()
-    $method_body = <<<'EOS'
-
-    public function &returnReference()
-    {
-        return $this->lazyLoadItself()->returnReference();
-    }
-
-EOS;
-
-    $this->assertEquals($this->buildExpectedClass($class, $method_body), $result);
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildParameter()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildWithInterface() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithInterface';
-
-    $result = $this->proxyBuilder->build($class);
-
-    $method_body = <<<'EOS'
-
-    public function testMethod($parameter)
-    {
-        return $this->lazyLoadItself()->testMethod($parameter);
-    }
-
-EOS;
-
-    $interface_string = ' implements \Drupal\Tests\Component\ProxyBuilder\TestInterface';
-    $this->assertEquals($this->buildExpectedClass($class, $method_body, $interface_string), $result);
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildParameter()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildWithProtectedAndPrivateMethod() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithProtectedMethods';
-
-    $result = $this->proxyBuilder->build($class);
-
-    $method_body = <<<'EOS'
-
-    public function testMethod($parameter)
-    {
-        return $this->lazyLoadItself()->testMethod($parameter);
-    }
-
-EOS;
-
-$this->assertEquals($this->buildExpectedClass($class, $method_body), $result);
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildParameter()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildWithPublicStaticMethod() {
-    $class = 'Drupal\Tests\Component\ProxyBuilder\TestServiceWithPublicStaticMethod';
-
-    $result = $this->proxyBuilder->build($class);
-
-    // Ensure that the static method is not wrapped.
-    $method_body = <<<'EOS'
-
-    public static function testMethod($parameter)
-    {
-        \Drupal\Tests\Component\ProxyBuilder\TestServiceWithPublicStaticMethod::testMethod($parameter);
-    }
-
-EOS;
-
-    $this->assertEquals($this->buildExpectedClass($class, $method_body), $result);
-  }
-
-  /**
-   * Constructs the expected class output.
-   *
-   * @param string $expected_methods_body
-   *   The expected body of decorated methods.
-   *
-   * @return string
-   *   The code of the entire proxy.
-   */
-  protected function buildExpectedClass($class, $expected_methods_body, $interface_string = '') {
-    $proxy_class = $this->proxyBuilder->buildProxyClassName($class);
-    $expected_string = <<<'EOS'
-/**
- * Provides a proxy class for \{{ class }}.
- *
- * @see \Drupal\Component\ProxyBuilder
- */
-class {{ proxy_class }}{{ interface_string }}
-{
-
-    /**
-     * @var string
-     */
-    protected $serviceId;
-
-    /**
-     * @var \{{ class }}
-     */
-    protected $service;
-
-    /**
-     * The service container.
-     *
-     * @var \Symfony\Component\DependencyInjection\ContainerInterface
-     */
-    protected $container;
-
-    public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, $serviceId)
-    {
-        $this->container = $container;
-        $this->serviceId = $serviceId;
-    }
-
-    protected function lazyLoadItself()
-    {
-        if (!isset($this->service)) {
-            $method_name = 'get' . Container::camelize($this->serviceId) . 'Service';
-            $this->service = $this->container->$method_name(false);
-        }
-
-        return $this->service;
-    }
-{{ expected_methods_body }}
-}
-
-EOS;
-    $expected_string = str_replace('{{ proxy_class }}', $proxy_class, $expected_string);
-    $expected_string = str_replace('{{ class }}', $class, $expected_string);
-    $expected_string = str_replace('{{ expected_methods_body }}', $expected_methods_body, $expected_string);
-    $expected_string = str_replace('{{ interface_string }}', $interface_string, $expected_string);
-
-    return $expected_string;
-  }
-
-}
-
-class TestServiceNoMethod {
-
-}
-
-class TestServiceSimpleMethod {
-
-  public function method() {
-
-  }
-
-}
-
-class TestServiceMethodWithParameter {
-
-  public function methodWithParameter($parameter) {
-
-  }
-
-}
-
-class TestServiceComplexMethod {
-
-  public function complexMethod($parameter, callable $function, TestServiceNoMethod $test_service = NULL, array &$elements = array()) {
-
-  }
-
-}
-
-class TestServiceReturnReference {
-
-  public function &returnReference() {
-
-  }
-
-}
-
-interface TestInterface {
-
-  public function testMethod($parameter);
-
-}
-
-class TestServiceWithInterface implements TestInterface {
-
-  public function testMethod($parameter) {
-
-  }
-
-}
-
-class TestServiceWithProtectedMethods {
-
-  public function testMethod($parameter) {
-
-  }
-
-  protected function protectedMethod($parameter) {
-
-  }
-
-  protected function privateMethod($parameter) {
-
-  }
-
-}
-
-class TestServiceWithPublicStaticMethod {
-
-  public static function testMethod($parameter) {
-  }
-
-}
-
diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyDumperTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyDumperTest.php
deleted file mode 100644
index d8fed50..0000000
--- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyDumperTest.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Component\ProxyBuilder\ProxyDumperTest.
- */
-
-namespace Drupal\Tests\Component\ProxyBuilder;
-
-use Drupal\Component\ProxyBuilder\ProxyDumper;
-use Drupal\Tests\UnitTestCase;
-use Symfony\Component\DependencyInjection\Definition;
-
-/**
- * @coversDefaultClass \Drupal\Component\ProxyBuilder\ProxyDumper
- * @group proxy_builder
- */
-class ProxyDumperTest extends UnitTestCase {
-
-  /**
-   * The mocked proxy builder.
-   *
-   * @var \Drupal\Component\ProxyBuilder\ProxyBuilder|\PHPUnit_Framework_MockObject_MockObject
-   */
-  protected $proxyBuilder;
-
-  /**
-   * The tested proxy dumper.
-   *
-   * @var \Drupal\Component\ProxyBuilder\ProxyDumper
-   */
-  protected $proxyDumper;
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $this->proxyBuilder = $this->getMockBuilder('Drupal\Component\ProxyBuilder\ProxyBuilder')
-      ->disableOriginalConstructor()
-      ->setMethods(['build'])
-      ->getMock();
-    $this->proxyDumper = new ProxyDumper($this->proxyBuilder);
-  }
-
-  /**
-   * @dataProvider providerTestIsProxyCandidate
-   * @covers ::isProxyCandidate()
-   */
-  public function testIsProxyCandidate(Definition $definition, $expected) {
-    $this->assertSame($expected, $this->proxyDumper->isProxyCandidate($definition));
-  }
-
-  public function providerTestIsProxyCandidate() {
-    // Not lazy service.
-    $data = [];
-    $definition = new Definition('Drupal\Tests\Component\ProxyBuilder\TestService');
-    $data[] = [$definition, FALSE];
-    // Not existing service.
-    $definition = new Definition('Drupal\Tests\Component\ProxyBuilder\TestNotExistingService');
-    $definition->setLazy(TRUE);
-    $data[] = [$definition, FALSE];
-    // Existing and lazy service.
-    $definition = new Definition('Drupal\Tests\Component\ProxyBuilder\TestService');
-    $definition->setLazy(TRUE);
-    $data[] = [$definition, TRUE];
-
-    return $data;
-  }
-
-  public function testGetProxyFactoryCode() {
-    $definition = new Definition('Drupal\Tests\Component\ProxyBuilder\TestService');
-    $definition->setLazy(TRUE);
-
-    $result = $this->proxyDumper->getProxyFactoryCode($definition, 'test_service');
-
-    $expected = <<<'EOS'
-        if ($lazyLoad) {
-            return $this->services['test_service'] = new Drupal_Tests_Component_ProxyBuilder_TestService_Proxy($this, 'test_service');
-        }
-
-EOS;
-
-    $this->assertEquals($expected, $result);
-  }
-
-  public function testGetProxyCode() {
-    $definition = new Definition('Drupal\Tests\Component\ProxyBuilder\TestService');
-    $definition->setLazy(TRUE);
-
-    $class = 'class Drupal_Tests_Component_ProxyBuilder_TestService_Proxy {}';
-    $this->proxyBuilder->expects($this->once())
-      ->method('build')
-      ->with('Drupal\Tests\Component\ProxyBuilder\TestService')
-      ->willReturn($class);
-
-    $result = $this->proxyDumper->getProxyCode($definition);
-    $this->assertEquals($class, $result);
-  }
-
-}
-
-class TestService {
-
-}
diff --git a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
deleted file mode 100644
index d3cc447..0000000
--- a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Core\ProxyBuilder\ProxyBuilderTest.
- */
-
-namespace Drupal\Tests\Core\ProxyBuilder;
-use Drupal\Core\ProxyBuilder\ProxyBuilder;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * @coversDefaultClass \Drupal\Core\ProxyBuilder\ProxyBuilder
- * @group proxy_builder
- */
-class ProxyBuilderTest extends UnitTestCase {
-
-  /**
-   * The tested proxy builder.
-   *
-   * @var \Drupal\Core\ProxyBuilder\ProxyBuilder
-   */
-  protected $proxyBuilder;
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $this->proxyBuilder = new ProxyBuilder();
-  }
-
-  /**
-   * @covers ::buildMethod()
-   * @covers ::buildParameter()
-   * @covers ::buildMethodBody()
-   */
-  public function testBuildComplexMethod() {
-    $class = 'Drupal\Tests\Core\ProxyBuilder\TestServiceComplexMethod';
-
-    $result = $this->proxyBuilder->build($class);
-
-    // @todo Solve the silly linebreak for array()
-    $method_body = <<<'EOS'
-
-    public function complexMethod($parameter, callable $function, \Drupal\Tests\Core\ProxyBuilder\TestServiceNoMethod $test_service = NULL, array &$elements = array (
-    ))
-    {
-        return $this->lazyLoadItself()->complexMethod($parameter, $function, $test_service, $elements);
-    }
-
-EOS;
-
-    $this->assertEquals($this->buildExpectedClass($class, $method_body), $result);
-  }
-
-  /**
-   * Constructs the expected class output.
-   *
-   * @param string $expected_methods_body
-   *   The expected body of decorated methods.
-   *
-   * @return string
-   *   The code of the entire proxy.
-   */
-  protected function buildExpectedClass($class, $expected_methods_body, $interface_string = '') {
-    $proxy_class = $this->proxyBuilder->buildProxyClassName($class);
-    $expected_string = <<<'EOS'
-/**
- * Provides a proxy class for \{{ class }}.
- *
- * @see \Drupal\Component\ProxyBuilder
- */
-class {{ proxy_class }}{{ interface_string }}
-{
-
-    use \Drupal\Core\DependencyInjection\DependencySerializationTrait;
-
-    /**
-     * @var string
-     */
-    protected $serviceId;
-
-    /**
-     * @var \{{ class }}
-     */
-    protected $service;
-
-    /**
-     * The service container.
-     *
-     * @var \Symfony\Component\DependencyInjection\ContainerInterface
-     */
-    protected $container;
-
-    public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, $serviceId)
-    {
-        $this->container = $container;
-        $this->serviceId = $serviceId;
-    }
-
-    protected function lazyLoadItself()
-    {
-        if (!isset($this->service)) {
-            $method_name = 'get' . Container::camelize($this->serviceId) . 'Service';
-            $this->service = $this->container->$method_name(false);
-        }
-
-        return $this->service;
-    }
-{{ expected_methods_body }}
-}
-
-EOS;
-    $expected_string = str_replace('{{ proxy_class }}', $proxy_class, $expected_string);
-    $expected_string = str_replace('{{ class }}', $class, $expected_string);
-    $expected_string = str_replace('{{ expected_methods_body }}', $expected_methods_body, $expected_string);
-    $expected_string = str_replace('{{ interface_string }}', $interface_string, $expected_string);
-
-    return $expected_string;
-  }
-}
-
-class TestServiceNoMethod {
-
-}
-
-class TestServiceComplexMethod {
-
-  public function complexMethod($parameter, callable $function, TestServiceNoMethod $test_service = NULL, array &$elements = array()) {
-
-  }
-
-}
