diff --git a/core/includes/common.inc b/core/includes/common.inc
index af96028..d18c0c1 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -703,6 +703,8 @@ function filter_xss_admin($string) {
  *   valid UTF-8.
  *
  * @see \Drupal\Component\Utility\Xss::filter()
+ *
+ * @ingroup sanitization
  */
 function filter_xss($string, $allowed_tags = array('a', 'em', 'strong', 'cite', 'blockquote', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd')) {
   return Xss::filter($string, $allowed_tags);
diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php
index 76e51e4..2c27ccb 100644
--- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php
+++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php
@@ -12,14 +12,6 @@
 /**
  * Defines an Entity type annotation object.
  *
- * Entity type plugins use an object-based annotation method, rather than an
- * array-type annotation method (as commonly used on other annotation types).
- * The annotation properties of entity types are found on
- * \Drupal\Core\Entity\EntityType and are accessed using get/set methods defined
- * in \Drupal\Core\Entity\EntityTypeInterface.
- *
- * @see \Drupal\Core\Entity\Annotation\EntityType
- *
  * @Annotation
  */
 class EntityType extends Plugin {
diff --git a/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php b/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php
index 888abdb..fc3d1a5 100644
--- a/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityFormBuilderInterface.php
@@ -19,11 +19,7 @@
    *   The entity to be created or edited.
    * @param string $operation
    *   (optional) The operation identifying the form variation to be returned.
-   *   Defaults to 'default'. This is typically used in routing:
-   *   @code
-   *   _entity_form: node.book_outline
-   *   @endcode
-   *   where "book_outline" is the value of $operation.
+   *   Defaults to 'default'.
    * @param array $form_state
    *   (optional) An associative array containing the current state of the form.
    *   Use this to pass additional information to the form, such as the
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
index 226dc91..857d3e7 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
@@ -229,8 +229,6 @@ public function setStorageClass($class);
    *
    * @return string
    *   The class for this operation's form for this entity type.
-   *
-   * @see \Drupal\Core\Entity\EntityFormBuilderInterface
    */
   public function getFormClass($operation);
 
@@ -240,12 +238,9 @@ public function getFormClass($operation);
    * @param string $operation
    *   The operation to use this form class for.
    * @param string $class
-   *   The form class implementing
-   *   \Drupal\Core\Entity\EntityFormControllerInterface.
+   *   The form class to use for the operation.
    *
    * @return static
-   *
-   * @see \Drupal\Core\Entity\EntityFormBuilderInterface
    */
   public function setFormClass($operation, $class);
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileModuleTestsTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileModuleTestsTest.php
new file mode 100644
index 0000000..1b87a17
--- /dev/null
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileModuleTestsTest.php
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * @file
+ * Definition of \Drupal\simpletest\Tests\OtherInstallationProfileModuleTestsTest.
+ */
+
+namespace Drupal\simpletest\Tests;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Verifies that tests in other installation profiles are not found.
+ *
+ * @see SimpleTestInstallationProfileModuleTestsTestCase
+ */
+class OtherInstallationProfileModuleTestsTest extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('simpletest');
+
+  /**
+   * Use the Minimal profile.
+   *
+   * The Testing profile contains drupal_system_listing_compatible_test.test,
+   * which should not be found.
+   *
+   * @see SimpleTestInstallationProfileModuleTestsTestCase
+   * @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
+   */
+  protected $profile = 'minimal';
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Other Installation profiles',
+      'description' => 'Verifies that tests in other installation profiles are not found.',
+      'group' => 'SimpleTest',
+    );
+  }
+
+  function setUp() {
+    parent::setUp();
+
+    $this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
+    $this->drupalLogin($this->admin_user);
+  }
+
+  /**
+   * Tests that tests located in another installation profile do not appear.
+   */
+  function testOtherInstallationProfile() {
+    $this->drupalGet('admin/config/development/testing');
+    $this->assertNoText('Installation profile module tests helper');
+  }
+}
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileTestsTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileTestsTest.php
deleted file mode 100644
index aa848e1..0000000
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/OtherInstallationProfileTestsTest.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\simpletest\Tests\OtherInstallationProfileTestsTest.
- */
-
-namespace Drupal\simpletest\Tests;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Verifies that tests in other installation profiles are found.
- *
- * @see SimpleTestInstallationProfileModuleTestsTestCase
- */
-class OtherInstallationProfileTestsTest extends WebTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('simpletest');
-
-  /**
-   * Use the Minimal profile.
-   *
-   * The Testing profile contains drupal_system_listing_compatible_test.test,
-   * which should be found.
-   *
-   * The Standard profile contains \Drupal\standard\Tests\StandardTest, which
-   * should be found.
-   *
-   * @see \Drupal\simpletest\Tests\InstallationProfileModuleTestsTest
-   * @see \Drupal\drupal_system_listing_compatible_test\Tests\SystemListingCompatibleTest
-   */
-  protected $profile = 'minimal';
-
-  public static function getInfo() {
-    return array(
-      'name' => 'Other Installation profiles',
-      'description' => 'Verifies that tests in modules contained in other installation profiles are found.',
-      'group' => 'SimpleTest',
-    );
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    $this->admin_user = $this->drupalCreateUser(array('administer unit tests'));
-    $this->drupalLogin($this->admin_user);
-  }
-
-  /**
-   * Tests that tests located in another installation profile appear.
-   */
-  function testOtherInstallationProfile() {
-    // Assert the existence of a test in a different installation profile than
-    // the current.
-    $this->drupalGet('admin/config/development/testing');
-    $this->assertText('Tests Standard installation profile expectations.');
-
-    // Assert the existence of a test for a module in a different installation
-    // profile than the current.
-    $this->drupalGet('admin/config/development/testing');
-    $this->assertText('Installation profile module tests helper');
-  }
-
-}
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 30a6280..3f699d3 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -586,7 +586,7 @@ protected function drupalCreateRole(array $permissions, $rid = NULL, $name = NUL
       // Grant the specified permissions to the role, if any.
       if (!empty($permissions)) {
         user_role_grant_permissions($role->id(), $permissions);
-        $assigned_permissions = entity_load('user_role', $role->id())->permissions;
+        $assigned_permissions = entity_load('user_role', $role->id())->getPermissions();
         $missing_permissions = array_diff($permissions, $assigned_permissions);
         if (!$missing_permissions) {
           $this->pass(String::format('Created permissions: @perms', array('@perms' => implode(', ', $permissions))), 'Role');
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 579e85b..8da7e4c 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -448,8 +448,6 @@ function simpletest_test_get_all($module = NULL) {
     else {
       // Select all PSR-0 classes in the Tests namespace of all modules.
       $listing = new ExtensionDiscovery();
-      // Ensure that tests in all profiles are discovered.
-      $listing->setProfileDirectories(array());
       $all_data = $listing->scan('module', TRUE);
       // If module is set then we keep only that one module.
       if (isset($module)) {
@@ -551,8 +549,6 @@ function simpletest_classloader_register() {
   }
   else {
     $listing = new ExtensionDiscovery();
-    // Ensure that tests in all profiles are discovered.
-    $listing->setProfileDirectories(array());
     $extensions = array();
     foreach ($types as $type) {
       foreach ($listing->scan($type, TRUE) as $name => $file) {
diff --git a/core/modules/user/lib/Drupal/user/Entity/Role.php b/core/modules/user/lib/Drupal/user/Entity/Role.php
index 2a025d9..a7fa255 100644
--- a/core/modules/user/lib/Drupal/user/Entity/Role.php
+++ b/core/modules/user/lib/Drupal/user/Entity/Role.php
@@ -122,9 +122,9 @@ public function preSave(EntityStorageControllerInterface $storage_controller) {
     if (!isset($this->weight) && ($roles = $storage_controller->loadMultiple())) {
       // Set a role weight to make this new role last.
       $max = array_reduce($roles, function($max, $role) {
-        return $max > $role->weight ? $max : $role->weight;
+        return $max > $role->getWeight() ? $max : $role->getWeight();
       });
-      $this->weight = $max + 1;
+      $this->setWeight($max + 1);
     }
   }
 
@@ -150,4 +150,18 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont
     Cache::invalidateTags(array('role' => $ids));
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getWeight() {
+    return $this->get('weight');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setWeight($weight) {
+    $this->set('weight', $weight);
+    return $this;
+  }
 }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php b/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php
index a50ac39..702a13f 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/access/Role.php
@@ -10,6 +10,7 @@
 use Drupal\views\Plugin\views\access\AccessPluginBase;
 use Symfony\Component\Routing\Route;
 use Drupal\Core\Session\AccountInterface;
+use Drupal\Component\Utility\String;
 
 /**
  * Access plugin that provides role-based access control.
@@ -56,7 +57,7 @@ public function summaryTitle() {
     else {
       $rids = user_role_names();
       $rid = reset($this->options['role']);
-      return check_plain($rids[$rid]);
+      return String::checkPlain($rids[$rid]);
     }
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
index d7c3701..ba976b0 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_validator/User.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Database\Connection;
 use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Component\Utility\String;
 
 /**
  * Validate whether an argument is a valid user.
@@ -157,7 +158,7 @@ public function validateArgument($argument) {
     }
 
     $this->argument->argument = $account->id();
-    $this->argument->validated_title = check_plain(user_format_name($account));
+    $this->argument->validated_title = String::checkPlain($account->getUsername());
     return TRUE;
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
index 7b189aa..01630b2 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Name.php
@@ -11,6 +11,7 @@
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\ResultRow;
 use Drupal\views\ViewExecutable;
+use Drupal\Component\Utility\String;
 
 /**
  * Field handler to provide simple renderer that allows using a themed user link.
@@ -84,7 +85,7 @@ protected function renderLink($data, ResultRow $values) {
     if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
       if (!empty($this->options['overwrite_anonymous']) && !$account->id()) {
         // This is an anonymous user, and we're overriting the text.
-        return check_plain($this->options['anonymous_text']);
+        return String::checkPlain($this->options['anonymous_text']);
       }
       elseif (!empty($this->options['link_to_user'])) {
         $account->name = $this->getValue($values);
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
index ec9df99..00dd343 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Roles.php
@@ -12,6 +12,7 @@
 use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\field\PrerenderList;
 use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Component\Utility\String;
 
 /**
  * Field handler to provide a list of roles.
@@ -80,7 +81,7 @@ public function preRender(&$values) {
       $roles = user_roles();
       $result = $this->database->query('SELECT u.uid, u.rid FROM {users_roles} u WHERE u.uid IN (:uids) AND u.rid IN (:rids)', array(':uids' => $uids, ':rids' => array_keys($roles)));
       foreach ($result as $role) {
-        $this->items[$role->uid][$role->rid]['role'] = check_plain($roles[$role->rid]->label());
+        $this->items[$role->uid][$role->rid]['role'] = String::checkPlain($roles[$role->rid]->label());
         $this->items[$role->uid][$role->rid]['rid'] = $role->rid;
       }
       // Sort the roles for each user by role weight.
diff --git a/core/modules/user/lib/Drupal/user/RoleFormController.php b/core/modules/user/lib/Drupal/user/RoleFormController.php
index 0cf8cd4..8aee5be 100644
--- a/core/modules/user/lib/Drupal/user/RoleFormController.php
+++ b/core/modules/user/lib/Drupal/user/RoleFormController.php
@@ -42,7 +42,7 @@ public function form(array $form, array &$form_state) {
     );
     $form['weight'] = array(
       '#type' => 'value',
-      '#value' => $entity->get('weight'),
+      '#value' => $entity->getWeight(),
     );
 
     return parent::form($form, $form_state, $entity);
diff --git a/core/modules/user/lib/Drupal/user/RoleInterface.php b/core/modules/user/lib/Drupal/user/RoleInterface.php
index 7160a8e..72b9aa6 100644
--- a/core/modules/user/lib/Drupal/user/RoleInterface.php
+++ b/core/modules/user/lib/Drupal/user/RoleInterface.php
@@ -55,4 +55,23 @@ public function grantPermission($permission);
    */
   public function revokePermission($permission);
 
+  /**
+   * Returns the weight.
+   *
+   * @return int
+   *   The weight of this role.
+   */
+  public function getWeight();
+
+  /**
+   * Sets the weight to the given value.
+   *
+   * @param int $weight
+   *   The desired weight.
+   *
+   * @return \Drupal\user\RoleInterface
+   *   The class instance this method is called on.
+   */
+  public function setWeight($weight);
+
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php
index de8062e..f04d682 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAutocompleteTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\user\Tests;
 
 use Drupal\simpletest\WebTestBase;
+use Drupal\Component\Utility\String;
 
 /**
  * Test user autocompletion.
@@ -53,7 +54,7 @@ function testUserAutocomplete() {
     // Test that anonymous username is in the result when requested and escaped
     // with check_plain().
     $users = $this->drupalGetJSON('user/autocomplete/anonymous', array('query' => array('q' => drupal_substr($anonymous_name, 0, 4))));
-    $this->assertEqual(check_plain($anonymous_name), $users[0]['label'], 'The anonymous name found in autocompletion results.');
+    $this->assertEqual(String::checkPlain($anonymous_name), $users[0]['label'], 'The anonymous name found in autocompletion results.');
     $users = $this->drupalGetJSON('user/autocomplete', array('query' => array('q' => drupal_substr($anonymous_name, 0, 4))));
     $this->assertTrue(empty($users), 'The anonymous name not found in autocompletion results without enabling anonymous username.');
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php
index 2658b1a..d323a9b 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php
@@ -97,9 +97,9 @@ function testRoleWeightOrdering() {
     // Change the role weights to make the roles in reverse order.
     $edit = array();
     foreach ($roles as $role) {
-      $edit['entities['. $role->id() .'][weight]'] =  $weight;
+      $edit['entities['. $role->id() .'][weight]'] = $weight;
       $new_role_weights[$role->id()] = $weight;
-      $saved_rids[] = $role->id;
+      $saved_rids[] = $role->id();
       $weight--;
     }
     $this->drupalPostForm('admin/people/roles', $edit, t('Save order'));
@@ -111,8 +111,8 @@ function testRoleWeightOrdering() {
     $rids = array();
     // Test that the role weights have been correctly saved.
     foreach ($roles as $role) {
-      $this->assertEqual($role->weight, $new_role_weights[$role->id()]);
-      $rids[] = $role->id;
+      $this->assertEqual($role->getWeight(), $new_role_weights[$role->id()]);
+      $rids[] = $role->id();
     }
     // The order of the roles should be reversed.
     $this->assertIdentical($rids, array_reverse($saved_rids));
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
index 991ac35..8baf714 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
@@ -9,6 +9,7 @@
 
 use Drupal\simpletest\WebTestBase;
 use Drupal\Core\Language\Language;
+use Drupal\Component\Utility\String;
 
 /**
  * Test user token replacement in strings.
@@ -62,15 +63,15 @@ function testUserTokenReplacement() {
     // Generate and test sanitized tokens.
     $tests = array();
     $tests['[user:uid]'] = $account->id();
-    $tests['[user:name]'] = check_plain(user_format_name($account));
-    $tests['[user:mail]'] = check_plain($account->getEmail());
+    $tests['[user:name]'] = String::checkPlain(user_format_name($account));
+    $tests['[user:mail]'] = String::checkPlain($account->getEmail());
     $tests['[user:url]'] = url("user/" . $account->id(), $url_options);
     $tests['[user:edit-url]'] = url("user/" . $account->id() . "/edit", $url_options);
     $tests['[user:last-login]'] = format_date($account->getLastLoginTime(), 'medium', '', NULL, $language_interface->id);
     $tests['[user:last-login:short]'] = format_date($account->getLastLoginTime(), 'short', '', NULL, $language_interface->id);
     $tests['[user:created]'] = format_date($account->getCreatedTime(), 'medium', '', NULL, $language_interface->id);
     $tests['[user:created:short]'] = format_date($account->getCreatedTime(), 'short', '', NULL, $language_interface->id);
-    $tests['[current-user:name]'] = check_plain(user_format_name($global_account));
+    $tests['[current-user:name]'] = String::checkPlain(user_format_name($global_account));
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index ab9a163..bef8af8 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -14,6 +14,7 @@
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Drupal\menu_link\Entity\MenuLink;
+use Drupal\Component\Utility\String;
 
 /**
  * @file
@@ -633,7 +634,7 @@ function template_preprocess_username(&$variables) {
   else {
     $variables['truncated'] = FALSE;
   }
-  $variables['name'] = check_plain($name);
+  $variables['name'] = String::checkPlain($name);
   $variables['profile_access'] = \Drupal::currentUser()->hasPermission('access user profiles');
 
   // Populate link path and attributes if appropriate.
diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc
index e3c22f2..ed87f64 100644
--- a/core/modules/user/user.tokens.inc
+++ b/core/modules/user/user.tokens.inc
@@ -5,6 +5,8 @@
  * Builds placeholder replacement tokens for user-related data.
  */
 
+use Drupal\Component\Utility\String;
+
 /**
  * Implements hook_token_info().
  */
@@ -88,11 +90,11 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
 
         case 'name':
           $name = user_format_name($account);
-          $replacements[$original] = $sanitize ? check_plain($name) : $name;
+          $replacements[$original] = $sanitize ? String::checkPlain($name) : $name;
           break;
 
         case 'mail':
-          $replacements[$original] = $sanitize ? check_plain($account->getEmail()) : $account->getEmail();
+          $replacements[$original] = $sanitize ? String::checkPlain($account->getEmail()) : $account->getEmail();
           break;
 
         case 'url':
