diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 0f46eb3..c34534c 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1903,7 +1903,7 @@ function drupal_get_user_timezone() {
   global $user;
   $config = config('system.timezone');
 
-  if ($config->get('user.configurable') && $user->uid && $user->timezone) {
+  if ($config->get('user.configurable') && $user->id() && $user->timezone) {
     return $user->timezone;
   }
   else {
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 667807a..90e8409 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4052,7 +4052,7 @@ function drupal_get_token($value = '') {
  */
 function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) {
   global $user;
-  return (($skip_anonymous && $user->uid == 0) || ($token == drupal_get_token($value)));
+  return (($skip_anonymous && $user->id() == 0) || ($token == drupal_get_token($value)));
 }
 
 /**
diff --git a/core/includes/file.inc b/core/includes/file.inc
index 58644ff..1af50cc 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1123,7 +1123,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
     }
     // Begin building file entity.
     $values = array(
-      'uid' => $user->uid,
+      'uid' => $user->id(),
       'status' => 0,
       'filename' => trim(drupal_basename($name, '.')),
       'uri' => $uploaded_files['files']['tmp_name'][$form_field_name][$i],
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 90d47fb..b685c87 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -538,7 +538,7 @@ function drupal_rebuild_form($form_id, &$form_state, $old_form = NULL) {
 function form_get_cache($form_build_id, &$form_state) {
   if ($form = Drupal::keyValueExpirable('form')->get($form_build_id)) {
     global $user;
-    if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->uid)) {
+    if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && !$user->id())) {
       if ($stored_form_state = Drupal::keyValueExpirable('form_state')->get($form_build_id)) {
         // Re-populate $form_state for subsequent rebuilds.
         $form_state = $stored_form_state + $form_state;
@@ -570,7 +570,7 @@ function form_set_cache($form_build_id, $form, $form_state) {
 
   // Cache form structure.
   if (isset($form)) {
-    if ($GLOBALS['user']->uid) {
+    if ($GLOBALS['user']->id()) {
       $form['#cache_token'] = drupal_get_token();
     }
     Drupal::keyValueExpirable('form')->setWithExpire($form_build_id, $form, $expire);
@@ -1051,7 +1051,8 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
   // tokens are session-bound and forms displayed to anonymous users are very
   // likely cached, we cannot assign a token for them.
   // During installation, there is no $user yet.
-  if (!empty($user->uid) && !$form_state['programmed']) {
+  $uid = $user->id();
+  if (!empty($uid) && !$form_state['programmed']) {
     // Form constructors may explicitly set #token to FALSE when cross site
     // request forgery is irrelevant to the form, such as search forms.
     if (isset($form['#token']) && $form['#token'] === FALSE) {
@@ -4876,7 +4877,7 @@ function _form_set_attributes(&$element, $class = array()) {
  * $batch = array(
  *   'title' => t('Exporting'),
  *   'operations' => array(
- *     array('my_function_1', array($account->uid, 'story')),
+ *     array('my_function_1', array($account->id(), 'story')),
  *     array('my_function_2', array()),
  *   ),
  *   'finished' => 'my_finished_callback',
diff --git a/core/includes/language.inc b/core/includes/language.inc
index 896cf69..5309b61 100644
--- a/core/includes/language.inc
+++ b/core/includes/language.inc
@@ -462,7 +462,7 @@ function language_negotiation_method_invoke($method_id, $method = NULL, $request
     }
     // If the language negotiation method has no cache preference or this is
     // satisfied we can execute the callback.
-    $cache = !isset($method['cache']) || $user->uid || $method['cache'] == variable_get('cache', 0);
+    $cache = !isset($method['cache']) || $user->id() || $method['cache'] == variable_get('cache', 0);
     $callback = isset($method['callbacks']['negotiation']) ? $method['callbacks']['negotiation'] : FALSE;
     $langcode = $cache && function_exists($callback) ? $callback($languages, $request) : FALSE;
     $results[$method_id] = isset($languages[$langcode]) ? $languages[$langcode] : FALSE;
diff --git a/core/includes/session.inc b/core/includes/session.inc
index 40e495f..ea9325b 100644
--- a/core/includes/session.inc
+++ b/core/includes/session.inc
@@ -115,7 +115,7 @@ function _drupal_session_read($sid) {
   if ($values && $values['uid'] > 0 && $values['status'] == 1) {
     $user = new UserSession($values);
     // Add roles element to $user.
-    $rids = db_query("SELECT ur.rid FROM {users_roles} ur WHERE ur.uid = :uid", array(':uid' => $user->uid))->fetchCol();
+    $rids = db_query("SELECT ur.rid FROM {users_roles} ur WHERE ur.uid = :uid", array(':uid' => $user->id()))->fetchCol();
     $user->roles = array_merge(array(DRUPAL_AUTHENTICATED_RID), $rids);
   }
   elseif ($user) {
@@ -180,7 +180,7 @@ function _drupal_session_write($sid, $value) {
     if ($is_changed || !isset($user->timestamp) || REQUEST_TIME - $user->timestamp > settings()->get('session_write_interval', 180)) {
       // Either ssid or sid or both will be added from $key below.
       $fields = array(
-        'uid' => $user->uid,
+        'uid' => $user->id(),
         'hostname' => Drupal::request()->getClientIP(),
         'session' => $value,
         'timestamp' => REQUEST_TIME,
@@ -214,12 +214,12 @@ function _drupal_session_write($sid, $value) {
     }
 
     // Likewise, do not update access time more than once per 180 seconds.
-    if ($user->uid && REQUEST_TIME - $user->access > settings()->get('session_write_interval', 180)) {
+    if ($user->id() && REQUEST_TIME - $user->access > settings()->get('session_write_interval', 180)) {
       db_update('users')
         ->fields(array(
           'access' => REQUEST_TIME
         ))
-        ->condition('uid', $user->uid)
+        ->condition('uid', $user->id())
         ->execute();
     }
 
@@ -254,7 +254,8 @@ function drupal_session_initialize() {
     // anonymous users not use a session cookie unless something is stored in
     // $_SESSION. This allows HTTP proxies to cache anonymous pageviews.
     drupal_session_start();
-    if (!empty($user->uid) || !empty($_SESSION)) {
+    $uid = $user->id();
+    if (!empty($uid) || !empty($_SESSION)) {
       drupal_page_is_cacheable(FALSE);
     }
   }
@@ -311,8 +312,8 @@ function drupal_session_commit() {
     // We don't have anything to do if we are not allowed to save the session.
     return;
   }
-
-  if (empty($user->uid) && empty($_SESSION)) {
+  $uid = $user->id();
+  if (empty($uid) && empty($_SESSION)) {
     // There is no session data to store, destroy the session if it was
     // previously started.
     if (drupal_session_started()) {
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index ae8ec15..671708d 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2276,7 +2276,7 @@ function theme_tablesort_indicator($variables) {
 function theme_mark($variables) {
   $type = $variables['mark_type'];
   global $user;
-  if ($user->uid) {
+  if ($user->id()) {
     if ($type == MARK_NEW) {
       return ' <span class="marker">' . t('new') . '</span>';
     }
diff --git a/core/lib/Drupal/Core/Entity/Field/Type/Field.php b/core/lib/Drupal/Core/Entity/Field/Type/Field.php
index af45ada..dbf69d1 100644
--- a/core/lib/Drupal/Core/Entity/Field/Type/Field.php
+++ b/core/lib/Drupal/Core/Entity/Field/Type/Field.php
@@ -147,8 +147,8 @@ public function __unset($property_name) {
    */
   public function access($operation = 'view', AccountInterface $account = NULL) {
     global $user;
-    if (!isset($account) && $user->uid) {
-      $account = user_load($user->uid);
+    if (!isset($account) && $user->id()) {
+      $account = user_load($user->id());
     }
     // Get the default access restriction that lives within this field.
     $access = $this->defaultAccess($operation, $account);
diff --git a/core/lib/Drupal/Core/Session/AccountInterface.php b/core/lib/Drupal/Core/Session/AccountInterface.php
index 1dbc13c..846d6a6 100644
--- a/core/lib/Drupal/Core/Session/AccountInterface.php
+++ b/core/lib/Drupal/Core/Session/AccountInterface.php
@@ -55,4 +55,36 @@ public function getSecureSessionId();
    */
   public function getSessionData();
 
+  /**
+   * Returns TRUE if the account is authenticated.
+   *
+   * @return bool
+   *   TRUE if the account is authenticated.
+   */
+  public function isAuthenticated();
+
+  /**
+   * Returns TRUE if the account is anonymous.
+   *
+   * @return bool
+   *   TRUE if the account is anonymous.
+   */
+  public function isAnonymous();
+
+  /**
+   * Returns the preferred language code of the account.
+   *
+   * @param $type
+   *   Optional string to define which preferred langcode should be used.
+   *   Default to 'preferred_langcode' property.
+   *   If set 'preferred_$type_langcode' is used.
+   * @param $default
+   *   Optional default language code to return if the account
+   *   has no valid language.
+   *
+   * @return string
+   *   The language code that is preferred by the account.
+   */
+  public function getPreferredLangcode($type = NULL, $default = NULL);
+
 }
diff --git a/core/lib/Drupal/Core/Session/UserSession.php b/core/lib/Drupal/Core/Session/UserSession.php
index 300cd8f..aacdd8b 100644
--- a/core/lib/Drupal/Core/Session/UserSession.php
+++ b/core/lib/Drupal/Core/Session/UserSession.php
@@ -66,6 +66,20 @@ class UserSession implements AccountInterface {
   public $timestamp;
 
   /**
+   * The preferred language code of the account.
+   *
+   * @var string
+   */
+  protected $preferred_langcode;
+
+  /**
+   * The preferred language code of the account.
+   *
+   * @var string
+   */
+  protected $preferred_admin_langcode;
+
+  /**
    * Constructs a new user session.
    *
    * @param array $values
@@ -112,4 +126,37 @@ public function getSessionId() {
     return $this->sid;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function isAuthenticated() {
+    return $this->uid > 0;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isAnonymous() {
+    return $this->uid == 0;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  function getPreferredLangcode($type = NULL, $default = NULL) {
+    $language_list = language_list();
+    if (isset($type)) {
+      $preferred_langcode = $this->{'preferred_' . $type . '_langcode'};
+    }
+    else {
+      $preferred_langcode = $this->preferred_langcode;
+    }
+    if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) {
+      return $language_list[$preferred_langcode]->langcode;
+    }
+    else {
+      return $default ? $default : language_default()->langcode;
+    }
+  }
+
 }
diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index 4bcb3fa..1f0b201 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -309,7 +309,7 @@ function _block_get_renderable_region($list = array()) {
   // the regular 'roles define permissions' schema, it brings too many
   // chances of having unwanted output get in the cache and later be served
   // to other users. We therefore exclude user 1 from block caching.
-  $not_cacheable = $GLOBALS['user']->uid == 1 ||
+  $not_cacheable = $GLOBALS['user']->id() == 1 ||
     count(module_implements('node_grants')) ||
     !\Drupal::request()->isMethodSafe();
 
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
index 75bcb39..6ef7d25 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
@@ -49,7 +49,7 @@ function testBlockVisibility() {
     $this->drupalGet('user');
     $this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
 
-    $this->drupalGet('USER/' . $this->adminUser->uid);
+    $this->drupalGet('USER/' . $this->adminUser->id());
     $this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.');
 
     // Confirm that the block is not displayed to anonymous users.
diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index e309ec7..330ada9 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -1286,7 +1286,7 @@ function comment_node_search_result(EntityInterface $node) {
 function comment_user_cancel($edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_block_unpublish':
-      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->uid));
+      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->id()));
       foreach ($comments as $comment) {
         $comment->status->value = 0;
         $comment->save();
@@ -1294,7 +1294,7 @@ function comment_user_cancel($edit, $account, $method) {
       break;
 
     case 'user_cancel_reassign':
-      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->uid));
+      $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->id()));
       foreach ($comments as $comment) {
         $comment->uid->target_id = 0;
         $comment->save();
@@ -1307,7 +1307,7 @@ function comment_user_cancel($edit, $account, $method) {
  * Implements hook_user_predelete().
  */
 function comment_user_predelete($account) {
-  $cids = db_query('SELECT c.cid FROM {comment} c WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
+  $cids = db_query('SELECT c.cid FROM {comment} c WHERE uid = :uid', array(':uid' => $account->id()))->fetchCol();
   entity_delete_multiple('comment', $cids);
 }
 
@@ -1359,7 +1359,7 @@ function comment_load($cid, $reset = FALSE) {
 function comment_num_new($nid, $timestamp = 0) {
   global $user;
 
-  if ($user->uid && module_exists('history')) {
+  if ($user->id() && module_exists('history')) {
     // Retrieve the timestamp at which the current user last viewed this node.
     if (!$timestamp) {
       $timestamp = history_read($nid);
@@ -1457,12 +1457,12 @@ function comment_preview(Comment $comment) {
     if (!empty($comment->name->value)) {
       $account = user_load_by_name($comment->name->value);
     }
-    elseif ($user->uid && empty($comment->is_anonymous)) {
+    elseif ($user->id() && empty($comment->is_anonymous)) {
       $account = $user;
     }
-
-    if (!empty($account->uid)) {
-      $comment->uid->target_id = $account->uid;
+    $uid = $account->id();
+    if (!empty($uid)) {
+      $comment->uid->target_id = $account->id();
       $comment->name->value = check_plain($account->name);
     }
     elseif (empty($comment->name->value)) {
@@ -1666,7 +1666,7 @@ function theme_comment_post_forbidden($variables) {
   // comments only has to query the database once for all the links.
   $authenticated_post_comments = &drupal_static(__FUNCTION__, NULL);
 
-  if (!$user->uid) {
+  if (!$user->id()) {
     if (!isset($authenticated_post_comments)) {
       // We only output a link if we are certain that users will get permission
       // to post comments by logging in.
diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php
index e2040d5..1029a50 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php
@@ -31,7 +31,7 @@ public function form(array $form, array &$form_state) {
     $anonymous_contact = variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT);
     $is_admin = $comment->id() && user_access('administer comments');
 
-    if (!$user->uid && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
+    if (!$user->id() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
       $form['#attached']['library'][] = array('system', 'jquery.cookie');
       $form['#attributes']['class'][] = 'user-info-from-cookie';
     }
@@ -65,7 +65,7 @@ public function form(array $form, array &$form_state) {
       $date = (!empty($comment->date) ? $comment->date : new DrupalDateTime($comment->created->value));
     }
     else {
-      if ($user->uid) {
+      if ($user->id()) {
         $author = $user->name;
       }
       else {
@@ -80,7 +80,7 @@ public function form(array $form, array &$form_state) {
       '#type' => 'textfield',
       '#title' => t('Your name'),
       '#default_value' => $author,
-      '#required' => (!$user->uid && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
+      '#required' => (!$user->id() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
       '#maxlength' => 60,
       '#size' => 30,
     );
@@ -89,7 +89,7 @@ public function form(array $form, array &$form_state) {
       $form['author']['name']['#description'] = t('Leave blank for %anonymous.', array('%anonymous' => config('user.settings')->get('anonymous')));
       $form['author']['name']['#autocomplete_path'] = 'user/autocomplete';
     }
-    elseif ($user->uid) {
+    elseif ($user->id()) {
       $form['author']['name']['#type'] = 'item';
       $form['author']['name']['#value'] = $form['author']['name']['#default_value'];
       $form['author']['name']['#markup'] = theme('username', array('account' => $user));
@@ -100,11 +100,11 @@ public function form(array $form, array &$form_state) {
       '#type' => 'email',
       '#title' => t('E-mail'),
       '#default_value' => $comment->mail->value,
-      '#required' => (!$user->uid && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
+      '#required' => (!$user->id() && $anonymous_contact == COMMENT_ANONYMOUS_MUST_CONTACT),
       '#maxlength' => 64,
       '#size' => 30,
       '#description' => t('The content of this field is kept private and will not be shown publicly.'),
-      '#access' => $is_admin || (!$user->uid && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
+      '#access' => $is_admin || (!$user->id() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
     );
 
     $form['author']['homepage'] = array(
@@ -113,7 +113,7 @@ public function form(array $form, array &$form_state) {
       '#default_value' => $comment->homepage->value,
       '#maxlength' => 255,
       '#size' => 30,
-      '#access' => $is_admin || (!$user->uid && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
+      '#access' => $is_admin || (!$user->id() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT),
     );
 
     // Add administrative comment publishing options.
@@ -147,7 +147,7 @@ public function form(array $form, array &$form_state) {
     // Used for conditional validation of author fields.
     $form['is_anonymous'] = array(
       '#type' => 'value',
-      '#value' => ($comment->id() ? !$comment->uid->target_id : !$user->uid),
+      '#value' => ($comment->id() ? !$comment->uid->target_id : !$user->id()),
     );
 
     // Make the comment inherit the current content language unless specifically
@@ -210,7 +210,7 @@ public function validate(array $form, array &$form_state) {
     if (!empty($form_state['values']['cid'])) {
       // Verify the name in case it is being changed from being anonymous.
       $account = user_load_by_name($form_state['values']['name']);
-      $form_state['values']['uid'] = $account ? $account->uid : 0;
+      $form_state['values']['uid'] = $account ? $account->id() : 0;
 
       $date = $form_state['values']['date'];
       if ($date instanceOf DrupalDateTime && $date->hasErrors()) {
@@ -264,7 +264,7 @@ public function submit(array $form, array &$form_state) {
     // @todo Too fragile. Should be prepared and stored in comment_form()
     // already.
     if (!$comment->is_anonymous && !empty($comment->name->value) && ($account = user_load_by_name($comment->name->value))) {
-      $comment->uid->target_id = $account->uid;
+      $comment->uid->target_id = $account->id();
     }
     // If the comment was posted by an anonymous user and no author name was
     // required, use "Anonymous" by default.
diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
index 3231d4b..5a770d0 100644
--- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
+++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php
@@ -148,7 +148,7 @@ protected function preSave(EntityInterface $comment) {
       }
       // We test the value with '===' because we need to modify anonymous
       // users as well.
-      if ($comment->uid->target_id === $user->uid && $user->uid) {
+      if ($comment->uid->target_id === $user->uid && $user->id()) {
         $comment->name->value = $user->name;
       }
       // Add the values which aren't passed into the function.
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
index e8e7d67..a4ce754 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php
@@ -93,7 +93,7 @@ public function query() {
 
   function pre_render(&$values) {
     global $user;
-    if (!$user->uid || empty($values)) {
+    if (!$user->id() || empty($values)) {
       return;
     }
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
index 8b07aec..2b506ce 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
@@ -38,8 +38,8 @@ function setUp() {
   function testCommentClasses() {
     // Create all permutations for comments, users, and nodes.
     $parameters = array(
-      'node_uid' => array(0, $this->web_user->uid),
-      'comment_uid' => array(0, $this->web_user->uid, $this->admin_user->uid),
+      'node_uid' => array(0, $this->web_user->id()),
+      'comment_uid' => array(0, $this->web_user->id(), $this->admin_user->id()),
       'comment_status' => array(COMMENT_PUBLISHED, COMMENT_NOT_PUBLISHED),
       'user' => array('anonymous', 'authenticated', 'admin'),
     );
@@ -72,12 +72,12 @@ function testCommentClasses() {
 
         case 'authenticated':
           $this->drupalLogin($this->web_user);
-          $case['user_uid'] = $this->web_user->uid;
+          $case['user_uid'] = $this->web_user->id();
           break;
 
         case 'admin':
           $this->drupalLogin($this->admin_user);
-          $case['user_uid'] = $this->admin_user->uid;
+          $case['user_uid'] = $this->admin_user->id();
           break;
       }
       // Request the node with the comment.
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
index 8d7a472..ed1a528 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentInterfaceTest.php
@@ -81,7 +81,7 @@ function testCommentInterface() {
     // Test changing the comment author to a verified user.
     $this->drupalGet('comment/' . $comment->id() . '/edit');
     $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->subject->value, array('name' => $this->web_user->name));
-    $this->assertTrue($comment->name->value == $this->web_user->name && $comment->uid->target_id == $this->web_user->uid, 'Comment author successfully changed to a registered user.');
+    $this->assertTrue($comment->name->value == $this->web_user->name && $comment->uid->target_id == $this->web_user->id(), 'Comment author successfully changed to a registered user.');
 
     $this->drupalLogout();
 
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
index 0fdbb61..84611a3 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php
@@ -68,7 +68,7 @@ function setUp() {
     // Change user language preference, this way interface language is always
     // French no matter what path prefix the URLs have.
     $edit = array('preferred_langcode' => 'fr');
-    $this->drupalPost("user/{$admin_user->uid}/edit", $edit, t('Save'));
+    $this->drupalPost("user/{$admin_user->id()}/edit", $edit, t('Save'));
 
     // Make comment body translatable.
     $field = field_info_field('comment_body');
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
index e121432..6d84a76 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNewIndicatorTest.php
@@ -51,7 +51,7 @@ public function testCommentNewCommentsIndicator() {
       'nid' => $this->node->nid,
       'node_type' => $this->node->type,
       'pid' => 0,
-      'uid' => $this->loggedInUser->uid,
+      'uid' => $this->loggedInUser->id(),
       'status' => COMMENT_PUBLISHED,
       'subject' => $this->randomName(),
       'hostname' => '127.0.0.1',
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
index bf1cf6b..0b7cd20 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php
@@ -52,7 +52,7 @@ function testCommentPreview() {
     $edit['signature[value]'] = '<a href="http://example.com/">' . $test_signature. '</a>';
     $image = current($this->drupalGetTestFiles('image'));
     $edit['files[user_picture_und_0]'] = drupal_realpath($image->uri);
-    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
 
     // As the web user, fill in the comment form and preview the comment.
     $edit = array();
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
index 4578ade..06ebf86 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentStatisticsTest.php
@@ -51,7 +51,7 @@ function testCommentNodeCommentStatistics() {
     $node = node_load($this->node->nid);
     $this->assertEqual($node->last_comment_timestamp, $this->node->created, 'The initial value of node last_comment_timestamp is the node created date.');
     $this->assertEqual($node->last_comment_name, NULL, 'The initial value of node last_comment_name is NULL.');
-    $this->assertEqual($node->last_comment_uid, $this->web_user->uid, 'The initial value of node last_comment_uid is the node uid.');
+    $this->assertEqual($node->last_comment_uid, $this->web_user->id(), 'The initial value of node last_comment_uid is the node uid.');
     $this->assertEqual($node->comment_count, 0, 'The initial value of node comment_count is zero.');
 
     // Post comment #1 as web_user2.
@@ -63,7 +63,7 @@ function testCommentNodeCommentStatistics() {
     // The node needs to be reloaded with a node_load_multiple cache reset.
     $node = node_load($this->node->nid, TRUE);
     $this->assertEqual($node->last_comment_name, NULL, 'The value of node last_comment_name is NULL.');
-    $this->assertEqual($node->last_comment_uid, $this->web_user2->uid, 'The value of node last_comment_uid is the comment #1 uid.');
+    $this->assertEqual($node->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is the comment #1 uid.');
     $this->assertEqual($node->comment_count, 1, 'The value of node comment_count is 1.');
 
     // Prepare for anonymous comment submission (comment approval enabled).
@@ -86,7 +86,7 @@ function testCommentNodeCommentStatistics() {
     // The node needs to be reloaded with a node_load_multiple cache reset.
     $node = node_load($this->node->nid, TRUE);
     $this->assertEqual($node->last_comment_name, NULL, 'The value of node last_comment_name is still NULL.');
-    $this->assertEqual($node->last_comment_uid, $this->web_user2->uid, 'The value of node last_comment_uid is still the comment #1 uid.');
+    $this->assertEqual($node->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is still the comment #1 uid.');
     $this->assertEqual($node->comment_count, 1, 'The value of node comment_count is still 1.');
 
     // Prepare for anonymous comment submission (no approval required).
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
index 22132c1..0332dd7 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php
@@ -75,7 +75,7 @@ function setUp() {
     ));
 
     // Create a test node authored by the web user.
-    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid));
+    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
   }
 
   /**
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
index 3636f91..98860fc 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentThreadingTest.php
@@ -36,7 +36,7 @@ function testCommentThreading() {
 
     // Create a node.
     $this->drupalLogin($this->web_user);
-    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid));
+    $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
 
     // Post comment #1.
     $this->drupalLogin($this->web_user);
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php
index 8234cb5..40a6f76 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/ArgumentUserUIDTest.php
@@ -29,7 +29,7 @@ public static function getInfo() {
 
   function testCommentUserUIDTest() {
     $view = views_get_view('test_comment_user_uid');
-    $this->executeView($view, array($this->account->uid));
+    $this->executeView($view, array($this->account->id()));
     $result_set = array(
       array(
         'nid' => $this->node_user_posted->nid,
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
index c913883..3e43278 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
@@ -41,10 +41,10 @@ function setUp() {
     $this->drupalLogin($this->account);
 
     $this->node_user_posted = $this->drupalCreateNode();
-    $this->node_user_commented = $this->drupalCreateNode(array('uid' => $this->account2->uid));
+    $this->node_user_commented = $this->drupalCreateNode(array('uid' => $this->account2->id()));
 
     $comment = array(
-      'uid' => $this->loggedInUser->uid,
+      'uid' => $this->loggedInUser->id(),
       'nid' => $this->node_user_commented->nid,
       'cid' => '',
       'pid' => '',
diff --git a/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php b/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php
index 9c8c880..e775687 100644
--- a/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php
+++ b/core/modules/comment/lib/Drupal/comment/Tests/Views/FilterUserUIDTest.php
@@ -38,10 +38,10 @@ function testCommentUserUIDTest() {
       'id' => 'uid_touch',
       'table' => 'node_field_data',
       'field' => 'uid_touch',
-      'value' => array($this->loggedInUser->uid),
+      'value' => array($this->loggedInUser->id()),
     );
     $view->addItem('default', 'filter', 'node_field_data', 'uid_touch', $options);
-    $this->executeView($view, array($this->account->uid));
+    $this->executeView($view, array($this->account->id()));
     $result_set = array(
       array(
         'nid' => $this->node_user_posted->nid,
diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module
index 78b75f1..0a254d7 100644
--- a/core/modules/contact/contact.module
+++ b/core/modules/contact/contact.module
@@ -126,12 +126,12 @@ function _contact_personal_tab_access($account) {
   global $user;
 
   // Anonymous users cannot have contact forms.
-  if (!$account->uid) {
+  if (!$account->id()) {
     return FALSE;
   }
 
   // Users may not contact themselves.
-  if ($user->uid == $account->uid) {
+  if ($user->uid == $account->id()) {
     return FALSE;
   }
 
@@ -268,7 +268,8 @@ function contact_mail($key, &$message, $params) {
     '!form-url' => url(current_path(), array('absolute' => TRUE, 'language' => $language)),
     '!sender-name' => user_format_name($sender),
   );
-  if (!empty($sender->uid)) {
+  $uid = $sender->id();
+  if (!empty($uid)) {
     $sender_uri = $sender->uri();
     $variables['!sender-url'] = url($sender_uri['path'], array('absolute' => TRUE, 'language' => $language) + $sender_uri['options']);
   }
@@ -296,7 +297,7 @@ function contact_mail($key, &$message, $params) {
     case 'user_copy':
       $variables += array(
         '!recipient-name' => user_format_name($params['recipient']),
-        '!recipient-edit-url' => url('user/' . $params['recipient']->uid . '/edit', array('absolute' => TRUE, 'language' => $language)),
+        '!recipient-edit-url' => url('user/' . $params['recipient']->id() . '/edit', array('absolute' => TRUE, 'language' => $language)),
       );
       $message['subject'] .= t('[!site-name] !subject', $variables, $options);
       $message['body'][] = t('Hello !recipient-name,', $variables, $options);
diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
index 723b8ca..f0b82f9 100644
--- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php
+++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php
@@ -44,7 +44,7 @@ public function form(array $form, array &$form_state) {
       '#title' => t('Your e-mail address'),
       '#required' => TRUE,
     );
-    if (!$user->uid) {
+    if (!$user->id()) {
       $form['#attached']['library'][] = array('system', 'jquery.cookie');
       $form['#attributes']['class'][] = 'user-info-from-cookie';
     }
@@ -93,13 +93,13 @@ public function form(array $form, array &$form_state) {
       '#required' => TRUE,
       '#rows' => 12,
     );
-
+    $uid = $user->id();
     $form['copy'] = array(
       '#type' => 'checkbox',
       '#title' => t('Send yourself a copy.'),
       // Do not allow anonymous users to send themselves a copy, because it can
       // be abused to spam people.
-      '#access' => !empty($user->uid),
+      '#access' => !empty($uid),
     );
     return $form;
   }
@@ -142,8 +142,8 @@ public function save(array $form, array &$form_state) {
     $language_interface = language(Language::TYPE_INTERFACE);
     $message = $this->entity;
 
-    $sender = clone user_load($user->uid);
-    if (!$user->uid) {
+    $sender = clone user_load($user->id());
+    if (!$user->id()) {
       // At this point, $sender contains drupal_anonymous_user(), so we need to
       // take over the submitted form values.
       $sender->name = $message->name;
diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
index 026b169..f2613d3 100644
--- a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
+++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php
@@ -84,22 +84,22 @@ function testSendPersonalContactMessage() {
   function testPersonalContactAccess() {
     // Test allowed access to admin user's contact form.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
     $this->assertResponse(200);
 
     // Test denied access to admin user's own contact form.
     $this->drupalLogout();
     $this->drupalLogin($this->admin_user);
-    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
     $this->assertResponse(403);
 
     // Test allowed access to user with contact form enabled.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
     $this->assertResponse(200);
 
     // Test denied access to the user's own contact form.
-    $this->drupalGet('user/' . $this->web_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->web_user->id() . '/contact');
     $this->assertResponse(403);
 
     // Test always denied access to the anonymous user contact form.
@@ -109,18 +109,18 @@ function testPersonalContactAccess() {
     // Test that anonymous users can access the contact form.
     $this->drupalLogout();
     user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms'));
-    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
     $this->assertResponse(200);
 
     // Test that anonymous users can access admin user's contact form.
-    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
     $this->assertResponse(200);
 
     // Revoke the personal contact permission for the anonymous user.
     user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms'));
-    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
     $this->assertResponse(403);
-    $this->drupalGet('user/' . $this->admin_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->admin_user->id() . '/contact');
     $this->assertResponse(403);
 
     // Disable the personal contact form.
@@ -136,12 +136,12 @@ function testPersonalContactAccess() {
 
     // Test denied access to a user with contact form disabled.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
     $this->assertResponse(403);
 
     // Test allowed access for admin user to a user with contact form disabled.
     $this->drupalLogin($this->admin_user);
-    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
     $this->assertResponse(200);
 
     // Re-create our contacted user as a blocked user.
@@ -150,12 +150,12 @@ function testPersonalContactAccess() {
     $this->contact_user->save();
 
     // Test that blocked users can still be contacted by admin.
-    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
     $this->assertResponse(200);
 
     // Test that blocked users cannot be contacted by non-admins.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id() . '/contact');
     $this->assertResponse(403);
   }
 
@@ -180,7 +180,7 @@ function testPersonalContactFlood() {
     }
 
     // Submit contact form one over limit.
-    $this->drupalGet('user/' . $this->contact_user->uid. '/contact');
+    $this->drupalGet('user/' . $this->contact_user->id(). '/contact');
     $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => format_interval(config('contact.settings')->get('flood.interval')))), 'Normal user denied access to flooded contact form.');
 
     // Test that the admin user can still access the contact form even though
@@ -203,7 +203,7 @@ protected function submitPersonalContact($account, array $message = array()) {
       'subject' => $this->randomName(16),
       'message' => $this->randomName(64),
     );
-    $this->drupalPost('user/' . $account->uid . '/contact', $message, t('Send message'));
+    $this->drupalPost('user/' . $account->id() . '/contact', $message, t('Send message'));
     return $message;
   }
 }
diff --git a/core/modules/dblog/dblog.admin.inc b/core/modules/dblog/dblog.admin.inc
index cf744b0..d88cf40 100644
--- a/core/modules/dblog/dblog.admin.inc
+++ b/core/modules/dblog/dblog.admin.inc
@@ -108,7 +108,7 @@ function dblog_event($id) {
       ),
       array(
         array('data' => t('User'), 'header' => TRUE),
-        theme('username', array('account' => $dblog)),
+        theme('username', array('account' => user_load($dblog->uid))),
       ),
       array(
         array('data' => t('Location'), 'header' => TRUE),
diff --git a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
index b597c89..386bb9b 100644
--- a/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
+++ b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.php
@@ -124,7 +124,6 @@ public function overview() {
     $query = $this->database->select('watchdog', 'w')
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->extend('Drupal\Core\Database\Query\TableSortExtender');
-    $query->leftJoin('users', 'u', 'w.uid = u.uid');
     $query->fields('w', array(
       'wid',
       'uid',
@@ -134,8 +133,7 @@ public function overview() {
       'message',
       'variables',
       'link',
-      ));
-    $query->addField('u', 'name');
+    ));
 
     if (!empty($filter['where'])) {
       $query->where($filter['where'], $filter['args']);
@@ -169,7 +167,7 @@ public function overview() {
           t($dblog->type),
           format_date($dblog->timestamp, 'short'),
           $message,
-          theme('username', array('account' => $dblog)),
+          theme('username', array('account' => user_load($dblog->uid))),
           filter_xss($dblog->link),
         ),
         // Attributes for table row.
diff --git a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
index e619fff..60b4075 100644
--- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
+++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
@@ -136,7 +136,7 @@ private function generateLogEntries($count, $type = 'custom', $severity = WATCHD
       'severity'    => $severity,
       'link'        => NULL,
       'user'        => $this->big_user,
-      'uid'         => isset($this->big_user->uid) ? $this->big_user->uid : 0,
+      'uid'         => $this->big_user->id() ? $this->big_user->id() : 0,
       'request_uri' => $base_root . request_uri(),
       'referer'     => $_SERVER['HTTP_REFERER'],
       'ip'          => '127.0.0.1',
@@ -238,7 +238,7 @@ private function doUser() {
     // Logout user.
     $this->drupalLogout();
     // Fetch the row IDs in watchdog that relate to the user.
-    $result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->uid));
+    $result = db_query('SELECT wid FROM {watchdog} WHERE uid = :uid', array(':uid' => $user->id()));
     foreach ($result as $row) {
       $ids[] = $row->wid;
     }
@@ -249,7 +249,7 @@ private function doUser() {
     $this->drupalLogin($this->big_user);
     // Delete the user created at the start of this test.
     // We need to POST here to invoke batch_process() in the internal browser.
-    $this->drupalPost('user/' . $user->uid . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account'));
+    $this->drupalPost('user/' . $user->id() . '/cancel', array('user_cancel_method' => 'user_cancel_reassign'), t('Cancel account'));
 
     // View the database log report.
     $this->drupalGet('admin/reports/dblog');
@@ -423,7 +423,7 @@ protected function testDBLogAddAndClear() {
       'severity'    => WATCHDOG_NOTICE,
       'link'        => NULL,
       'user'        => $this->big_user,
-      'uid'         => isset($this->big_user->uid) ? $this->big_user->uid : 0,
+      'uid'         => $this->big_user->id() ? $this->big_user->id() : 0,
       'request_uri' => $base_root . request_uri(),
       'referer'     => $_SERVER['HTTP_REFERER'],
       'ip'          => '127.0.0.1',
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php
index 11ab442..4b0a482 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php
@@ -80,7 +80,7 @@ public function formElement(array $items, $delta, array $element, $langcode, arr
       '#placeholder' => $this->getSetting('placeholder'),
       '#element_validate' => array(array($this, 'elementValidate')),
       // @todo: Use wrapper to get the user if exists or needed.
-      '#autocreate_uid' => isset($entity->uid) ? $entity->uid : $user->uid,
+      '#autocreate_uid' => isset($entity->uid) ? $entity->uid : $user->id(),
     );
 
     return array('target_id' => $element);
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 3832d80..4e15285 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -401,7 +401,7 @@ function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) {
   }
 
   // Save a query by only calling spaceUsed() when a limit is provided.
-  if ($user_limit && (Drupal::entityManager()->getStorageController('file')->spaceUsed($user->uid) + $file->getSize()) > $user_limit) {
+  if ($user_limit && (Drupal::entityManager()->getStorageController('file')->spaceUsed($user->id()) + $file->getSize()) > $user_limit) {
     $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->getSize()), '%quota' => format_size($user_limit)));
   }
 
@@ -526,7 +526,7 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
     // Create a file entity.
     $file = entity_create('file', array(
       'uri' => $uri,
-      'uid' => $user->uid,
+      'uid' => $user->id(),
       'status' => FILE_STATUS_PERMANENT,
     ));
     // If we are replacing an existing file re-use its database record.
@@ -636,7 +636,7 @@ function file_file_download($uri, $field_type = 'file') {
   // temporary files where the host entity has not yet been saved (for example,
   // an image preview on a node/add form) in which case, allow download by the
   // file's owner.
-  if (empty($references) && ($file->isPermanent() || $file->getOwner()->id() != $user->uid)) {
+  if (empty($references) && ($file->isPermanent() || $file->getOwner()->id() != $user->id())) {
     return;
   }
 
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
index 2d8cc3a..8ee7c78 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
@@ -99,7 +99,7 @@ function testRevisions() {
     $user->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['fid'] = $node_file_r3->id();
     $user->{$field_name}[Language::LANGCODE_NOT_SPECIFIED][0]['display'] = 1;
     $user->save();
-    $this->drupalGet('user/' . $user->uid . '/edit');
+    $this->drupalGet('user/' . $user->id() . '/edit');
 
     // Delete the third revision and check that the file is not deleted yet.
     $this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r3 . '/delete', array(), t('Delete'));
@@ -108,7 +108,7 @@ function testRevisions() {
     $this->assertFileIsPermanent($node_file_r3, t('Second file entry is still permanent after deleting third revision, since it is being used by the user.'));
 
     // Delete the user and check that the file is also deleted.
-    user_delete($user->uid);
+    user_delete($user->id());
     // TODO: This seems like a bug in File API. Clearing the stat cache should
     // not be necessary here. The file really is deleted, but stream wrappers
     // doesn't seem to think so unless we clear the PHP file stat() cache.
diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module
index bb9b748..fa6329d 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -290,16 +290,16 @@ function filter_formats($account = NULL) {
   }
 
   // Build a list of user-specific formats.
-  if (isset($account) && !isset($formats['user'][$account->uid])) {
-    $formats['user'][$account->uid] = array();
+  if (isset($account) && !isset($formats['user'][$account->id()])) {
+    $formats['user'][$account->id()] = array();
     foreach ($formats['all'] as $format) {
       if (filter_access($format, $account)) {
-        $formats['user'][$account->uid][$format->format] = $format;
+        $formats['user'][$account->id()][$format->format] = $format;
       }
     }
   }
 
-  return isset($account) ? $formats['user'][$account->uid] : $formats['all'];
+  return isset($account) ? $formats['user'][$account->id()] : $formats['all'];
 }
 
 /**
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index c32816c..38e94c7 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -187,7 +187,7 @@ function forum_menu_local_tasks(&$data, $router_item, $root_path) {
       }
       if (empty($links)) {
         // Authenticated user does not have access to create new topics.
-        if ($user->uid) {
+        if ($user->id()) {
           $links['disallowed'] = array(
             '#theme' => 'menu_local_action',
             '#link' => array(
@@ -946,7 +946,7 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
   $topics = array();
   $first_new_found = FALSE;
   foreach ($result as $topic) {
-    if ($user->uid) {
+    if ($user->id()) {
       // A forum is new if the topic is new, or if there are new comments since
       // the user's last visit.
       if ($topic->forum_tid != $tid) {
@@ -1094,8 +1094,8 @@ function template_preprocess_forum_list(&$variables) {
     $variables['forums'][$id]->old_topics = $forum->num_topics;
     $variables['forums'][$id]->icon_class = 'default';
     $variables['forums'][$id]->icon_title = t('No new posts');
-    if ($user->uid) {
-      $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->id(), $user->uid);
+    if ($user->id()) {
+      $variables['forums'][$id]->new_topics = _forum_topics_unread($forum->id(), $user->id());
       if ($variables['forums'][$id]->new_topics) {
         $variables['forums'][$id]->new_text = format_plural($variables['forums'][$id]->new_topics, '1 new post<span class="element-invisible"> in forum %title</span>', '@count new posts<span class="element-invisible"> in forum %title</span>', array('%title' => $variables['forums'][$id]->label()));
         $variables['forums'][$id]->new_url = url('forum/' . $forum->id(), array('fragment' => 'new'));
@@ -1245,7 +1245,7 @@ function template_preprocess_forum_icon(&$variables) {
  *   - topic: The topic object.
  */
 function template_preprocess_forum_submitted(&$variables) {
-  $variables['author'] = isset($variables['topic']->uid) ? theme('username', array('account' => $variables['topic'])) : '';
+  $variables['author'] = isset($variables['topic']->uid) ? theme('username', array('account' => user_load($variables['topic']->uid))) : '';
   $variables['time'] = isset($variables['topic']->created) ? format_interval(REQUEST_TIME - $variables['topic']->created) : '';
 }
 
@@ -1264,7 +1264,7 @@ function _forum_user_last_visit($nid) {
   $history = &drupal_static(__FUNCTION__, array());
 
   if (empty($history)) {
-    $result = db_query('SELECT nid, timestamp FROM {history} WHERE uid = :uid', array(':uid' => $user->uid));
+    $result = db_query('SELECT nid, timestamp FROM {history} WHERE uid = :uid', array(':uid' => $user->id()));
     foreach ($result as $t) {
       $history[$t->nid] = $t->timestamp > HISTORY_READ_LIMIT ? $t->timestamp : HISTORY_READ_LIMIT;
     }
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
index f8c0479..b8bfb17 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
@@ -190,7 +190,7 @@ function testForum() {
     $this->assertEqual($topics, '6', 'Number of topics found.');
 
     // Verify the number of unread topics.
-    $unread_topics = _forum_topics_unread($this->forum['tid'], $this->edit_any_topics_user->uid);
+    $unread_topics = _forum_topics_unread($this->forum['tid'], $this->edit_any_topics_user->id());
     $unread_topics = format_plural($unread_topics, '1 new post', '@count new posts');
     $xpath = $this->buildXPathQuery('//tr[@id=:forum]//td[@class="topics"]//a', $forum_arg);
     $this->assertFieldByXPath($xpath, $unread_topics, 'Number of unread topics found.');
diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index 84abade..9da25df 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -34,7 +34,7 @@ function history_read($nid) {
   $history = &drupal_static(__FUNCTION__, array());
 
   if (!isset($history[$nid])) {
-    $history[$nid] = db_query("SELECT timestamp FROM {history} WHERE uid = :uid AND nid = :nid", array(':uid' => $user->uid, ':nid' => $nid))->fetchObject();
+    $history[$nid] = db_query("SELECT timestamp FROM {history} WHERE uid = :uid AND nid = :nid", array(':uid' => $user->id(), ':nid' => $nid))->fetchObject();
   }
 
   return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0);
@@ -56,10 +56,10 @@ function history_write($nid, $account = NULL) {
     $account = $user;
   }
 
-  if ($account->uid) {
+  if ($account->id()) {
     db_merge('history')
       ->key(array(
-        'uid' => $account->uid,
+        'uid' => $account->id(),
         'nid' => $nid,
       ))
       ->fields(array('timestamp' => REQUEST_TIME))
@@ -92,7 +92,7 @@ function history_user_cancel($edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_reassign':
       db_delete('history')
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute();
       break;
   }
@@ -103,6 +103,6 @@ function history_user_cancel($edit, $account, $method) {
  */
 function history_user_delete($account) {
   db_delete('history')
-    ->condition('uid', $account->uid)
+    ->condition('uid', $account->id())
     ->execute();
 }
diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
index fbd6b0b..41cd2ff 100644
--- a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
+++ b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
@@ -31,7 +31,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     parent::init($view, $display, $options);
 
     global $user;
-    if ($user->uid) {
+    if ($user->id()) {
       $this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created');
       $this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed');
       if (module_exists('comment') && !empty($this->options['comments'])) {
@@ -63,7 +63,7 @@ public function buildOptionsForm(&$form, &$form_state) {
   public function query() {
     // Only add ourselves to the query if logged in.
     global $user;
-    if (!$user->uid) {
+    if (!$user->id()) {
       return;
     }
     parent::query();
@@ -75,7 +75,7 @@ function render($values) {
     // we already have that info.
     $mark = MARK_READ;
     global $user;
-    if ($user->uid) {
+    if ($user->id()) {
       $last_read = $this->getValue($values);
       $changed = $this->getValue($values, 'changed');
 
diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
index 8569329..ebb5ed5 100644
--- a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
+++ b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php
@@ -55,7 +55,7 @@ protected function valueForm(&$form, &$form_state) {
   public function query() {
     global $user;
     // This can only work if we're logged in.
-    if (!$user || !$user->uid) {
+    if (!$user || !$user->id()) {
       return;
     }
 
diff --git a/core/modules/language/language.module b/core/modules/language/language.module
index 6b45fa1..ac504ba 100644
--- a/core/modules/language/language.module
+++ b/core/modules/language/language.module
@@ -450,8 +450,9 @@ function language_get_default_langcode($entity_type, $bundle) {
 
     case 'authors_default':
       global $user;
-      if (!empty($user->preferred_langcode)) {
-        $default_value = $user->preferred_langcode;
+      $language_code = $user->getPreferredLangcode();
+      if (!empty($language_code)) {
+        $default_value = $language_code;
       }
       else {
         $default_value = $language_interface->langcode;
diff --git a/core/modules/language/language.negotiation.inc b/core/modules/language/language.negotiation.inc
index 82bf713..aabd36c 100644
--- a/core/modules/language/language.negotiation.inc
+++ b/core/modules/language/language.negotiation.inc
@@ -196,8 +196,12 @@ function language_from_user($languages) {
   // User preference (only for authenticated users).
   global $user;
 
-  if ($user->uid && !empty($user->preferred_langcode) && isset($languages[$user->preferred_langcode])) {
-    return $user->preferred_langcode;
+  if ($user->id()) {
+    $langcode = $user->getPreferredLangcode();
+    $default_langcode = language_default()->langcode;
+    if (!empty($langcode) && $langcode != $default_langcode && isset($languages[$langcode])) {
+      return $langcode;
+    }
   }
 
   // No language preference from the user.
@@ -221,9 +225,13 @@ function language_from_user_admin(array $languages, Request $request = NULL) {
   // User preference (only for authenticated users).
   global $user;
 
-  $request_path = $request ? urldecode(trim($request->getPathInfo(), '/')) : _current_path();
-  if ($user->uid && !empty($user->preferred_admin_langcode) && isset($languages[$user->preferred_admin_langcode]) && path_is_admin($request_path)) {
-    return $user->preferred_admin_langcode;
+  if ($user->id()) {
+    $request_path = $request ? urldecode(trim($request->getPathInfo(), '/')) : _current_path();
+    $langcode = $user->getPreferredLangcode('admin');
+    $default_langcode = language_default()->langcode;
+    if (!empty($langcode) && $langcode != $default_langcode && isset($languages[$langcode]) && path_is_admin($request_path)) {
+      return $langcode;
+    }
   }
 
   // No language preference from the user or not on an admin path.
@@ -246,7 +254,7 @@ function language_from_session($languages) {
   // an authenticated user.
   if (isset($_GET[$param]) && isset($languages[$langcode = $_GET[$param]])) {
     global $user;
-    if ($user->uid) {
+    if ($user->id()) {
       $_SESSION[$param] = $langcode;
     }
     return $langcode;
@@ -484,7 +492,7 @@ function language_url_rewrite_session(&$path, &$options) {
   // request processing.
   if (!isset($query_rewrite)) {
     global $user;
-    if (!$user->uid) {
+    if (!$user->id()) {
       $languages = language_list();
       $query_param = check_plain(config('language.negotiation')->get('session.parameter'));
       $query_value = isset($_GET[$query_param]) ? check_plain($_GET[$query_param]) : NULL;
diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php
index c9c05e8..b9b7c48 100644
--- a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php
+++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php
@@ -279,7 +279,7 @@ function testUILanguageNegotiation() {
       'expect' => $language_string,
       'expected_method_id' => LANGUAGE_NEGOTIATION_USER,
       'http_header' => array(),
-      'message' => 'USER > DEFAULT: defined prefereed user language setting, the UI language is based on user setting',
+      'message' => 'USER > DEFAULT: defined preferred user language setting, the UI language is based on user setting',
     );
     $this->runTest($test);
 
@@ -321,7 +321,7 @@ function testUILanguageNegotiation() {
       'expect' => $language_string,
       'expected_method_id' => LANGUAGE_NEGOTIATION_USER_ADMIN,
       'http_header' => array(),
-      'message' => 'USER ADMIN > DEFAULT: defined prefereed user admin language setting, the UI language is based on user setting',
+      'message' => 'USER ADMIN > DEFAULT: defined preferred user admin language setting, the UI language is based on user setting',
     );
     $this->runTest($test);
 
diff --git a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
index c47c683..c952aae 100644
--- a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
+++ b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php
@@ -95,7 +95,7 @@ protected function getConfirmText() {
    * {@inheritdoc}
    */
   public function buildForm(array $form, array &$form_state) {
-    $this->nodes = $this->tempStoreFactory->get('node_multiple_delete_confirm')->get($GLOBALS['user']->uid);
+    $this->nodes = $this->tempStoreFactory->get('node_multiple_delete_confirm')->get($GLOBALS['user']->id());
     if (empty($this->nodes)) {
       drupal_goto($this->getCancelPath());
     }
@@ -115,7 +115,7 @@ public function buildForm(array $form, array &$form_state) {
   public function submitForm(array &$form, array &$form_state) {
     if ($form_state['values']['confirm'] && !empty($this->nodes)) {
       $this->storageController->delete($this->nodes);
-      $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete($GLOBALS['user']->uid);
+      $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete($GLOBALS['user']->id());
       $count = count($this->nodes);
       watchdog('content', 'Deleted @count posts.', array('@count' => $count));
       drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.'));
diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php
index bdd5801..b03c045 100644
--- a/core/modules/node/lib/Drupal/node/NodeFormController.php
+++ b/core/modules/node/lib/Drupal/node/NodeFormController.php
@@ -38,7 +38,7 @@ protected function prepareEntity() {
         }
       }
       global $user;
-      $node->uid = $user->uid;
+      $node->uid = $user->id();
       $node->created = REQUEST_TIME;
     }
     else {
diff --git a/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php b/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
index f4a5eff..6376f57 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/Action/DeleteNode.php
@@ -61,7 +61,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc}
    */
   public function executeMultiple(array $entities) {
-    $this->tempStore->set($GLOBALS['user']->uid, $entities);
+    $this->tempStore->set($GLOBALS['user']->id(), $entities);
   }
 
   /**
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
index adee17d..5107337 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessBaseTableTest.php
@@ -92,7 +92,7 @@ function testNodeAccessBasic() {
           $private_nodes[] = $nid;
         }
         $titles[$nid] = $edit['title'];
-        $this->nodesByUser[$this->webUser->uid][$nid] = $is_private;
+        $this->nodesByUser[$this->webUser->id()][$nid] = $is_private;
       }
     }
     $this->publicTid = db_query('SELECT tid FROM {taxonomy_term_data} WHERE name = :name', array(':name' => 'public'))->fetchField();
@@ -106,7 +106,7 @@ function testNodeAccessBasic() {
         foreach ($data as $nid => $is_private) {
           $this->drupalGet('node/' . $nid);
           if ($is_private) {
-            $should_be_visible = $uid == $this->webUser->uid;
+            $should_be_visible = $uid == $this->webUser->id();
           }
           else {
             $should_be_visible = TRUE;
@@ -115,7 +115,7 @@ function testNodeAccessBasic() {
             '%private' => $is_private ? 'private' : 'public',
             '%uid' => $uid,
             '%visible' => $should_be_visible ? 'visible' : 'not visible',
-            '%current_uid' => $this->webUser->uid,
+            '%current_uid' => $this->webUser->id(),
           )));
         }
       }
@@ -165,13 +165,13 @@ protected function assertTaxonomyPage($is_admin) {
           // Non-administrators can only see their own nodes on the private
           // term page.
           if (!$is_admin && $tid_is_private) {
-            $should_be_visible = $should_be_visible && $uid == $this->webUser->uid;
+            $should_be_visible = $should_be_visible && $uid == $this->webUser->id();
           }
           $this->assertIdentical(isset($this->nids_visible[$nid]), $should_be_visible, strtr('A %private node by user %uid is %visible for user %current_uid on the %tid_is_private page.', array(
             '%private' => $is_private ? 'private' : 'public',
             '%uid' => $uid,
             '%visible' => isset($this->nids_visible[$nid]) ? 'visible' : 'not visible',
-            '%current_uid' => $this->webUser->uid,
+            '%current_uid' => $this->webUser->id(),
             '%tid_is_private' => $tid_is_private ? 'private' : 'public',
           )));
         }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php
index 73b3a44..c2de0de 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessTest.php
@@ -49,7 +49,7 @@ function testNodeAccess() {
 
     // User cannot 'view own unpublished content'.
     $web_user3 = $this->drupalCreateUser(array('access content'));
-    $node3 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user3->uid));
+    $node3 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user3->id()));
     $this->assertNodeAccess(array('view' => FALSE), $node3, $web_user3);
 
     // User cannot create content without permission.
@@ -58,7 +58,7 @@ function testNodeAccess() {
     // User can 'view own unpublished content', but another user cannot.
     $web_user4 = $this->drupalCreateUser(array('access content', 'view own unpublished content'));
     $web_user5 = $this->drupalCreateUser(array('access content', 'view own unpublished content'));
-    $node4 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user4->uid));
+    $node4 = $this->drupalCreateNode(array('status' => 0, 'uid' => $web_user4->id()));
     $this->assertNodeAccess(array('view' => TRUE, 'update' => FALSE), $node4, $web_user4);
     $this->assertNodeAccess(array('view' => FALSE), $node4, $web_user5);
 
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
index 6ad8a19..73d8a3b 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAdminTest.php
@@ -96,8 +96,8 @@ function testContentAdminPages() {
 
     $nodes['published_page'] = $this->drupalCreateNode(array('type' => 'page'));
     $nodes['published_article'] = $this->drupalCreateNode(array('type' => 'article'));
-    $nodes['unpublished_page_1'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_1->uid, 'status' => 0));
-    $nodes['unpublished_page_2'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_2->uid, 'status' => 0));
+    $nodes['unpublished_page_1'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_1->id(), 'status' => 0));
+    $nodes['unpublished_page_2'] = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->base_user_2->id(), 'status' => 0));
 
     // Verify view, edit, and delete links for any content.
     $this->drupalGet('admin/content');
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
index ee1e5ad..1ac8eb8 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeBlockFunctionalTest.php
@@ -68,7 +68,7 @@ public function testRecentNodeBlock() {
     $this->assertText(t('No content available.'), 'Block with "No content available." found.');
 
     // Add some test nodes.
-    $default_settings = array('uid' => $this->webUser->uid, 'type' => 'article');
+    $default_settings = array('uid' => $this->webUser->id(), 'type' => 'article');
     $node1 = $this->drupalCreateNode($default_settings);
     $node2 = $this->drupalCreateNode($default_settings);
     $node3 = $this->drupalCreateNode($default_settings);
@@ -136,7 +136,7 @@ public function testRecentNodeBlock() {
     $this->assertTrue(isset($visibility['node_type']['types']['article']), 'Visibility settings were saved to configuration');
 
     // Create a page node.
-    $node5 = $this->drupalCreateNode(array('uid' => $this->adminUser->uid, 'type' => 'page'));
+    $node5 = $this->drupalCreateNode(array('uid' => $this->adminUser->id(), 'type' => 'page'));
 
     // Verify visibility rules.
     $this->drupalGet('');
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
index f531520..9ed0679 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeCreationTest.php
@@ -64,7 +64,7 @@ function testNodeCreation() {
   function testFailedPageCreation() {
     // Create a node.
     $edit = array(
-      'uid'      => $this->loggedInUser->uid,
+      'uid'      => $this->loggedInUser->id(),
       'name'     => $this->loggedInUser->name,
       'type'     => 'page',
       'langcode' => Language::LANGCODE_NOT_SPECIFIED,
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
index f2b241a..d4d563b 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeQueryAlterTest.php
@@ -194,7 +194,7 @@ function testNodeQueryAlterOverride() {
     // $account instead of the global $user, we will log in as
     // noAccessUser2.
     $this->drupalLogin($this->noAccessUser2);
-    \Drupal::state()->set('node_access_test.no_access_uid', $this->noAccessUser->uid);
+    \Drupal::state()->set('node_access_test.no_access_uid', $this->noAccessUser->id());
     drupal_static_reset('node_access_view_all_nodes');
     try {
       $query = db_select('node', 'mytab')
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
index 6157fb0..0a1c210 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeSaveTest.php
@@ -52,7 +52,7 @@ function testImport() {
     $node = array(
       'title' => $title,
       'body' => array(array('value' => $this->randomName(32))),
-      'uid' => $this->web_user->uid,
+      'uid' => $this->web_user->id(),
       'type' => 'article',
       'nid' => $test_nid,
     );
@@ -60,7 +60,7 @@ function testImport() {
     $node->enforceIsNew();
 
     // Verify that node_submit did not overwrite the user ID.
-    $this->assertEqual($node->uid, $this->web_user->uid, 'Function node_submit() preserves user ID');
+    $this->assertEqual($node->uid, $this->web_user->id(), 'Function node_submit() preserves user ID');
 
     $node->save();
     // Test the import.
@@ -77,7 +77,7 @@ function testImport() {
   function testTimestamps() {
     // Use the default timestamps.
     $edit = array(
-      'uid' => $this->web_user->uid,
+      'uid' => $this->web_user->id(),
       'type' => 'article',
       'title' => $this->randomName(8),
     );
@@ -105,7 +105,7 @@ function testTimestamps() {
 
     // Programmatically set the timestamps on the node.
     $edit = array(
-      'uid' => $this->web_user->uid,
+      'uid' => $this->web_user->id(),
       'type' => 'article',
       'title' => $this->randomName(8),
       'created' => 280299600, // Sun, 19 Nov 1978 05:00:00 GMT
@@ -136,7 +136,7 @@ function testTimestamps() {
   function testDeterminingChanges() {
     // Initial creation.
     $node = entity_create('node', array(
-      'uid' => $this->web_user->uid,
+      'uid' => $this->web_user->id(),
       'type' => 'article',
       'title' => 'test_changes',
     ));
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
index 90b7493..ae474f8 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTokenReplaceTest.php
@@ -36,7 +36,7 @@ function testNodeTokenReplacement() {
     $account = $this->drupalCreateUser();
     $settings = array(
       'type' => 'article',
-      'uid' => $account->uid,
+      'uid' => $account->id(),
       'title' => '<blink>Blinking Text</blink>',
       'body' => array(array('value' => $this->randomName(32), 'summary' => $this->randomName(16))),
     );
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
index ac024bb..5cea173 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php
@@ -120,7 +120,7 @@ protected function assertAuthoringInfo() {
     foreach ($this->langcodes as $index => $langcode) {
       $user = $this->drupalCreateUser();
       $values[$langcode] = array(
-        'uid' => $user->uid,
+        'uid' => $user->id(),
         'created' => REQUEST_TIME - mt_rand(0, 1000),
       );
       $edit = array(
diff --git a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
index 8d963d4..c48747f 100644
--- a/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/PageEditTest.php
@@ -114,7 +114,7 @@ function testPageAuthoredBy() {
 
     // Check that the node was authored by the currently logged in user.
     $node = $this->drupalGetNodeByTitle($edit['title']);
-    $this->assertIdentical($node->uid, $this->admin_user->uid, 'Node authored by admin user.');
+    $this->assertIdentical($node->uid, $this->admin_user->id(), 'Node authored by admin user.');
 
     // Try to change the 'authored by' field to an invalid user name.
     $edit = array(
@@ -135,7 +135,7 @@ function testPageAuthoredBy() {
     $edit['name'] = $this->web_user->name;
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save and keep published'));
     $node = node_load($node->nid, TRUE);
-    $this->assertIdentical($node->uid, $this->web_user->uid, 'Node authored by normal user.');
+    $this->assertIdentical($node->uid, $this->web_user->id(), 'Node authored by normal user.');
 
     // Check that normal users cannot change the authored by information.
     $this->drupalLogin($this->web_user);
diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php b/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php
index 375bd32..67b4cba 100644
--- a/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/Views/FilterUidRevisionTest.php
@@ -55,7 +55,7 @@ public function testFilter() {
 
     $view = views_get_view('test_filter_node_uid_revision');
     $view->initHandlers();
-    $view->filter['uid_revision']->value = array($author->uid);
+    $view->filter['uid_revision']->value = array($author->id());
 
     $this->executeView($view);
     $this->assertIdenticalResultset($view, $expected_result, array('nid' => 'nid'), 'Make sure that the view only returns nodes which match either the node or the revision author.');
diff --git a/core/modules/node/node.admin.inc b/core/modules/node/node.admin.inc
index 821f41a..581f85b 100644
--- a/core/modules/node/node.admin.inc
+++ b/core/modules/node/node.admin.inc
@@ -229,7 +229,7 @@ function node_admin_nodes() {
     // If the user is able to view their own unpublished nodes, allow them
     // to see these in addition to published nodes. Check that they actually
     // have some unpublished nodes to view before adding the condition.
-    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->uid, ':status' => 0))->fetchCol()) {
+    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->id(), ':status' => 0))->fetchCol()) {
       $query->condition(db_or()
         ->condition('n.status', 1)
         ->condition('n.nid', $own_unpublished, 'IN')
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index 8bd1d9a..0c8f5e8 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -201,7 +201,7 @@ function hook_node_grants($account, $op) {
   if (user_access('access private content', $account)) {
     $grants['example'] = array(1);
   }
-  $grants['example_owner'] = array($account->uid);
+  $grants['example_owner'] = array($account->id());
   return $grants;
 }
 
@@ -596,13 +596,13 @@ function hook_node_access($node, $op, $account, $langcode) {
     }
 
     if ($op == 'update') {
-      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
+      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->id() == $node->uid))) {
         return NODE_ACCESS_ALLOW;
       }
     }
 
     if ($op == 'delete') {
-      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
+      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->id() == $node->uid))) {
         return NODE_ACCESS_ALLOW;
       }
     }
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 3245f24..2725e43 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -286,7 +286,7 @@ function node_mark($nid, $timestamp) {
   global $user;
   $cache = &drupal_static(__FUNCTION__, array());
 
-  if (!$user->uid || !module_exists('history')) {
+  if (!$user->id() || !module_exists('history')) {
     return MARK_READ;
   }
   if (!isset($cache[$nid])) {
@@ -965,7 +965,7 @@ function node_submit(EntityInterface $node) {
   // form, which we then need to translate to a user ID.
   if (isset($node->name)) {
     if ($account = user_load_by_name($node->name)) {
-      $node->uid = $account->uid;
+      $node->uid = $account->id();
     }
     else {
       $node->uid = 0;
@@ -974,7 +974,7 @@ function node_submit(EntityInterface $node) {
 
   // If a new revision is created, save the current user as revision author.
   if ($node->isNewRevision()) {
-    $node->revision_uid = $user->uid;
+    $node->revision_uid = $user->id();
     $node->revision_timestamp = REQUEST_TIME;
   }
 
@@ -1404,7 +1404,7 @@ function node_user_cancel($edit, $account, $method) {
       $nodes = db_select('node_field_data', 'n')
         ->distinct()
         ->fields('n', array('nid'))
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('status' => 0), NULL, TRUE);
@@ -1416,14 +1416,14 @@ function node_user_cancel($edit, $account, $method) {
       $nodes = db_select('node_field_data', 'n')
         ->distinct()
         ->fields('n', array('nid'))
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('uid' => 0), NULL, TRUE);
       // Anonymize old revisions.
       db_update('node_field_revision')
         ->fields(array('uid' => 0))
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute();
       break;
   }
@@ -1438,12 +1438,12 @@ function node_user_predelete($account) {
   $nodes = db_select('node_field_data', 'n')
     ->distinct()
     ->fields('n', array('nid'))
-    ->condition('uid', $account->uid)
+    ->condition('uid', $account->id())
     ->execute()
     ->fetchCol();
   entity_delete_multiple('node', $nodes);
   // Delete old revisions.
-  $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->uid))->fetchCol();
+  $revisions = db_query('SELECT DISTINCT vid FROM {node_field_revision} WHERE uid = :uid', array(':uid' => $account->id()))->fetchCol();
   foreach ($revisions as $revision) {
     node_revision_delete($revision);
   }
@@ -1535,7 +1535,7 @@ function _node_revision_access(EntityInterface $node, $op = 'view', $account = N
 
   // Statically cache access by revision ID, language code, user account ID,
   // and operation.
-  $cid = $node->vid . ':' . $langcode . ':' . $account->uid . ':' . $op;
+  $cid = $node->vid . ':' . $langcode . ':' . $account->id() . ':' . $op;
 
   if (!isset($access[$cid])) {
     // Perform basic permission checks first.
@@ -1838,7 +1838,7 @@ function node_get_recent($number = 10) {
     // If the user is able to view their own unpublished nodes, allow them
     // to see these in addition to published nodes. Check that they actually
     // have some unpublished nodes to view before adding the condition.
-    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->uid, ':status' => NODE_NOT_PUBLISHED))->fetchCol()) {
+    if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT DISTINCT nid FROM {node_field_data} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->id(), ':status' => NODE_NOT_PUBLISHED))->fetchCol()) {
       $query->condition(db_or()
         ->condition('n.status', NODE_PUBLISHED)
         ->condition('n.nid', $own_unpublished, 'IN')
@@ -2544,13 +2544,13 @@ function node_node_access($node, $op, $account) {
     }
 
     if ($op == 'update') {
-      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
+      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->id() == $node->uid))) {
         return NODE_ACCESS_ALLOW;
       }
     }
 
     if ($op == 'delete') {
-      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
+      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->id() == $node->uid))) {
         return NODE_ACCESS_ALLOW;
       }
     }
@@ -2690,13 +2690,13 @@ function node_access_view_all_nodes($account = NULL) {
 
   // Statically cache results in an array keyed by $account->uid.
   $access = &drupal_static(__FUNCTION__);
-  if (isset($access[$account->uid])) {
-    return $access[$account->uid];
+  if (isset($access[$account->id()])) {
+    return $access[$account->id()];
   }
 
   // If no modules implement the node access system, access is always TRUE.
   if (!module_implements('node_grants')) {
-    $access[$account->uid] = TRUE;
+    $access[$account->id()] = TRUE;
   }
   else {
     $query = db_select('node_access');
@@ -2717,12 +2717,12 @@ function node_access_view_all_nodes($account = NULL) {
     if (count($grants) > 0 ) {
       $query->condition($grants);
     }
-    $access[$account->uid] = $query
+    $access[$account->id()] = $query
       ->execute()
       ->fetchField();
   }
 
-  return $access[$account->uid];
+  return $access[$account->id()];
 }
 
 
diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc
index 8255df5..4bb63de 100644
--- a/core/modules/node/node.pages.inc
+++ b/core/modules/node/node.pages.inc
@@ -86,7 +86,7 @@ function node_add($node_type) {
   $type = $node_type->type;
   $langcode = module_invoke('language', 'get_default_langcode', 'node', $type);
   $node = entity_create('node', array(
-    'uid' => $user->uid,
+    'uid' => $user->id(),
     'name' => (isset($user->name) ? $user->name : ''),
     'type' => $type,
     'langcode' => $langcode ? $langcode : language_default()->langcode,
@@ -116,7 +116,7 @@ function node_preview(EntityInterface $node) {
       // The use of isset() is mandatory in the context of user IDs, because
       // user ID 0 denotes the anonymous user.
       if ($user = user_load_by_name($node->name)) {
-        $node->uid = $user->uid;
+        $node->uid = $user->id();
       }
       else {
         $node->uid = 0; // anonymous user
@@ -255,7 +255,7 @@ function node_revision_overview($node) {
     if ($revision->current_vid > 0) {
       $username = array(
         '#theme' => 'username',
-        '#account' => $revision,
+        '#account' => user_load($revision->uid),
       );
       $row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid"), '!username' => drupal_render($username)))
                                . (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''),
@@ -265,7 +265,7 @@ function node_revision_overview($node) {
     else {
       $username = array(
         '#theme' => 'username',
-        '#account' => $revision,
+        '#account' => user_load($revision->uid),
       );
       $row[] = t('!date by !username', array('!date' => l(format_date($revision->revision_timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => drupal_render($username)))
                . (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : '');
diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
index ac25cb2..4d93c65 100644
--- a/core/modules/node/tests/modules/node_access_test/node_access_test.module
+++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module
@@ -17,13 +17,13 @@
 function node_access_test_node_grants($account, $op) {
   $grants = array();
   // First grant a grant to the author for own content.
-  $grants['node_access_test_author'] = array($account->uid);
+  $grants['node_access_test_author'] = array($account->id());
   if ($op == 'view' && user_access('node test view', $account)) {
     $grants['node_access_test'] = array(8888, 8889);
   }
 
   $no_access_uid = Drupal::state()->get('node_access_test.no_access_uid') ?: 0;
-  if ($op == 'view' && $account->uid == $no_access_uid) {
+  if ($op == 'view' && $account->id() == $no_access_uid) {
     $grants['node_access_all'] = array(0);
   }
   return $grants;
diff --git a/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php b/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php
index b6c380e..7ee38d2 100644
--- a/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php
+++ b/core/modules/overlay/lib/Drupal/overlay/EventSubscriber/OverlaySubscriber.php
@@ -67,7 +67,7 @@ public function onRequest(GetResponseEvent $event) {
 
     // Only act if the user has access to the overlay and a mode was not already
     // set. Other modules can also enable the overlay directly for other uses.
-    $user_data = $this->userData->get('overlay', $user->uid, 'enabled');
+    $user_data = $this->userData->get('overlay', $user->id(), 'enabled');
     $use_overlay = !isset($user_data) || $user_data;
     if (empty($mode) && user_access('access overlay') && $use_overlay) {
       $current_path = $request->attributes->get('system_path');
diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module
index ed88264..5cecc2a 100644
--- a/core/modules/overlay/overlay.module
+++ b/core/modules/overlay/overlay.module
@@ -264,7 +264,8 @@ function overlay_user_dismiss_message_access() {
   // It's unlikely, but possible that "access overlay" permission is granted to
   // the anonymous role. In this case, we do not display the message to disable
   // the overlay, so there is nothing to dismiss.
-  if (empty($user->uid)) {
+  $uid = $user->id();
+  if (empty($uid)) {
     return FALSE;
   }
   return TRUE;
@@ -290,10 +291,10 @@ function overlay_user_dismiss_message() {
     throw new AccessDeniedHttpException();
   }
 
-  drupal_container()->get('user.data')->set('overlay', $user->uid, 'message_dismissed', 1);
+  drupal_container()->get('user.data')->set('overlay', $user->id(), 'message_dismissed', 1);
   drupal_set_message(t('The message has been dismissed. You can change your overlay settings at any time by visiting your profile page.'));
   // Destination is normally given. Go to the user profile as a fallback.
-  drupal_goto('user/' . $user->uid . '/edit');
+  drupal_goto('user/' . $user->id() . '/edit');
 }
 
 /**
@@ -313,11 +314,12 @@ function overlay_disable_message() {
   global $user;
 
   $build = array();
-  if (empty($user->uid) || !user_access('access overlay')) {
+  $uid = $user->id();
+  if (empty($uid) || !user_access('access overlay')) {
     return $build;
   }
 
-  $user_data = drupal_container()->get('user.data')->get('overlay', $user->uid);
+  $user_data = drupal_container()->get('user.data')->get('overlay', $user->id());
   if (empty($user_data['message_dismissed']) && (!isset($user_data['enabled']) || $user_data['enabled'])) {
     $build = array(
       '#theme' => 'overlay_disable_message',
@@ -326,7 +328,7 @@ function overlay_disable_message() {
       'profile_link' => array(
         '#type' => 'link',
         '#title' => t('If you have problems accessing administrative pages on this site, disable the overlay on your profile page.'),
-        '#href' => 'user/' . $user->uid . '/edit',
+        '#href' => 'user/' . $user->id() . '/edit',
         '#options' => array(
           'query' => drupal_get_destination(),
           'fragment' => 'edit-overlay-control',
diff --git a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
index c3d13cf..10b6bea 100644
--- a/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
+++ b/core/modules/path/lib/Drupal/path/Tests/PathLanguageTest.php
@@ -115,7 +115,7 @@ function testAliasTranslation() {
 
     // Change user language preference.
     $edit = array('preferred_langcode' => 'fr');
-    $this->drupalPost("user/{$this->web_user->uid}/edit", $edit, t('Save'));
+    $this->drupalPost("user/{$this->web_user->id()}/edit", $edit, t('Save'));
 
     // Check that the English alias works. In this situation French is the
     // current UI and content language, while URL language is English (since we
diff --git a/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php b/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php
index dd58116..23495e6 100644
--- a/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php
+++ b/core/modules/php/lib/Drupal/php/Plugin/Filter/Php.php
@@ -58,7 +58,7 @@ public function tips($long = FALSE) {
       $output .= '<li>' . t('<p>To display the name of a registered user, use this instead:</p>
   <pre>
   global $user;
-  if ($user->uid) {
+  if ($user->id()) {
     print t(\'Welcome @name! Thank you for visiting.\', array(\'@name\' => user_format_name($user)));
   }
   else {
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
index e08098e..9087e00 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
@@ -55,8 +55,8 @@ public function setUp() {
    */
   public function testNumberOfCommentsRdfaMarkup() {
     // Posts 2 comments on behalf of registered user.
-    $this->saveComment($this->node->nid, $this->web_user->uid);
-    $this->saveComment($this->node->nid, $this->web_user->uid);
+    $this->saveComment($this->node->nid, $this->web_user->id());
+    $this->saveComment($this->node->nid, $this->web_user->id());
 
     // Tests number of comments in teaser view.
     $this->drupalLogin($this->web_user);
@@ -90,7 +90,7 @@ public function testNumberOfCommentsRdfaMarkup() {
    */
   public function testCommentRdfaMarkup() {
     // Posts comment #1 on behalf of registered user.
-    $comment1 = $this->saveComment($this->node->nid, $this->web_user->uid);
+    $comment1 = $this->saveComment($this->node->nid, $this->web_user->id());
 
     // Tests comment #1 with access to the user profile.
     $this->drupalLogin($this->web_user);
@@ -133,12 +133,12 @@ public function testCommentRdfaMarkup() {
   public function testCommentReplyOfRdfaMarkup() {
     // Posts comment #1 on behalf of registered user.
     $this->drupalLogin($this->web_user);
-    $comment_1 = $this->saveComment($this->node->nid, $this->web_user->uid);
+    $comment_1 = $this->saveComment($this->node->nid, $this->web_user->id());
 
     $comment_1_uri = url('comment/' . $comment_1->id(), array('absolute' => TRUE));
 
     // Posts a reply to the first comment.
-    $comment_2 = $this->saveComment($this->node->nid, $this->web_user->uid, NULL, $comment_1->id());
+    $comment_2 = $this->saveComment($this->node->nid, $this->web_user->id(), NULL, $comment_1->id());
     $comment_2_uri = url('comment/' . $comment_2->id(), array('absolute' => TRUE));
 
     $parser = new \EasyRdf_Parser_Rdfa();
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
index 29c69cb..f51959b 100644
--- a/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/UserAttributesTest.php
@@ -42,15 +42,15 @@ function testUserAttributesInMarkup() {
     $username = $user2->name;
     $this->drupalLogin($user1);
 
-    $account_uri = url('user/' . $user2->uid, array('absolute' => TRUE));
-    $person_uri = url('user/' . $user2->uid, array('fragment' => 'me', 'absolute' => TRUE));
+    $account_uri = url('user/' . $user2->id(), array('absolute' => TRUE));
+    $person_uri = url('user/' . $user2->id(), array('fragment' => 'me', 'absolute' => TRUE));
 
     // Parses the user profile page where the default bundle mapping for user
     // should be used.
     $parser = new \EasyRdf_Parser_Rdfa();
     $graph = new \EasyRdf_Graph();
     $base_uri = url('<front>', array('absolute' => TRUE));
-    $parser->parse($graph, $this->drupalGet('user/' . $user2->uid), 'rdfa', $base_uri);
+    $parser->parse($graph, $this->drupalGet('user/' . $user2->id()), 'rdfa', $base_uri);
 
     // Inspects RDF graph output.
     // User type.
diff --git a/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php b/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
index 584be0c..52a33ea 100644
--- a/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
+++ b/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
@@ -50,7 +50,7 @@ public function access(Route $route, Request $request) {
     // 2. the user was successfully authenticated and
     // 3. the request comes with a session cookie.
     if (!in_array($method, array('GET', 'HEAD', 'OPTIONS', 'TRACE'))
-      && user_is_logged_in()
+      && $GLOBALS['user']->isAuthenticated()
       && $cookie
     ) {
       $csrf_token = $request->headers->get('X-CSRF-Token');
diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
index 46ad0cc..c8a4862 100644
--- a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
+++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php
@@ -54,7 +54,7 @@ protected function setUp() {
     // Create a test entity to serialize.
     $this->values = array(
       'name' => $this->randomName(),
-      'user_id' => $GLOBALS['user']->uid,
+      'user_id' => $GLOBALS['user']->id(),
       'field_test_text' => array(
         'value' => $this->randomName(),
         'format' => 'full_html',
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
index f1f21dd..322fe6e 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutSetsTest.php
@@ -29,7 +29,7 @@ function testShortcutSetAdd() {
     $new_set = $this->generateShortcutSet($this->randomName());
     $sets = entity_load_multiple('shortcut');
     $this->assertTrue(isset($sets[$new_set->id()]), 'Successfully created a shortcut set.');
-    $this->drupalGet('user/' . $this->admin_user->uid . '/shortcuts');
+    $this->drupalGet('user/' . $this->admin_user->id() . '/shortcuts');
     $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
   }
 
@@ -41,7 +41,7 @@ function testShortcutSetSwitchOwn() {
 
     // Attempt to switch the default shortcut set to the newly created shortcut
     // set.
-    $this->drupalPost('user/' . $this->admin_user->uid . '/shortcuts', array('set' => $new_set->id()), t('Change set'));
+    $this->drupalPost('user/' . $this->admin_user->id() . '/shortcuts', array('set' => $new_set->id()), t('Change set'));
     $this->assertResponse(200);
     $current_set = shortcut_current_displayed_set($this->admin_user);
     $this->assertTrue($new_set->id() == $current_set->id(), 'Successfully switched own shortcut set.');
@@ -67,7 +67,7 @@ function testShortcutSetSwitchCreate() {
       'id' => strtolower($this->randomName()),
       'label' => $this->randomString(),
     );
-    $this->drupalPost('user/' . $this->admin_user->uid . '/shortcuts', $edit, t('Change set'));
+    $this->drupalPost('user/' . $this->admin_user->id() . '/shortcuts', $edit, t('Change set'));
     $current_set = shortcut_current_displayed_set($this->admin_user);
     $this->assertNotEqual($current_set->id(), $this->set->id(), 'A shortcut set can be switched to at the same time as it is created.');
     $this->assertEqual($current_set->label(), $edit['label'], 'The new set is correctly assigned to the user.');
@@ -78,7 +78,7 @@ function testShortcutSetSwitchCreate() {
    */
   function testShortcutSetSwitchNoSetName() {
     $edit = array('set' => 'new');
-    $this->drupalPost('user/' . $this->admin_user->uid . '/shortcuts', $edit, t('Change set'));
+    $this->drupalPost('user/' . $this->admin_user->id() . '/shortcuts', $edit, t('Change set'));
     $this->assertText(t('The new set label is required.'));
     $current_set = shortcut_current_displayed_set($this->admin_user);
     $this->assertEqual($current_set->id(), $this->set->id(), 'Attempting to switch to a new shortcut set without providing a set name does not succeed.');
@@ -165,7 +165,7 @@ function testShortcutSetCreateWithSetName() {
     $new_set = $this->generateShortcutSet($random_name, $random_name, TRUE);
     $sets = entity_load_multiple('shortcut');
     $this->assertTrue(isset($sets[$random_name]), 'Successfully created a shortcut set with a defined set name.');
-    $this->drupalGet('user/' . $this->admin_user->uid . '/shortcuts');
+    $this->drupalGet('user/' . $this->admin_user->id() . '/shortcuts');
     $this->assertText($new_set->label(), 'Generated shortcut set was listed as a choice on the user account page.');
   }
 }
diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc
index e8ab3b5..706c942 100644
--- a/core/modules/shortcut/shortcut.admin.inc
+++ b/core/modules/shortcut/shortcut.admin.inc
@@ -54,7 +54,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) {
 
     $form['set'] = array(
       '#type' => 'radios',
-      '#title' => $user->uid == $account->uid ? t('Choose a set of shortcuts to use') : t('Choose a set of shortcuts for this user'),
+      '#title' => $user->id() == $account->id() ? t('Choose a set of shortcuts to use') : t('Choose a set of shortcuts for this user'),
       '#options' => $options,
       '#default_value' => $current_set->id(),
     );
@@ -84,7 +84,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) {
       '#required' => FALSE,
     );
 
-    if ($user->uid != $account->uid) {
+    if ($user->id() != $account->id()) {
       $default_set = shortcut_default_set($account);
       $form['new']['#description'] = t('The new set is created by copying items from the %default set.', array('%default' => $default_set->label()));
     }
@@ -146,7 +146,7 @@ function shortcut_set_switch_submit($form, &$form_state) {
       '%set_name' => $set->label(),
       '@switch-url' => url(current_path()),
     );
-    if ($account->uid == $user->uid) {
+    if ($account->id() == $user->id()) {
       // Only administrators can create new shortcut sets, so we know they have
       // access to switch back.
       drupal_set_message(t('You are now using the new %set_name shortcut set. You can edit it from this page or <a href="@switch-url">switch back to a different one.</a>', $replacements));
@@ -163,7 +163,7 @@ function shortcut_set_switch_submit($form, &$form_state) {
       '%user' => $account->name,
       '%set_name' => $set->label(),
     );
-    drupal_set_message($account->uid == $user->uid ? t('You are now using the %set_name shortcut set.', $replacements) : t('%user is now using the %set_name shortcut set.', $replacements));
+    drupal_set_message($account->id() == $user->id() ? t('You are now using the %set_name shortcut set.', $replacements) : t('%user is now using the %set_name shortcut set.', $replacements));
   }
 
   // Assign the shortcut set to the provided user account.
diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module
index 8de14a0..ba04d91 100644
--- a/core/modules/shortcut/shortcut.module
+++ b/core/modules/shortcut/shortcut.module
@@ -32,7 +32,7 @@ function shortcut_help($path, $arg) {
     case 'admin/config/user-interface/shortcut':
     case 'admin/config/user-interface/shortcut/%':
       if (user_access('switch shortcut sets')) {
-        $output = '<p>' . t('Define which shortcut set you are using on the <a href="@shortcut-link">Shortcuts tab</a> of your account page.', array('@shortcut-link' => url("user/{$user->uid}/shortcuts"))) . '</p>';
+        $output = '<p>' . t('Define which shortcut set you are using on the <a href="@shortcut-link">Shortcuts tab</a> of your account page.', array('@shortcut-link' => url("user/{$user->id()}/shortcuts"))) . '</p>';
         return $output;
       }
   }
@@ -233,7 +233,7 @@ function shortcut_set_switch_access($account = NULL) {
     return FALSE;
   }
 
-  if (!isset($account) || $user->uid == $account->uid) {
+  if (!isset($account) || $user->id() == $account->id()) {
     // Users with the 'switch shortcut sets' permission can switch their own
     // shortcuts sets.
     return TRUE;
@@ -312,7 +312,7 @@ function shortcut_set_reset_link_weights(&$shortcut_set) {
  */
 function shortcut_set_assign_user($shortcut_set, $account) {
   db_merge('shortcut_set_users')
-    ->key(array('uid' => $account->uid))
+    ->key(array('uid' => $account->id()))
     ->fields(array('set_name' => $shortcut_set->id()))
     ->execute();
   drupal_static_reset('shortcut_current_displayed_set');
@@ -333,7 +333,7 @@ function shortcut_set_assign_user($shortcut_set, $account) {
  */
 function shortcut_set_unassign_user($account) {
   $deleted = db_delete('shortcut_set_users')
-    ->condition('uid', $account->uid)
+    ->condition('uid', $account->id())
     ->execute();
   return (bool) $deleted;
 }
@@ -357,14 +357,14 @@ function shortcut_current_displayed_set($account = NULL) {
     $account = $user;
   }
   // Try to return a shortcut set from the static cache.
-  if (isset($shortcut_sets[$account->uid])) {
-    return $shortcut_sets[$account->uid];
+  if (isset($shortcut_sets[$account->id()])) {
+    return $shortcut_sets[$account->id()];
   }
   // If none was found, try to find a shortcut set that is explicitly assigned
   // to this user.
   $query = db_select('shortcut_set_users', 'ssu');
   $query->fields('ssu', array('set_name'));
-  $query->condition('ssu.uid', $account->uid);
+  $query->condition('ssu.uid', $account->id());
   $shortcut_set_name = $query->execute()->fetchField();
   if ($shortcut_set_name) {
     $shortcut_set = shortcut_set_load($shortcut_set_name);
@@ -374,7 +374,7 @@ function shortcut_current_displayed_set($account = NULL) {
     $shortcut_set = shortcut_default_set($account);
   }
 
-  $shortcut_sets[$account->uid] = $shortcut_set;
+  $shortcut_sets[$account->id()] = $shortcut_set;
   return $shortcut_set;
 }
 
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index 8c46872..be7b30e 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -266,11 +266,11 @@ protected function drupalCreateNode(array $settings = array()) {
     // logged in user if available, or else the user running the test.
     if (!isset($settings['uid'])) {
       if ($this->loggedInUser) {
-        $settings['uid'] = $this->loggedInUser->uid;
+        $settings['uid'] = $this->loggedInUser->id();
       }
       else {
         global $user;
-        $settings['uid'] = $user->uid;
+        $settings['uid'] = $user->id();
       }
     }
 
@@ -497,9 +497,9 @@ protected function drupalCreateUser(array $permissions = array(), $name = NULL)
 
     $account = entity_create('user', $edit);
     $account->save();
-
-    $this->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login'));
-    if (empty($account->uid)) {
+    $uid = $account->id();
+    $this->assertTrue(!empty($uid), t('User created with name %name and pass %pass', array('%name' => $edit['name'], '%pass' => $edit['pass'])), t('User login'));
+    if (empty($uid)) {
       return FALSE;
     }
 
@@ -622,7 +622,7 @@ protected function checkPermissions(array $permissions, $reset = FALSE) {
    *   $this->drupalLogin($account);
    *   // Load real user object.
    *   $pass_raw = $account->pass_raw;
-   *   $account = user_load($account->uid);
+   *   $account = user_load($account->id());
    *   $account->pass_raw = $pass_raw;
    * @endcode
    *
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
index af45ffd..949206f 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsAdminTest.php
@@ -61,7 +61,7 @@ function setUp() {
     }
     $this->privileged_user = $this->drupalCreateUser(array('administer statistics', 'view post access counter', 'create page content'));
     $this->drupalLogin($this->privileged_user);
-    $this->test_node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->privileged_user->uid));
+    $this->test_node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->privileged_user->id()));
     $this->client = \Drupal::httpClient();
     $this->client->setConfig(array('curl.options' => array(CURLOPT_TIMEOUT => 10)));
   }
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
index 86c7b42..76551c7 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php
@@ -51,7 +51,7 @@ function setUp() {
     $this->auth_user = $this->drupalCreateUser(array('access content', 'create page content', 'edit own page content'));
 
     // Ensure we have a node page to access.
-    $this->node = $this->drupalCreateNode(array('title' => $this->randomName(255), 'uid' => $this->auth_user->uid));
+    $this->node = $this->drupalCreateNode(array('title' => $this->randomName(255), 'uid' => $this->auth_user->id()));
 
     // Enable page caching.
     $config = config('system.performance');
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php
index b897f99..9a6b22f 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php
@@ -28,7 +28,7 @@ function testPopularContentBlock() {
     $this->container->get('plugin.manager.block')->clearCachedDefinitions();
 
     // Visit a node to have something show up in the block.
-    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->blocking_user->uid));
+    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $this->blocking_user->id()));
     $this->drupalGet('node/' . $node->nid);
     // Manually calling statistics.php, simulating ajax behavior.
     $nid = $node->nid;
diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
index 7256c30..a39f62e 100644
--- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
+++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsTokenReplaceTest.php
@@ -30,7 +30,7 @@ function testStatisticsTokenReplacement() {
     // Create user and node.
     $user = $this->drupalCreateUser(array('create page content'));
     $this->drupalLogin($user);
-    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $user->uid));
+    $node = $this->drupalCreateNode(array('type' => 'page', 'uid' => $user->id()));
 
     // Hit the node.
     $this->drupalGet('node/' . $node->nid);
diff --git a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php
index 8e7879e..a01a068 100644
--- a/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php
+++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php
@@ -29,7 +29,7 @@ class SystemMenuBlock extends BlockBase {
   public function access() {
     // @todo The 'Tools' menu should be available to anonymous users.
     list($plugin, $derivative) = explode(':', $this->getPluginId());
-    return ($GLOBALS['user']->uid || in_array($derivative, array('menu-main', 'menu-tools', 'menu-footer')));
+    return ($GLOBALS['user']->id() || in_array($derivative, array('menu-main', 'menu-tools', 'menu-footer')));
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
index 118a059..9514e4d 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
@@ -120,13 +120,13 @@ function testFormatDate() {
     $test_user = $this->drupalCreateUser();
     $this->drupalLogin($test_user);
     $edit = array('preferred_langcode' => self::LANGCODE, 'mail' => $test_user->mail, 'timezone' => 'America/Los_Angeles');
-    $this->drupalPost('user/' . $test_user->uid . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $test_user->id() . '/edit', $edit, t('Save'));
 
     // Disable session saving as we are about to modify the global $user.
     drupal_save_session(FALSE);
     // Save the original user and language and then replace it with the test user and language.
     $real_user = $user;
-    $user = user_load($test_user->uid, TRUE);
+    $user = user_load($test_user->id(), TRUE);
     $real_language = $language_interface->langcode;
     $language_interface->langcode = $user->preferred_langcode;
     // Simulate a Drupal bootstrap with the logged-in user.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
index 698ea1a..ea2b4db 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
@@ -83,13 +83,13 @@ public function testDateTimezone() {
 
     // Set up the user with a different timezone than the site.
     $edit = array('mail' => $test_user->mail, 'timezone' => 'Asia/Manila');
-    $this->drupalPost('user/' . $test_user->uid . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $test_user->id() . '/edit', $edit, t('Save'));
 
     // Disable session saving as we are about to modify the global $user.
     drupal_save_session(FALSE);
     // Save the original user and then replace it with the test user.
     $real_user = $user;
-    $user = user_load($test_user->uid, TRUE);
+    $user = user_load($test_user->id(), TRUE);
 
     // Simulate a Drupal bootstrap with the logged-in user.
     date_default_timezone_set(drupal_get_user_timezone());
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
index a9fd8bf..57f9355 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityApiTest.php
@@ -56,9 +56,9 @@ public function testCRUD() {
    */
   protected function assertCRUD($entity_type, UserInterface $user1) {
     // Create some test entities.
-    $entity = entity_create($entity_type, array('name' => 'test', 'user_id' => $user1->uid));
+    $entity = entity_create($entity_type, array('name' => 'test', 'user_id' => $user1->id()));
     $entity->save();
-    $entity = entity_create($entity_type, array('name' => 'test2', 'user_id' => $user1->uid));
+    $entity = entity_create($entity_type, array('name' => 'test2', 'user_id' => $user1->id()));
     $entity->save();
     $entity = entity_create($entity_type, array('name' => 'test', 'user_id' => NULL));
     $entity->save();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
index 3649529..6259217 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
@@ -134,7 +134,7 @@ public function testCommentHooks() {
     $account = $this->createUser();
 
     $node = entity_create('node', array(
-      'uid' => $account->uid,
+      'uid' => $account->id(),
       'type' => 'article',
       'title' => 'Test node',
       'status' => 1,
@@ -154,7 +154,7 @@ public function testCommentHooks() {
       'cid' => NULL,
       'pid' => 0,
       'nid' => $nid,
-      'uid' => $account->uid,
+      'uid' => $account->id(),
       'subject' => 'Test comment',
       'created' => REQUEST_TIME,
       'changed' => REQUEST_TIME,
@@ -490,7 +490,7 @@ public function testUserHooks() {
     ));
 
     $_SESSION['entity_crud_hook_test'] = array();
-    user_load($account->uid);
+    user_load($account->id());
 
     $this->assertHookMessageOrder(array(
       'entity_crud_hook_test_entity_load called for type user',
@@ -509,7 +509,7 @@ public function testUserHooks() {
     ));
 
     $_SESSION['entity_crud_hook_test'] = array();
-    user_delete($account->uid);
+    user_delete($account->id());
 
     $this->assertHookMessageOrder(array(
       'entity_crud_hook_test_user_predelete called',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
index 93fc552..57ce770 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php
@@ -67,7 +67,7 @@ protected function createTestEntity($entity_type) {
     // Pass in the value of the name field when creating. With the user
     // field we test setting a field after creation.
     $entity = entity_create($entity_type, array());
-    $entity->user_id->target_id = $this->entity_user->uid;
+    $entity->user_id->target_id = $this->entity_user->id();
     $entity->name->value = $this->entity_name;
 
     // Set a value for the test field.
@@ -117,19 +117,19 @@ protected function assertReadWrite($entity_type) {
     $this->assertTrue($entity->user_id instanceof FieldInterface, format_string('%entity_type: Field implements interface', array('%entity_type' => $entity_type)));
     $this->assertTrue($entity->user_id[0] instanceof FieldItemInterface, format_string('%entity_type: Field item implements interface', array('%entity_type' => $entity_type)));
 
-    $this->assertEqual($this->entity_user->uid, $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($this->entity_user->id(), $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: User name can be read.', array('%entity_type' => $entity_type)));
 
     // Change the assigned user by entity.
     $new_user = $this->createUser();
     $entity->user_id->entity = $new_user;
-    $this->assertEqual($new_user->uid, $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($new_user->id(), $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($new_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: Updated user name value can be read.', array('%entity_type' => $entity_type)));
 
     // Change the assigned user by id.
     $new_user = $this->createUser();
-    $entity->user_id->target_id = $new_user->uid;
-    $this->assertEqual($new_user->uid, $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
+    $entity->user_id->target_id = $new_user->id();
+    $this->assertEqual($new_user->id(), $entity->user_id->target_id, format_string('%entity_type: Updated user id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($new_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: Updated user name value can be read.', array('%entity_type' => $entity_type)));
 
     // Try unsetting a field.
@@ -207,7 +207,7 @@ protected function assertReadWrite($entity_type) {
     $this->entity_name = $this->randomName();
     $name_item[0]['value'] = $this->entity_name;
     $this->entity_user = $this->createUser();
-    $user_item[0]['target_id'] = $this->entity_user->uid;
+    $user_item[0]['target_id'] = $this->entity_user->id();
     $this->entity_field_text = $this->randomName();
     $text_item[0]['value'] = $this->entity_field_text;
 
@@ -217,7 +217,7 @@ protected function assertReadWrite($entity_type) {
       'field_test_text' => $text_item,
     ));
     $this->assertEqual($this->entity_name, $entity->name->value, format_string('%entity_type: Name value can be read.', array('%entity_type' => $entity_type)));
-    $this->assertEqual($this->entity_user->uid, $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($this->entity_user->id(), $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: User name can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_field_text, $entity->field_test_text->value, format_string('%entity_type: Text field can be read.', array('%entity_type' => $entity_type)));
 
@@ -328,7 +328,7 @@ protected function assertSave($entity_type) {
     $this->assertTrue(is_string($entity->uuid->value), format_string('%entity_type: UUID value can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $entity->langcode->value, format_string('%entity_type: Language code can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual(language_load(Language::LANGCODE_NOT_SPECIFIED), $entity->langcode->language, format_string('%entity_type: Language object can be read.', array('%entity_type' => $entity_type)));
-    $this->assertEqual($this->entity_user->uid, $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
+    $this->assertEqual($this->entity_user->id(), $entity->user_id->target_id, format_string('%entity_type: User id can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_user->name, $entity->user_id->entity->name->value, format_string('%entity_type: User name can be read.', array('%entity_type' => $entity_type)));
     $this->assertEqual($this->entity_field_text, $entity->field_test_text->value, format_string('%entity_type: Text field can be read.', array('%entity_type' => $entity_type)));
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
index f36fca7..a7479e3 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php
@@ -110,7 +110,7 @@ public function setUp() {
       $entity = entity_create('entity_test', array());
       $entity->name->value = $this->randomName();
       $index = $i ? 1 : 0;
-      $entity->user_id->target_id = $this->accounts[$index]->uid;
+      $entity->user_id->target_id = $this->accounts[$index]->id();
       $entity->{$this->fieldName}->tid = $this->terms[$index]->id();
       $entity->save();
       $this->entities[] = $entity;
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
index 152527b..e2d31ab 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityRevisionsTest.php
@@ -64,7 +64,7 @@ protected function assertRevisions($entity_type) {
     // Create initial entity.
     $entity = entity_create($entity_type, array(
       'name' => 'foo',
-      'user_id' => $this->web_user->uid,
+      'user_id' => $this->web_user->id(),
     ));
     $entity->field_test_text->value = 'bar';
     $entity->save();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
index 919565c..6f32370 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php
@@ -108,7 +108,7 @@ public function testEntityLanguageMethods() {
   protected function assertEntityLanguageMethods($entity_type) {
     $entity = entity_create($entity_type, array(
       'name' => 'test',
-      'user_id' => $GLOBALS['user']->uid,
+      'user_id' => $GLOBALS['user']->id(),
     ));
     $this->assertEqual($entity->language()->langcode, Language::LANGCODE_NOT_SPECIFIED, format_string('%entity_type: Entity language not specified.', array('%entity_type' => $entity_type)));
     $this->assertFalse($entity->getTranslationLanguages(FALSE), format_string('%entity_type: No translations are available', array('%entity_type' => $entity_type)));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
index f1a0fdb..f00a35b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityValidationTest.php
@@ -72,7 +72,7 @@ protected function createTestEntity($entity_type) {
     // Pass in the value of the name field when creating. With the user
     // field we test setting a field after creation.
     $entity = entity_create($entity_type, array());
-    $entity->user_id->target_id = $this->entity_user->uid;
+    $entity->user_id->target_id = $this->entity_user->id();
     $entity->name->value = $this->entity_name;
 
     // Set a value for the test field.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
index c2d6593..4fd5829 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
@@ -388,17 +388,17 @@ function testBreadCrumbs() {
     // Verify breadcrumb on user pages (without menu link) for anonymous user.
     $trail = $home;
     $this->assertBreadcrumb('user', $trail, t('Log in'));
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $this->admin_user->name);
 
     // Verify breadcrumb on user pages (without menu link) for registered users.
     $this->drupalLogin($this->admin_user);
     $trail = $home;
     $this->assertBreadcrumb('user', $trail, $this->admin_user->name);
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $this->admin_user->name);
     $trail += array(
-      'user/' . $this->admin_user->uid => $this->admin_user->name,
+      'user/' . $this->admin_user->id() => $this->admin_user->name,
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $this->admin_user->name);
 
     // Create a second user to verify breadcrumb on user pages again.
     $this->web_user = $this->drupalCreateUser(array(
@@ -410,23 +410,23 @@ function testBreadCrumbs() {
     // Verify correct breadcrumb and page title on another user's account pages
     // (without menu link).
     $trail = $home;
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $this->admin_user->name);
     $trail += array(
-      'user/' . $this->admin_user->uid => $this->admin_user->name,
+      'user/' . $this->admin_user->id() => $this->admin_user->name,
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $this->admin_user->name);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $this->admin_user->name);
 
     // Verify correct breadcrumb and page title when viewing own user account
     // pages (without menu link).
     $trail = $home;
-    $this->assertBreadcrumb('user/' . $this->web_user->uid, $trail, $this->web_user->name);
+    $this->assertBreadcrumb('user/' . $this->web_user->id(), $trail, $this->web_user->name);
     $trail += array(
-      'user/' . $this->web_user->uid => $this->web_user->name,
+      'user/' . $this->web_user->id() => $this->web_user->name,
     );
     $tree = array(
       'user' => t('My account'),
     );
-    $this->assertBreadcrumb('user/' . $this->web_user->uid . '/edit', $trail, $this->web_user->name, $tree);
+    $this->assertBreadcrumb('user/' . $this->web_user->id() . '/edit', $trail, $this->web_user->name, $tree);
 
     // Add a Tools menu links for 'user' and $this->admin_user.
     // Although it may be faster to manage these links via low-level API
@@ -442,7 +442,7 @@ function testBreadCrumbs() {
 
     $edit = array(
       'link_title' => $this->admin_user->name . ' link',
-      'link_path' => 'user/' . $this->admin_user->uid,
+      'link_path' => 'user/' . $this->admin_user->id(),
     );
     $this->drupalPost("admin/structure/menu/manage/$menu/add", $edit, t('Save'));
     $menu_links_admin_user = entity_load_multiple_by_properties('menu_link', array('link_title' => $edit['link_title'], 'link_path' => $edit['link_path']));
@@ -458,13 +458,13 @@ function testBreadCrumbs() {
     $tree = array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $link_admin_user['link_title'], $tree);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $link_admin_user['link_title'], $tree);
 
     $this->drupalLogin($this->admin_user);
     $trail += array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
 
     // Move 'user/%' below 'user' and verify again.
     $edit = array(
@@ -484,13 +484,13 @@ function testBreadCrumbs() {
     $tree += array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid, $trail, $link_admin_user['link_title'], $tree);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id(), $trail, $link_admin_user['link_title'], $tree);
 
     $this->drupalLogin($this->admin_user);
     $trail += array(
       $link_admin_user['link_path'] => $link_admin_user['link_title'],
     );
-    $this->assertBreadcrumb('user/' . $this->admin_user->uid . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
+    $this->assertBreadcrumb('user/' . $this->admin_user->id() . '/edit', $trail, $link_admin_user['link_title'], $tree, FALSE);
 
     // Create an only slightly privileged user being able to access site reports
     // but not administration pages.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
index b6731ac..0f2fc73 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
@@ -205,11 +205,11 @@ function testAuthUserUserLogin() {
 
     $this->drupalGet('user/login');
     // Check that we got to 'user'.
-    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid, array('absolute' => TRUE)), "Logged-in user redirected to user on accessing user/login");
+    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->id(), array('absolute' => TRUE)), "Logged-in user redirected to user on accessing user/login");
 
     // user/register should redirect to user/UID/edit.
     $this->drupalGet('user/register');
-    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid . '/edit', array('absolute' => TRUE)), "Logged-in user redirected to user/UID/edit on accessing user/register");
+    $this->assertTrue($this->url == url('user/' . $this->loggedInUser->id() . '/edit', array('absolute' => TRUE)), "Logged-in user redirected to user/UID/edit on accessing user/register");
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php b/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
index 14a0422..d3111dd 100644
--- a/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/ParamConverter/UpcastingTest.php
@@ -46,13 +46,13 @@ public function testUpcasting() {
     $foo = 'bar';
 
     // paramconverter_test/test_user_node_foo/{user}/{node}/{foo}
-    $this->drupalGet("paramconverter_test/test_user_node_foo/{$user->uid}/{$node->nid}/$foo");
+    $this->drupalGet("paramconverter_test/test_user_node_foo/{$user->id()}/{$node->nid}/$foo");
     $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: $foo", 'user and node upcast by entity name');
 
     // paramconverter_test/test_node_user_user/{node}/{foo}/{user}
     // converters:
     //   foo: 'user'
-    $this->drupalGet("paramconverter_test/test_node_user_user/{$node->nid}/{$user->uid}/{$user->uid}");
+    $this->drupalGet("paramconverter_test/test_node_user_user/{$node->nid}/{$user->id()}/{$user->id()}");
     $this->assertRaw("user: {$user->label()}, node: {$node->label()}, foo: {$user->label()}", 'foo converted to user as well');
 
     // paramconverter_test/test_node_node_foo/{user}/{node}/{foo}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
index eef40d4..201b58a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/UrlAlterFunctionalTest.php
@@ -36,7 +36,7 @@ function testUrlAlter() {
     $account = $this->drupalCreateUser(array('administer url aliases'));
     $this->drupalLogin($account);
 
-    $uid = $account->uid;
+    $uid = $account->id();
     $name = $account->name;
 
     // Test a single altered path.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
index b338b7b..d9a72b0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
@@ -209,7 +209,7 @@ protected function testHttpsSession() {
     $this->drupalPost(NULL, $edit, t('Log in'));
 
     // Test that the user is also authenticated on the insecure site.
-    $this->drupalGet("user/{$user->uid}/edit");
+    $this->drupalGet("user/{$user->id()}/edit");
     $this->assertResponse(200);
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
index f96b13e..220e672 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php
@@ -42,7 +42,7 @@ function testSessionSaveRegenerate() {
     $user = $this->drupalCreateUser(array('access content'));
 
     // Enable sessions.
-    $this->sessionReset($user->uid);
+    $this->sessionReset($user->id());
 
     // Make sure the session cookie is set as HttpOnly.
     $this->drupalLogin($user);
@@ -84,7 +84,7 @@ function testSessionSaveRegenerate() {
   function testDataPersistence() {
     $user = $this->drupalCreateUser(array('access content'));
     // Enable sessions.
-    $this->sessionReset($user->uid);
+    $this->sessionReset($user->id());
 
     $this->drupalLogin($user);
 
@@ -104,7 +104,7 @@ function testDataPersistence() {
 
     // Switch browser cookie to anonymous user, then back to user 1.
     $this->sessionReset();
-    $this->sessionReset($user->uid);
+    $this->sessionReset($user->id());
     $this->assertText($value_1, 'Session data persists through browser close.', 'Session');
 
     // Logout the user and make sure the stored value no longer persists.
@@ -129,13 +129,13 @@ function testDataPersistence() {
 
     // Login, the data should persist.
     $this->drupalLogin($user);
-    $this->sessionReset($user->uid);
+    $this->sessionReset($user->id());
     $this->drupalGet('session-test/get');
     $this->assertNoText($value_1, 'Session has persisted for an authenticated user after logging out and then back in.', 'Session');
 
     // Change session and create another user.
     $user2 = $this->drupalCreateUser(array('access content'));
-    $this->sessionReset($user2->uid);
+    $this->sessionReset($user2->id());
     $this->drupalLogin($user2);
   }
 
@@ -203,7 +203,7 @@ function testSessionWrite() {
     $this->drupalLogin($user);
 
     $sql = 'SELECT u.access, s.timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE u.uid = :uid';
-    $times1 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
+    $times1 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
 
     // Before every request we sleep one second to make sure that if the session
     // is saved, its timestamp will change.
@@ -211,21 +211,21 @@ function testSessionWrite() {
     // Modify the session.
     sleep(1);
     $this->drupalGet('session-test/set/foo');
-    $times2 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
+    $times2 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
     $this->assertEqual($times2->access, $times1->access, 'Users table was not updated.');
     $this->assertNotEqual($times2->timestamp, $times1->timestamp, 'Sessions table was updated.');
 
     // Write the same value again, i.e. do not modify the session.
     sleep(1);
     $this->drupalGet('session-test/set/foo');
-    $times3 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
+    $times3 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
     $this->assertEqual($times3->access, $times1->access, 'Users table was not updated.');
     $this->assertEqual($times3->timestamp, $times2->timestamp, 'Sessions table was not updated.');
 
     // Do not change the session.
     sleep(1);
     $this->drupalGet('');
-    $times4 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
+    $times4 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
     $this->assertEqual($times4->access, $times3->access, 'Users table was not updated.');
     $this->assertEqual($times4->timestamp, $times3->timestamp, 'Sessions table was not updated.');
 
@@ -238,7 +238,7 @@ function testSessionWrite() {
     );
     $this->writeSettings($settings);
     $this->drupalGet('');
-    $times5 = db_query($sql, array(':uid' => $user->uid))->fetchObject();
+    $times5 = db_query($sql, array(':uid' => $user->id()))->fetchObject();
     $this->assertNotEqual($times5->access, $times4->access, 'Users table was updated.');
     $this->assertNotEqual($times5->timestamp, $times4->timestamp, 'Sessions table was updated.');
   }
@@ -254,7 +254,7 @@ function testEmptySessionID() {
 
     // Reset the sid in {sessions} to a blank string. This may exist in the
     // wild in some cases, although we normally prevent it from happening.
-    db_query("UPDATE {sessions} SET sid = '' WHERE uid = :uid", array(':uid' => $user->uid));
+    db_query("UPDATE {sessions} SET sid = '' WHERE uid = :uid", array(':uid' => $user->id()));
     // Send a blank sid in the session cookie, and the session should no longer
     // be valid. Closing the curl handler will stop the previous session ID
     // from persisting.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php b/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
index 7c8c85b..85c68ba 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
@@ -49,7 +49,7 @@ function testAccessDenied() {
     // Use a custom 403 page.
     $this->drupalLogin($this->admin_user);
     $edit = array(
-      'site_403' => 'user/' . $this->admin_user->uid,
+      'site_403' => 'user/' . $this->admin_user->id(),
     );
     $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php b/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php
index 4e79ae9..ae39a10 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/MainContentFallbackTest.php
@@ -81,7 +81,7 @@ function testMainContentFallback() {
 
     // Request a user* page and see if it is displayed.
     $this->drupalLogin($this->web_user);
-    $this->drupalGet('user/' . $this->web_user->uid . '/edit');
+    $this->drupalGet('user/' . $this->web_user->id() . '/edit');
     $this->assertField('mail', 'User interface still available.');
 
     // Enable the block module again.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php b/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
index dde1822..a794f77 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/PageNotFoundTest.php
@@ -37,7 +37,7 @@ function testPageNotFound() {
 
     // Use a custom 404 page.
     $edit = array(
-      'site_404' => 'user/' . $this->admin_user->uid,
+      'site_404' => 'user/' . $this->admin_user->id(),
     );
     $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php b/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
index 761adf2..a5a689c 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
@@ -112,8 +112,8 @@ function testSiteMaintenance() {
     );
     $this->drupalPost('user/password', $edit, t('E-mail new password'));
     $mails = $this->drupalGetMails();
-    $start = strpos($mails[0]['body'], 'user/reset/'. $this->user->uid);
-    $path = substr($mails[0]['body'], $start, 66 + strlen($this->user->uid));
+    $start = strpos($mails[0]['body'], 'user/reset/'. $this->user->id());
+    $path = substr($mails[0]['body'], $start, 66 + strlen($this->user->id()));
 
     // Log in with temporary login link.
     $this->drupalPost($path, array(), t('Log in'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
index d32f297..87c881e 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
@@ -30,7 +30,7 @@ function testTokenReplacement() {
 
     // Create the initial objects.
     $account = $this->drupalCreateUser();
-    $node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $node = $this->drupalCreateNode(array('uid' => $account->id()));
     $node->title = '<blink>Blinking Text</blink>';
     global $user;
     $language_interface = language(Language::TYPE_INTERFACE);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php
index b0e255e..3f625b1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php
@@ -64,7 +64,7 @@ function testUpdateAccess() {
     $user1 = user_load(1);
     $user1->pass_raw = user_password();
     $user1->pass = drupal_container()->get('password')->hash(trim($user1->pass_raw));
-    db_query("UPDATE {users} SET pass = :pass WHERE uid = :uid", array(':pass' => $user1->pass, ':uid' => $user1->uid));
+    db_query("UPDATE {users} SET pass = :pass WHERE uid = :uid", array(':pass' => $user1->pass, ':uid' => $user1->id()));
     $this->drupalLogin($user1);
     $this->drupalGet($this->update_url, array('external' => TRUE));
     $this->assertResponse(200);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
index b613121..cf677ce 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\DrupalKernel;
+use Drupal\Core\Session\UserSession;
 use Drupal\simpletest\WebTestBase;
 use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
 use Symfony\Component\HttpFoundation\Request;
@@ -144,15 +145,12 @@ protected function setUp() {
     // Ensure that the session is not written to the new environment and replace
     // the global $user session with uid 1 from the new test site.
     drupal_save_session(FALSE);
-    // Login as uid 1.
-    $user = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => 1))->fetchObject();
-    // Load roles for the user object.
-    $roles = array(DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID);
-    $result = db_query('SELECT rid, uid FROM {users_roles} WHERE uid = :uid', array(':uid' => 1));
-    foreach ($result as $record) {
-      $roles[$record->rid] = $record->rid;
-    }
-    $user->roles = $roles;
+    // Load values for uid 1.
+    $values = db_query('SELECT * FROM {users} WHERE uid = :uid', array(':uid' => 1))->fetchAssoc();
+    // Load rolest.
+    $values['roles'] = array_merge(array(DRUPAL_AUTHENTICATED_RID), db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => 1))->fetchCol());
+    // Create a new user session object.
+    $user = new UserSession($values);
 
     // Generate and set a D8-compatible session cookie.
     $this->prepareD8Session();
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 89bbde0..dcc49ff 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -1912,7 +1912,7 @@ function hook_mail($key, &$message, $params) {
   if (isset($params['node'])) {
     $node = $params['node'];
     $variables += array(
-      '%uid' => $node->uid,
+      '%uid' => $node->id(),
       '%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)),
       '%node_type' => node_get_type_label($node),
       '%title' => $node->title,
@@ -2226,7 +2226,7 @@ function hook_file_url_alter(&$uri) {
   global $user;
 
   // User 1 will always see the local file in this example.
-  if ($user->uid == 1) {
+  if ($user->id() == 1) {
     return;
   }
 
@@ -2701,11 +2701,11 @@ function hook_update_N(&$sandbox) {
     $user->name .= '!';
     db_update('users')
       ->fields(array('name' => $user->name))
-      ->condition('uid', $user->uid)
+      ->condition('uid', $user->id())
       ->execute();
 
     $sandbox['progress']++;
-    $sandbox['current_uid'] = $user->uid;
+    $sandbox['current_uid'] = $user->id();
   }
 
   $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
@@ -3145,7 +3145,7 @@ function hook_url_outbound_alter(&$path, &$options, $original_path) {
   // Instead of pointing to user/[uid]/edit, point to user/me/edit.
   if (preg_match('|^user/([0-9]*)/edit(/.*)?|', $path, $matches)) {
     global $user;
-    if ($user->uid == $matches[1]) {
+    if ($user->id() == $matches[1]) {
       $path = 'user/me/edit' . $matches[2];
     }
   }
@@ -3222,7 +3222,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = arr
 
         // Default values for the chained tokens handled below.
         case 'author':
-          $name = ($node->uid == 0) ? config('user.settings')->get('anonymous') : $node->name;
+          $name = ($node->id() == 0) ? config('user.settings')->get('anonymous') : $node->name;
           $replacements[$original] = $sanitize ? filter_xss($name) : $name;
           break;
 
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 6a1f766..2d6c0c4 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -124,7 +124,7 @@ function system_help($path, $arg) {
       break;
     case 'admin/config/development/maintenance':
       global $user;
-      if ($user->uid == 1) {
+      if ($user->id() == 1) {
         return '<p>' . t('Use maintenance mode when making major updates, particularly if the updates could disrupt visitors or the update process. Examples include upgrading, importing or exporting content, modifying a theme, modifying content types, and making backups.') . '</p>';
       }
       break;
@@ -2576,7 +2576,7 @@ function system_user_login($account) {
   $config = config('system.timezone');
   // If the user has a NULL time zone, notify them to set a time zone.
   if (!$account->timezone && $config->get('user.configurable') && $config->get('user.warn')) {
-    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
+    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->id()/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
   }
 }
 
@@ -2595,11 +2595,11 @@ function system_user_timezone(&$form, &$form_state) {
   $form['timezone']['timezone'] = array(
     '#type' => 'select',
     '#title' => t('Time zone'),
-    '#default_value' => isset($account->timezone) ? $account->timezone : ($account->uid == $user->uid ? config('system.date')->get('timezone.default') : ''),
-    '#options' => system_time_zones($account->uid != $user->uid),
+    '#default_value' => isset($account->timezone) ? $account->timezone : ($account->id() == $user->id() ? config('system.date')->get('timezone.default') : ''),
+    '#options' => system_time_zones($account->id() != $user->id()),
     '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
   );
-  if (!isset($account->timezone) && $account->uid == $user->uid && empty($form_state['input']['timezone'])) {
+  if (!isset($account->timezone) && $account->id() == $user->id() && empty($form_state['input']['timezone'])) {
     $form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.');
     $form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect'));
     drupal_add_library('system', 'drupal.timezone');
diff --git a/core/modules/system/tests/modules/database_test/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module
index dfb38f7..9f2a944 100644
--- a/core/modules/system/tests/modules/database_test/database_test.module
+++ b/core/modules/system/tests/modules/database_test/database_test.module
@@ -233,7 +233,7 @@ function database_test_theme_tablesort($form, &$form_state) {
   $status = array(t('blocked'), t('active'));
   $accounts = array();
   foreach ($result as $account) {
-    $options[$account->uid] = array(
+    $options[$account->id()] = array(
       'username' => check_plain($account->name),
       'status' =>  $status[$account->status],
     );
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index b73006e..d730612 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -2261,7 +2261,7 @@ function form_test_user_register_form_rebuild($form, &$form_state) {
 function form_test_two_instances() {
   global $user;
   $node1 = entity_create('node', array(
-    'uid' => $user->uid,
+    'uid' => $user->id(),
     'name' => (isset($user->name) ? $user->name : ''),
     'type' => 'page',
     'langcode' => Language::LANGCODE_NOT_SPECIFIED,
diff --git a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php
index b3611be..1632d5e 100644
--- a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php
+++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessor.php
@@ -22,7 +22,7 @@ public function processInbound($path, Request $request) {
     if (preg_match('!^user/([^/]+)(/.*)?!', $path, $matches)) {
       if ($account = user_load_by_name($matches[1])) {
         $matches += array(2 => '');
-        $path = 'user/' . $account->uid . $matches[2];
+        $path = 'user/' . $account->id() . $matches[2];
       }
     }
 
diff --git a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php
index e649f6d..a27c65c 100644
--- a/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php
+++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/PathProcessorTest.php
@@ -24,7 +24,7 @@ public function processInbound($path, Request $request) {
     if (preg_match('!^user/([^/]+)(/.*)?!', $path, $matches)) {
       if ($account = user_load_by_name($matches[1])) {
         $matches += array(2 => '');
-        $path = 'user/' . $account->uid . $matches[2];
+        $path = 'user/' . $account->id() . $matches[2];
       }
     }
 
diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index 3d3f075..9dea82a 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -631,7 +631,7 @@ function toolbar_library_info() {
  */
 function _toolbar_get_subtree_hash() {
   global $user;
-  $cid = $user->uid . ':' . language(Language::TYPE_INTERFACE)->langcode;
+  $cid = $user->id() . ':' . language(Language::TYPE_INTERFACE)->langcode;
   if ($cache = cache('toolbar')->get($cid)) {
     $hash = $cache->data;
   }
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
index d9db513..76033fb 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
@@ -61,7 +61,7 @@ function testTrackerNodeAccess() {
     $this->drupalGet('tracker');
     $this->assertText($private_node->title, 'Private node is visible to user with private access.');
     $this->assertText($public_node->title, 'Public node is visible to user with private access.');
-    $this->drupalGet('user/' . $access_user->uid . '/track');
+    $this->drupalGet('user/' . $access_user->id() . '/track');
     $this->assertText($private_node->title, 'Private node is visible to user with private access.');
     $this->assertText($public_node->title, 'Public node is visible to user with private access.');
 
@@ -70,7 +70,7 @@ function testTrackerNodeAccess() {
     $this->drupalGet('tracker');
     $this->assertNoText($private_node->title, 'Private node is not visible to user without private access.');
     $this->assertText($public_node->title, 'Public node is visible to user without private access.');
-    $this->drupalGet('user/' . $access_user->uid . '/track');
+    $this->drupalGet('user/' . $access_user->id() . '/track');
     $this->assertNoText($private_node->title, 'Private node is not visible to user without private access.');
     $this->assertText($public_node->title, 'Public node is visible to user without private access.');
   }
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
index b68b722..baa48d0 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
@@ -91,22 +91,22 @@ function testTrackerUser() {
 
     $unpublished = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->user->uid,
+      'uid' => $this->user->id(),
       'status' => 0,
     ));
     $my_published = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->user->uid,
+      'uid' => $this->user->id(),
       'status' => 1,
     ));
     $other_published_no_comment = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->other_user->uid,
+      'uid' => $this->other_user->id(),
       'status' => 1,
     ));
     $other_published_my_comment = $this->drupalCreateNode(array(
       'title' => $this->randomName(8),
-      'uid' => $this->other_user->uid,
+      'uid' => $this->other_user->id(),
       'status' => 1,
     ));
     $comment = array(
@@ -115,7 +115,7 @@ function testTrackerUser() {
     );
     $this->drupalPost('comment/reply/' . $other_published_my_comment->nid, $comment, t('Save'));
 
-    $this->drupalGet('user/' . $this->user->uid . '/track');
+    $this->drupalGet('user/' . $this->user->id() . '/track');
     $this->assertNoText($unpublished->label(), "Unpublished nodes do not show up in the users's tracker listing.");
     $this->assertText($my_published->label(), "Published nodes show up in the user's tracker listing.");
     $this->assertNoText($other_published_no_comment->label(), "Other user's nodes do not show up in the user's tracker listing.");
@@ -125,7 +125,7 @@ function testTrackerUser() {
     $admin_user = $this->drupalCreateUser(array('post comments', 'administer comments', 'access user profiles'));
     $this->drupalLogin($admin_user);
     $this->drupalPost('comment/1/edit', array('status' => COMMENT_NOT_PUBLISHED), t('Save'));
-    $this->drupalGet('user/' . $this->user->uid . '/track');
+    $this->drupalGet('user/' . $this->user->id() . '/track');
     $this->assertNoText($other_published_my_comment->label(), 'Unpublished comments are not counted on the tracker listing.');
   }
 
@@ -234,7 +234,7 @@ function testTrackerCronIndexing() {
     $this->drupalLogin($this->user);
 
     // Fetch the user's tracker.
-    $this->drupalGet('tracker/' . $this->user->uid);
+    $this->drupalGet('tracker/' . $this->user->id());
 
     // Assert that all node titles are displayed.
     foreach ($nodes as $i => $node) {
diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module
index 58de969..edcd297 100644
--- a/core/modules/tracker/tracker.module
+++ b/core/modules/tracker/tracker.module
@@ -171,7 +171,7 @@ function tracker_cron() {
  */
 function _tracker_myrecent_access($account) {
   // This path is only allowed for authenticated users looking at their own content.
-  return $account->uid && ($GLOBALS['user']->uid == $account->uid) && user_access('access content');
+  return $account->id() && ($GLOBALS['user']->id() == $account->id()) && user_access('access content');
 }
 
 /**
diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc
index d33e1f3..1716043 100644
--- a/core/modules/tracker/tracker.pages.inc
+++ b/core/modules/tracker/tracker.pages.inc
@@ -22,7 +22,7 @@ function tracker_page($account = NULL, $set_title = FALSE) {
     $query = db_select('tracker_user', 't')
       ->extend('Drupal\Core\Database\Query\PagerSelectExtender')
       ->addMetaData('base_table', 'tracker_user')
-      ->condition('t.uid', $account->uid);
+      ->condition('t.uid', $account->id());
 
     if ($set_title) {
       // When viewed from user/%user/track, display the name of the user
diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module
index 115be1a..3dd2603 100644
--- a/core/modules/translation/translation.module
+++ b/core/modules/translation/translation.module
@@ -152,7 +152,7 @@ function translation_user_can_translate_node($node, $account = NULL) {
   if (empty($account)) {
     $account = $GLOBALS['user'];
   }
-  return node_access('view', $node, $account) && (user_access('translate all content', $account) || ($node->uid == $account->uid && user_access('translate own content', $account)));
+  return node_access('view', $node, $account) && (user_access('translate all content', $account) || ($node->uid == $account->id() && user_access('translate own content', $account)));
 }
 
 /**
diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
index 906248a..4eade86 100644
--- a/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
+++ b/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php
@@ -417,7 +417,7 @@ public function entityFormEntityBuild($entity_type, EntityInterface $entity, arr
 
     // @todo Use the entity setter when all entities support multilingual
     // properties.
-    $translation['uid'] = !empty($values['name']) && ($account = user_load_by_name($values['name'])) ? $account->uid : 0;
+    $translation['uid'] = !empty($values['name']) && ($account = user_load_by_name($values['name'])) ? $account->id() : 0;
     $translation['status'] = !empty($values['status']);
     $translation['created'] = !empty($values['created']) ? strtotime($values['created']) : REQUEST_TIME;
     $translation['changed'] = REQUEST_TIME;
diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php
index 95826ac..00a2f96 100644
--- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php
+++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php
@@ -110,7 +110,7 @@ function testImageFieldSync() {
       // identifier.
       $field_values = array(
         'uri' => $this->files[$index]->uri,
-        'uid' => $GLOBALS['user']->uid,
+        'uid' => $GLOBALS['user']->id(),
         'status' => FILE_STATUS_PERMANENT,
       );
       $file = entity_create('file', $field_values);
diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php
index 50e8bbd..f5b292b 100644
--- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php
+++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationUITest.php
@@ -166,7 +166,7 @@ protected function assertAuthoringInfo() {
     foreach ($this->langcodes as $index => $langcode) {
       $user = $this->drupalCreateUser();
       $values[$langcode] = array(
-        'uid' => $user->uid,
+        'uid' => $user->id(),
         'created' => REQUEST_TIME - mt_rand(0, 1000),
       );
       $edit = array(
diff --git a/core/modules/translation_entity/translation_entity.module b/core/modules/translation_entity/translation_entity.module
index 6f6c740..816cad1 100644
--- a/core/modules/translation_entity/translation_entity.module
+++ b/core/modules/translation_entity/translation_entity.module
@@ -728,7 +728,7 @@ function translation_entity_entity_insert(EntityInterface $entity) {
 
     $translation += array(
       'source' => '',
-      'uid' => $GLOBALS['user']->uid,
+      'uid' => $GLOBALS['user']->id(),
       'outdated' => FALSE,
       'status' => TRUE,
       'created' => REQUEST_TIME,
diff --git a/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php b/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php
index 7148709..c2bdc10 100644
--- a/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php
+++ b/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php
@@ -27,7 +27,7 @@ public function applies(Route $route) {
    * {@inheritdoc}
    */
   public function access(Route $route, Request $request) {
-    return (bool) $GLOBALS['user']->uid;
+    return (bool) $GLOBALS['user']->id();
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/AccountFormController.php b/core/modules/user/lib/Drupal/user/AccountFormController.php
index 13ad217..64502a7 100644
--- a/core/modules/user/lib/Drupal/user/AccountFormController.php
+++ b/core/modules/user/lib/Drupal/user/AccountFormController.php
@@ -24,7 +24,8 @@ public function form(array $form, array &$form_state) {
     $config = config('user.settings');
 
     $language_interface = language(Language::TYPE_INTERFACE);
-    $register = empty($account->uid);
+    $uid = $account->id();
+    $register = empty($uid);
     $admin = user_access('administer users');
 
     // Account information.
@@ -43,7 +44,7 @@ public function form(array $form, array &$form_state) {
       '#attributes' => array('class' => array('username'), 'autocorrect' => 'off', 'autocomplete' => 'off', 'autocapitalize' => 'off',
       'spellcheck' => 'false'),
       '#default_value' => (!$register ? $account->name : ''),
-      '#access' => ($register || ($user->uid == $account->uid && user_access('change own username')) || $admin),
+      '#access' => ($register || ($user->id() == $account->id() && user_access('change own username')) || $admin),
       '#weight' => -10,
     );
 
@@ -70,7 +71,7 @@ public function form(array $form, array &$form_state) {
 
       // To skip the current password field, the user must have logged in via a
       // one-time link and have the token in the URL.
-      $pass_reset = isset($_SESSION['pass_reset_' . $account->uid]) && isset($_GET['pass-reset-token']) && ($_GET['pass-reset-token'] == $_SESSION['pass_reset_' . $account->uid]);
+      $pass_reset = isset($_SESSION['pass_reset_' . $account->id()]) && isset($_GET['pass-reset-token']) && ($_GET['pass-reset-token'] == $_SESSION['pass_reset_' . $account->id()]);
       $protected_values = array();
       $current_pass_description = '';
 
@@ -84,7 +85,7 @@ public function form(array $form, array &$form_state) {
       }
 
       // The user must enter their current password to change to a new one.
-      if ($user->uid == $account->uid) {
+      if ($user->id() == $account->id()) {
         $form['account']['current_pass_required_values'] = array(
           '#type' => 'value',
           '#value' => $protected_values,
@@ -259,7 +260,7 @@ public function validate(array $form, array &$form_state) {
       else {
         $name_taken = (bool) db_select('users')
         ->fields('users', array('uid'))
-        ->condition('uid', (int) $account->uid, '<>')
+        ->condition('uid', (int) $account->id(), '<>')
         ->condition('name', db_like($form_state['values']['name']), 'LIKE')
         ->range(0, 1)
         ->execute()
@@ -276,7 +277,7 @@ public function validate(array $form, array &$form_state) {
     if (!empty($mail)) {
       $mail_taken = (bool) db_select('users')
       ->fields('users', array('uid'))
-      ->condition('uid', (int) $account->uid, '<>')
+      ->condition('uid', (int) $account->id(), '<>')
       ->condition('mail', db_like($mail), 'LIKE')
       ->range(0, 1)
       ->execute()
@@ -284,7 +285,7 @@ public function validate(array $form, array &$form_state) {
 
       if ($mail_taken) {
         // Format error message dependent on whether the user is logged in or not.
-        if ($GLOBALS['user']->uid) {
+        if ($GLOBALS['user']->id()) {
           form_set_error('mail', t('The e-mail address %email is already taken.', array('%email' => $mail)));
         }
         else {
diff --git a/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
index bfaee91..2c47414 100644
--- a/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
+++ b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php
@@ -29,7 +29,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
     $path = $request->attributes->get('system_path');
     if ($site_status == MENU_SITE_OFFLINE) {
       // If the site is offline, log out unprivileged users.
-      if (user_is_logged_in() && !user_access('access site in maintenance mode')) {
+      if ($GLOBALS['user']->isAuthenticated() && !user_access('access site in maintenance mode')) {
         user_logout();
         // Redirect to homepage.
         $event->setResponse(new RedirectResponse(url('<front>', array('absolute' => TRUE))));
@@ -56,7 +56,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
         }
       }
     }
-    if (user_is_logged_in()) {
+    if ($GLOBALS['user']->isAuthenticated()) {
       if ($path == 'user/login') {
         // If user is logged in, redirect to 'user' instead of giving 403.
         $event->setResponse(new RedirectResponse(url('user', array('absolute' => TRUE))));
@@ -64,7 +64,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) {
       }
       if ($path == 'user/register') {
         // Authenticated user should be redirected to user edit page.
-        $event->setResponse(new RedirectResponse(url('user/' . $GLOBALS['user']->uid . '/edit', array('absolute' => TRUE))));
+        $event->setResponse(new RedirectResponse(url('user/' . $GLOBALS['user']->id() . '/edit', array('absolute' => TRUE))));
         return;
       }
     }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php b/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
index 58e9e37..9fab45f 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Action/CancelUser.php
@@ -61,7 +61,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc}
    */
   public function executeMultiple(array $entities) {
-    $this->tempStoreFactory->get('user_user_operations_cancel')->set($GLOBALS['user']->uid, $entities);
+    $this->tempStoreFactory->get('user_user_operations_cancel')->set($GLOBALS['user']->id(), $entities);
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php b/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
index 0c8aa2a..0bcc6e7 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
@@ -26,7 +26,7 @@ class UserLoginBlock extends BlockBase {
    * Overrides \Drupal\block\BlockBase::access().
    */
   public function access() {
-    return (!$GLOBALS['user']->uid && !(arg(0) == 'user' && !is_numeric(arg(1))));
+    return (!$GLOBALS['user']->id() && !(arg(0) == 'user' && !is_numeric(arg(1))));
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
index 1f55b49..56ae594 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php
@@ -50,249 +50,256 @@
  */
 class User extends EntityNG implements UserInterface {
 
-  /**
-   * The user ID.
+    /**
+   * The plain data values of the contained properties.
+   *
+   * Define default values.
    *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * @var array
    */
-  public $uid;
+  protected $values = array(
+    'langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))),
+    'preferred_langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))),
+    'admin_preferred_langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))),
+    'name' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => ''))),
+    'mail' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => ''))),
+    'init' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => ''))),
+    'access' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => 0))),
+    'login' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => 0))),
+    'status' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => 1))),
+  );
 
   /**
-   * The user UUID.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $uuid;
+  public function id() {
+    return $this->get('uid')->value;
+  }
 
   /**
-   * The unique user name.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $name;
+  public function getBCEntity() {
+    if (!isset($this->bcEntity)) {
+      // Initialize field definitions so that we can pass them by reference.
+      $this->getPropertyDefinitions();
+      $this->bcEntity = new UserBCDecorator($this, $this->fieldDefinitions);
+    }
+    return $this->bcEntity;
+  }
 
   /**
-   * The user's password (hashed).
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $pass;
+  public function getRoles() {
+    $roles = array();
+    foreach ($this->get('roles') as $role) {
+      $roles[] = $role->value;
+    }
+    return $roles;
+  }
 
   /**
-   * The user's email address.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $mail;
+  public function getSecureSessionId() {
+    return NULL;
+  }
 
   /**
-   * The user's default theme.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $theme;
+  public function getSessionData() {
+    return array();
+  }
 
   /**
-   * The user's signature.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $signature;
+  public function getSessionId() {
+    return NULL;
+  }
 
   /**
-   * The user's signature format.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $signature_format;
+  public function hasRole($rid) {
+    return in_array($rid, $this->getRoles());
+  }
 
   /**
-   * The timestamp when the user was created.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $created;
+  public function addRole($rid) {
+    $roles = $this->getRoles();
+    $roles[] = $rid;
+    $this->set('roles', array_unique($roles));
+  }
 
   /**
-   * The timestamp when the user last accessed the site. A value of 0 means the
-   * user has never accessed the site.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $access;
+  public function removeRole($rid) {
+    $this->set('roles', array_diff($this->getRoles(), array($rid)));
+  }
 
   /**
-   * The timestamp when the user last logged in. A value of 0 means the user has
-   * never logged in.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $login;
+  public function getPassword() {
+    return $this->get('pass')->value;
+  }
 
   /**
-   * Whether the user is active (1) or blocked (0).
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $status;
+  public function setPassword($password) {
+    $this->get('pass')->value = $password;
+  }
 
   /**
-   * The user's timezone.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $timezone;
+  public function getEmail() {
+    return $this->get('mail')->value;
+  }
 
   /**
-   * The user's langcode.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $langcode;
+  public function setEmail($mail) {
+    $this->get('mail')->value = $mail;
+  }
 
   /**
-   * The user's preferred langcode for receiving emails and viewing the site.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $preferred_langcode;
+  public function getDefaultTheme() {
+    return $this->get('theme')->value;
+  }
 
   /**
-   * The user's preferred langcode for viewing administration pages.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $preferred_admin_langcode;
+  public function getSignature() {
+    return $this->get('signature')->value;
+  }
 
   /**
-   * The email address used for initial account creation.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $init;
+  public function getSignatureFormat() {
+    return $this->get('signature_format')->value;
+  }
 
   /**
-   * The user's roles.
-   *
-   * @var \Drupal\Core\Entity\Field\FieldInterface
+   * {@inheritdoc}
    */
-  public $roles;
+  public function getCreatedTime() {
+    return $this->get('created')->value;
+  }
 
-    /**
-   * The plain data values of the contained properties.
-   *
-   * Define default values.
-   *
-   * @var array
+  /**
+   * {@inheritdoc}
    */
-  protected $values = array(
-    'langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))),
-    'preferred_langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))),
-    'admin_preffered_langcode' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => Language::LANGCODE_NOT_SPECIFIED))),
-    'name' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => ''))),
-    'mail' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => ''))),
-    'init' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => ''))),
-    'access' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => 0))),
-    'login' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => 0))),
-    'status' => array(Language::LANGCODE_DEFAULT => array(0 => array('value' => 1))),
-  );
+  public function getLastAccessedTime() {
+    return $this->get('access')->value;
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function id() {
-    return $this->get('uid')->value;
+  public function setLastAccessTime($timestamp) {
+    $this->get('access')->value = $timestamp;
   }
 
   /**
    * {@inheritdoc}
    */
-  protected function init() {
-    parent::init();
-    unset($this->access);
-    unset($this->created);
-    unset($this->init);
-    unset($this->login);
-    unset($this->mail);
-    unset($this->name);
-    unset($this->pass);
-    unset($this->preferred_admin_langcode);
-    unset($this->preferred_langcode);
-    unset($this->roles);
-    unset($this->signature);
-    unset($this->signature_format);
-    unset($this->status);
-    unset($this->theme);
-    unset($this->timezone);
-    unset($this->uid);
-    unset($this->uuid);
+  public function getLastLoginTime() {
+    return $this->get('login')->value;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getBCEntity() {
-    if (!isset($this->bcEntity)) {
-      // Initialize field definitions so that we can pass them by reference.
-      $this->getPropertyDefinitions();
-      $this->bcEntity = new UserBCDecorator($this, $this->fieldDefinitions);
-    }
-    return $this->bcEntity;
+  public function setLastLoginTime($timestamp) {
+    $this->get('login')->value = $timestamp;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getRoles() {
-    $roles = array();
-    foreach ($this->get('roles') as $role) {
-      $roles[] = $role->value;
-    }
-    return $roles;
+  public function isActive() {
+    return $this->get('status')->value == 1;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSecureSessionId() {
-    return NULL;
+  public function isBlocked() {
+    return $this->get('status')->value == 0;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSessionData() {
-    return array();
+  public function activate() {
+    $this->get('status')->value = 1;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getSessionId() {
-    return NULL;
+  public function block() {
+    $this->get('status')->value = 0;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function hasRole($rid) {
-    return in_array($rid, $this->getRoles());
+  public function getTimeZone() {
+    return $this->get('timezone')->value;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function addRole($rid) {
-    $roles = $this->getRoles();
-    $roles[] = $rid;
-    $this->set('roles', array_unique($roles));
+  function getPreferredLangcode($type = NULL, $default = NULL) {
+    $language_list = language_list();
+    if (isset($type)) {
+      $preferred_langcode = $this->get('preferred_' . $type . '_langcode')->value;
+    }
+    else {
+      $preferred_langcode = $this->get('preferred_langcode')->value;
+    }
+    if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) {
+      return $language_list[$preferred_langcode]->langcode;
+    }
+    else {
+      return $default ? $default : language_default()->langcode;
+    }
   }
 
   /**
    * {@inheritdoc}
    */
-  public function removeRole($rid) {
-    $this->set('roles', array_diff($this->getRoles(), array($rid)));
+  public function getInitialEmail() {
+    return $this->get('init')->value;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isAuthenticated() {
+    return $this->id() > 0;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isAnonymous() {
+    return $this->id() == 0;
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
index 8ed758e..8ffac71 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
@@ -26,7 +26,7 @@ class CurrentUser extends ArgumentDefaultPluginBase {
 
   public function getArgument() {
     global $user;
-    return $user->uid;
+    return $user->id();
   }
 
 }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
index 45c4c2a..d6beead 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
@@ -41,14 +41,14 @@ public function getArgument() {
     foreach (range(1, 3) as $i) {
       $user = menu_get_object('user', $i);
       if (!empty($user)) {
-        return $user->uid;
+        return $user->id();
       }
     }
 
     foreach (range(1, 3) as $i) {
       $user = menu_get_object('user_uid_optional', $i);
       if (!empty($user)) {
-        return $user->uid;
+        return $user->id();
       }
     }
 
@@ -56,7 +56,7 @@ public function getArgument() {
       foreach (range(1, 3) as $i) {
         $node = menu_get_object('node', $i);
         if (!empty($node)) {
-          return $node->uid;
+          return $node->id();
         }
       }
     }
@@ -69,7 +69,7 @@ public function getArgument() {
       if (arg(0) == 'node' && is_numeric(arg(1))) {
         $node = node_load(arg(1));
         if ($node) {
-          return $node->uid;
+          return $node->id();
         }
       }
     }
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 dc3b42b..07bee46 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
@@ -112,7 +112,7 @@ public function validateArgument($argument) {
     // However, is_integer() will always fail, since $argument is a string.
     if (is_numeric($argument) && $argument == (int)$argument) {
       if ($type == 'uid' || $type == 'either') {
-        if ($argument == $GLOBALS['user']->uid) {
+        if ($argument == $GLOBALS['user']->id()) {
           // If you assign an object to a variable in PHP, the variable
           // automatically acts as a reference, not a copy, so we use
           // clone to ensure that we don't actually mess with the
@@ -162,7 +162,7 @@ public function validateArgument($argument) {
       }
     }
 
-    $this->argument->argument = $account->uid;
+    $this->argument->argument = $account->id();
     $this->argument->validated_title = check_plain(user_format_name($account));
     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 d36f618..0e01ef9 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
@@ -79,7 +79,7 @@ function render_link($data, $values) {
     $account->uid = $this->getValue($values, 'uid');
     $account->name = $this->getValue($values);
     if (!empty($this->options['link_to_user']) || !empty($this->options['overwrite_anonymous'])) {
-      if (!empty($this->options['overwrite_anonymous']) && !$account->uid) {
+      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']);
       }
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php b/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
index b344857..5e272a1 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/filter/Name.php
@@ -155,7 +155,7 @@ public function adminSummary() {
     if ($this->value) {
       $result = entity_load_multiple_by_properties('user', array('uid' => $this->value));
       foreach ($result as $account) {
-        if ($account->uid) {
+        if ($account->id()) {
           $this->value_options[$account->id()] = $account->label();
         }
         else {
diff --git a/core/modules/user/lib/Drupal/user/ProfileFormController.php b/core/modules/user/lib/Drupal/user/ProfileFormController.php
index 484a4af..53b29b1 100644
--- a/core/modules/user/lib/Drupal/user/ProfileFormController.php
+++ b/core/modules/user/lib/Drupal/user/ProfileFormController.php
@@ -22,7 +22,7 @@ protected function actions(array $form, array &$form_state) {
     $element['delete']['#type'] = 'submit';
     $element['delete']['#value'] = t('Cancel account');
     $element['delete']['#submit'] = array('user_edit_cancel_submit');
-    $element['delete']['#access'] = $account->uid > 1 && (($account->uid == $GLOBALS['user']->uid && user_access('cancel account')) || user_access('administer users'));
+    $element['delete']['#access'] = $account->id() > 1 && (($account->id() == $GLOBALS['user']->id() && user_access('cancel account')) || user_access('administer users'));
 
     return $element;
   }
diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php
index ceecd65..fa6a4ca 100644
--- a/core/modules/user/lib/Drupal/user/RegisterFormController.php
+++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php
@@ -30,8 +30,8 @@ public function form(array $form, array &$form_state) {
     );
 
     // If we aren't admin but already logged on, go to the user page instead.
-    if (!$admin && $user->uid) {
-      drupal_goto('user/' . $user->uid);
+    if (!$admin && $user->id()) {
+      drupal_goto('user/' . $user->id());
     }
 
     $form['#attached']['library'][] = array('system', 'jquery.cookie');
@@ -103,9 +103,9 @@ public function save(array $form, array &$form_state) {
     $account->save();
 
     $form_state['user'] = $account;
-    $form_state['values']['uid'] = $account->uid;
+    $form_state['values']['uid'] = $account->id();
 
-    watchdog('user', 'New user: %name %email.', array('%name' => $form_state['values']['name'], '%email' => '<' . $form_state['values']['mail'] . '>'), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->uid . '/edit'));
+    watchdog('user', 'New user: %name %email.', array('%name' => $form_state['values']['name'], '%email' => '<' . $form_state['values']['mail'] . '>'), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->id() . '/edit'));
 
     // Add plain text password into user account to generate mail tokens.
     $account->password = $pass;
@@ -118,7 +118,7 @@ public function save(array $form, array &$form_state) {
     // No e-mail verification required; log in user immediately.
     elseif (!$admin && !config('user.settings')->get('verify_mail') && $account->status) {
       _user_mail_notify('register_no_approval_required', $account);
-      $form_state['uid'] = $account->uid;
+      $form_state['uid'] = $account->id();
       user_login_form_submit(array(), $form_state);
       drupal_set_message(t('Registration successful. You are now logged in.'));
       $form_state['redirect'] = '';
diff --git a/core/modules/user/lib/Drupal/user/TempStoreFactory.php b/core/modules/user/lib/Drupal/user/TempStoreFactory.php
index ddd1a75..e741048 100644
--- a/core/modules/user/lib/Drupal/user/TempStoreFactory.php
+++ b/core/modules/user/lib/Drupal/user/TempStoreFactory.php
@@ -61,7 +61,7 @@ function get($collection, $owner = NULL) {
     // Use the currently authenticated user ID or the active user ID unless
     // the owner is overridden.
     if (!isset($owner)) {
-      $owner = $GLOBALS['user']->uid ?: session_id();
+      $owner = $GLOBALS['user']->id() ?: session_id();
     }
 
     // Store the data for this collection in the database.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
index 234391d..719b449 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserAdminTest.php
@@ -45,7 +45,7 @@ function testUserAdmin() {
     $this->assertText($admin_user->name, 'Found Admin user on admin users page');
 
     // Test for existence of edit link in table.
-    $link = l(t('Edit'), "user/$user_a->uid/edit", array('query' => array('destination' => 'admin/people')));
+    $link = l(t('Edit'), "user/$user_a->id()/edit", array('query' => array('destination' => 'admin/people')));
     $this->assertRaw($link, 'Found user A edit link on admin users page');
 
     // Filter the users by permission 'administer taxonomy'.
@@ -67,13 +67,13 @@ function testUserAdmin() {
     $this->assertText($user_c->name, 'User C on filtered by role on admin users page');
 
     // Test blocking of a user.
-    $account = user_load($user_c->uid);
+    $account = user_load($user_c->id());
     $this->assertEqual($account->status, 1, 'User C not blocked');
     $edit = array();
     $edit['action'] = 'user_block_user_action';
     $edit['user_bulk_form[1]'] = TRUE;
     $this->drupalPost('admin/people', $edit, t('Apply'));
-    $account = user_load($user_c->uid, TRUE);
+    $account = user_load($user_c->id(), TRUE);
     $this->assertEqual($account->status, 0, 'User C blocked');
 
     // Test unblocking of a user from /admin/people page and sending of activation mail
@@ -81,18 +81,18 @@ function testUserAdmin() {
     $editunblock['action'] = 'user_unblock_user_action';
     $editunblock['user_bulk_form[1]'] = TRUE;
     $this->drupalPost('admin/people', $editunblock, t('Apply'));
-    $account = user_load($user_c->uid, TRUE);
+    $account = user_load($user_c->id(), TRUE);
     $this->assertEqual($account->status, 1, 'User C unblocked');
     $this->assertMail("to", $account->mail, "Activation mail sent to user C");
 
     // Test blocking and unblocking another user from /user/[uid]/edit form and sending of activation mail
     $user_d = $this->drupalCreateUser(array());
-    $account1 = user_load($user_d->uid, TRUE);
-    $this->drupalPost('user/' . $account1->uid . '/edit', array('status' => 0), t('Save'));
-    $account1 = user_load($user_d->uid, TRUE);
+    $account1 = user_load($user_d->id(), TRUE);
+    $this->drupalPost('user/' . $account1->id() . '/edit', array('status' => 0), t('Save'));
+    $account1 = user_load($user_d->id(), TRUE);
     $this->assertEqual($account1->status, 0, 'User D blocked');
-    $this->drupalPost('user/' . $account1->uid . '/edit', array('status' => TRUE), t('Save'));
-    $account1 = user_load($user_d->uid, TRUE);
+    $this->drupalPost('user/' . $account1->id() . '/edit', array('status' => TRUE), t('Save'));
+    $account1 = user_load($user_d->id(), TRUE);
     $this->assertEqual($account1->status, 1, 'User D unblocked');
     $this->assertMail("to", $account1->mail, "Activation mail sent to user D");
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php
index 052c254..ef05c7e 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserBlocksTests.php
@@ -73,7 +73,7 @@ function testUserLoginBlock() {
     $this->drupalLogout();
     $this->drupalPost('http://example.com/', $edit, t('Log in'), array('external' => FALSE));
     // Check that we remain on the site after login.
-    $this->assertEqual(url('user/' . $user->uid, array('absolute' => TRUE)), $this->getUrl(), 'Redirected to user profile page after login from the frontpage');
+    $this->assertEqual(url('user/' . $user->id(), array('absolute' => TRUE)), $this->getUrl(), 'Redirected to user profile page after login from the frontpage');
   }
 
   /**
@@ -89,14 +89,14 @@ function testWhosOnlineBlock() {
     $user3 = $this->drupalCreateUser(array());
 
     // Update access of two users to be within the active timespan.
-    $this->updateAccess($user1->uid);
-    $this->updateAccess($user2->uid, REQUEST_TIME + 1);
+    $this->updateAccess($user1->id());
+    $this->updateAccess($user2->id(), REQUEST_TIME + 1);
 
     // Insert an inactive user who should not be seen in the block, and ensure
     // that the admin user used in setUp() does not appear.
     $inactive_time = REQUEST_TIME - $config['seconds_online'] - 1;
-    $this->updateAccess($user3->uid, $inactive_time);
-    $this->updateAccess($this->adminUser->uid, $inactive_time);
+    $this->updateAccess($user3->id(), $inactive_time);
+    $this->updateAccess($this->adminUser->id(), $inactive_time);
 
     // Test block output.
     $content = entity_view($block, 'block');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
index 15e9912..d4794d7 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserCancelTest.php
@@ -39,25 +39,25 @@ function testUserCancelWithoutPermission() {
     $account = $this->drupalCreateUser(array());
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
 
     // Create a node.
-    $node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $node = $this->drupalCreateNode(array('uid' => $account->id()));
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->assertNoRaw(t('Cancel account'), 'No cancel account button displayed.');
 
     // Attempt bogus account cancellation request confirmation.
     $timestamp = $account->login;
-    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $this->drupalGet("user/$account->id()/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
     $this->assertResponse(403, 'Bogus cancelling request rejected.');
-    $account = user_load($account->uid);
+    $account = user_load($account->id());
     $this->assertTrue($account->status == 1, 'User account was not canceled.');
 
     // Confirm user's content has not been altered.
     $test_node = node_load($node->nid, TRUE);
-    $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), 'Node of the user has not been altered.');
+    $this->assertTrue(($test_node->uid == $account->id() && $test_node->status == 1), 'Node of the user has not been altered.');
   }
 
   /**
@@ -109,13 +109,13 @@ function testUserCancelInvalid() {
     $account = $this->drupalCreateUser(array('cancel account'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
 
     // Create a node.
-    $node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $node = $this->drupalCreateNode(array('uid' => $account->id()));
 
     // Attempt to cancel account.
-    $this->drupalPost('user/' . $account->uid . '/edit', NULL, t('Cancel account'));
+    $this->drupalPost('user/' . $account->id() . '/edit', NULL, t('Cancel account'));
 
     // Confirm account cancellation.
     $timestamp = time();
@@ -124,21 +124,21 @@ function testUserCancelInvalid() {
 
     // Attempt bogus account cancellation request confirmation.
     $bogus_timestamp = $timestamp + 60;
-    $this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
+    $this->drupalGet("user/$account->id()/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
     $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Bogus cancelling request rejected.');
-    $account = user_load($account->uid);
+    $account = user_load($account->id());
     $this->assertTrue($account->status == 1, 'User account was not canceled.');
 
     // Attempt expired account cancellation request confirmation.
     $bogus_timestamp = $timestamp - 86400 - 60;
-    $this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
+    $this->drupalGet("user/$account->id()/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
     $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Expired cancel account request rejected.');
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
     $this->assertTrue($account->status, 'User account was not canceled.');
 
     // Confirm user's content has not been altered.
     $test_node = node_load($node->nid, TRUE);
-    $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), 'Node of the user has not been altered.');
+    $this->assertTrue(($test_node->uid == $account->id() && $test_node->status == 1), 'Node of the user has not been altered.');
   }
 
   /**
@@ -152,10 +152,10 @@ function testUserBlock() {
     $this->drupalLogin($web_user);
 
     // Load real user object.
-    $account = user_load($web_user->uid, TRUE);
+    $account = user_load($web_user->id(), TRUE);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your user name.'), 'Informs that all content will be remain as is.');
@@ -168,8 +168,8 @@ function testUserBlock() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $account = user_load($account->uid, TRUE);
+    $this->drupalGet("user/$account->id()/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $account = user_load($account->id(), TRUE);
     $this->assertTrue($account->status == 0, 'User has been blocked.');
 
     // Confirm that the confirmation message made it through to the end user.
@@ -186,16 +186,16 @@ function testUserBlockUnpublish() {
     $account = $this->drupalCreateUser(array('cancel account'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
 
     // Create a node with two revisions.
-    $node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $node = $this->drupalCreateNode(array('uid' => $account->id()));
     $settings = get_object_vars($node);
     $settings['revision'] = 1;
     $node = $this->drupalCreateNode($settings);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), 'Informs that all content will be unpublished.');
@@ -206,8 +206,8 @@ function testUserBlockUnpublish() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $account = user_load($account->uid, TRUE);
+    $this->drupalGet("user/$account->id()/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $account = user_load($account->id(), TRUE);
     $this->assertTrue($account->status == 0, 'User has been blocked.');
 
     // Confirm user's content has been unpublished.
@@ -230,14 +230,14 @@ function testUserAnonymize() {
     $account = $this->drupalCreateUser(array('cancel account'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
 
     // Create a simple node.
-    $node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $node = $this->drupalCreateNode(array('uid' => $account->id()));
 
     // Create a node with two revisions, the initial one belonging to the
     // cancelling user.
-    $revision_node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $revision_node = $this->drupalCreateNode(array('uid' => $account->id()));
     $revision = $revision_node->vid;
     $settings = get_object_vars($revision_node);
     $settings['revision'] = 1;
@@ -245,7 +245,7 @@ function testUserAnonymize() {
     $revision_node = $this->drupalCreateNode($settings);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => config('user.settings')->get('anonymous'))), 'Informs that all content will be attributed to anonymous account.');
@@ -256,8 +256,8 @@ function testUserAnonymize() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.');
+    $this->drupalGet("user/$account->id()/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $this->assertFalse(user_load($account->id(), TRUE), 'User is not found in the database.');
 
     // Confirm that user's content has been attributed to anonymous user.
     $test_node = node_load($node->nid, TRUE);
@@ -283,10 +283,10 @@ function testUserDelete() {
     $account = $this->drupalCreateUser(array('cancel account', 'post comments', 'skip comment approval'));
     $this->drupalLogin($account);
     // Load real user object.
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
 
     // Create a simple node.
-    $node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $node = $this->drupalCreateNode(array('uid' => $account->id()));
 
     // Create comment.
     $langcode = Language::LANGCODE_NOT_SPECIFIED;
@@ -303,7 +303,7 @@ function testUserDelete() {
 
     // Create a node with two revisions, the initial one belonging to the
     // cancelling user.
-    $revision_node = $this->drupalCreateNode(array('uid' => $account->uid));
+    $revision_node = $this->drupalCreateNode(array('uid' => $account->id()));
     $revision = $revision_node->vid;
     $settings = get_object_vars($revision_node);
     $settings['revision'] = 1;
@@ -311,7 +311,7 @@ function testUserDelete() {
     $revision_node = $this->drupalCreateNode($settings);
 
     // Attempt to cancel account.
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), 'Informs that all content will be deleted.');
@@ -322,8 +322,8 @@ function testUserDelete() {
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
 
     // Confirm account cancellation request.
-    $this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
-    $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.');
+    $this->drupalGet("user/$account->id()/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
+    $this->assertFalse(user_load($account->id(), TRUE), 'User is not found in the database.');
 
     // Confirm that user's content has been deleted.
     $this->assertFalse(node_load($node->nid, TRUE), 'Node of the user has been deleted.');
@@ -349,7 +349,7 @@ function testUserCancelByAdmin() {
     $this->drupalLogin($admin_user);
 
     // Delete regular user.
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('Are you sure you want to cancel the account %name?', array('%name' => $account->name)), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
@@ -357,7 +357,7 @@ function testUserCancelByAdmin() {
     // Confirm deletion.
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), 'User deleted.');
-    $this->assertFalse(user_load($account->uid), 'User is not found in the database.');
+    $this->assertFalse(user_load($account->id()), 'User is not found in the database.');
   }
 
   /**
@@ -377,7 +377,7 @@ function testUserWithoutEmailCancelByAdmin() {
     $this->drupalLogin($admin_user);
 
     // Delete regular user without e-mail address.
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('Are you sure you want to cancel the account %name?', array('%name' => $account->name)), 'Confirmation form to cancel account displayed.');
     $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
@@ -385,7 +385,7 @@ function testUserWithoutEmailCancelByAdmin() {
     // Confirm deletion.
     $this->drupalPost(NULL, NULL, t('Cancel account'));
     $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), 'User deleted.');
-    $this->assertFalse(user_load($account->uid), 'User is not found in the database.');
+    $this->assertFalse(user_load($account->id()), 'User is not found in the database.');
   }
 
   /**
@@ -405,7 +405,7 @@ function testMassUserCancelByAdmin() {
     $users = array();
     for ($i = 0; $i < 3; $i++) {
       $account = $this->drupalCreateUser(array());
-      $users[$account->uid] = $account;
+      $users[$account->id()] = $account;
     }
 
     // Cancel user accounts, including own one.
@@ -425,13 +425,13 @@ function testMassUserCancelByAdmin() {
     $status = TRUE;
     foreach ($users as $account) {
       $status = $status && (strpos($this->content, t('%name has been deleted.', array('%name' => $account->name))) !== FALSE);
-      $status = $status && !user_load($account->uid, TRUE);
+      $status = $status && !user_load($account->id(), TRUE);
     }
     $this->assertTrue($status, 'Users deleted and not found in the database.');
 
     // Ensure that admin account was not cancelled.
     $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
-    $admin_user = user_load($admin_user->uid);
+    $admin_user = user_load($admin_user->id());
     $this->assertTrue($admin_user->status == 1, 'Administrative user is found in the database and enabled.');
 
     // Verify that uid 1's account was not cancelled.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php b/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php
index 2b9442d..5626096 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserDeleteTest.php
@@ -31,7 +31,7 @@ function testUserDeleteMultiple() {
     $user_b = $this->drupalCreateUser(array('access content'));
     $user_c = $this->drupalCreateUser(array('access content'));
 
-    $uids = array($user_a->uid, $user_b->uid, $user_c->uid);
+    $uids = array($user_a->id(), $user_b->id(), $user_c->id());
 
     // These users should have a role
     $query = db_select('users_roles', 'r');
@@ -44,7 +44,7 @@ function testUserDeleteMultiple() {
 
     $this->assertTrue($roles_created > 0, 'Role assigments created for new users and deletion of role assigments can be tested');
     // We should be able to load one of the users.
-    $this->assertTrue(user_load($user_a->uid), 'User is created and deltion of user can be tested');
+    $this->assertTrue(user_load($user_a->id()), 'User is created and deltion of user can be tested');
     // Delete the users.
     user_delete_multiple($uids);
     // Test if the roles assignments are deleted.
@@ -57,8 +57,8 @@ function testUserDeleteMultiple() {
       ->fetchField();
     $this->assertTrue($roles_after_deletion == 0, 'Role assigments deleted along with users');
     // Test if the users are deleted, user_load() will return FALSE.
-    $this->assertFalse(user_load($user_a->uid), format_string('User with id @uid deleted.', array('@uid' => $user_a->uid)));
-    $this->assertFalse(user_load($user_b->uid), format_string('User with id @uid deleted.', array('@uid' => $user_b->uid)));
-    $this->assertFalse(user_load($user_c->uid), format_string('User with id @uid deleted.', array('@uid' => $user_c->uid)));
+    $this->assertFalse(user_load($user_a->id()), format_string('User with id @uid deleted.', array('@uid' => $user_a->id())));
+    $this->assertFalse(user_load($user_b->id()), format_string('User with id @uid deleted.', array('@uid' => $user_b->id())));
+    $this->assertFalse(user_load($user_c->id()), format_string('User with id @uid deleted.', array('@uid' => $user_c->id())));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
index 178ddda..937da5a 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditTest.php
@@ -33,42 +33,42 @@ function testUserEdit() {
 
     // Test that error message appears when attempting to use a non-unique user name.
     $edit['name'] = $user2->name;
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertRaw(t('The name %name is already taken.', array('%name' => $edit['name'])));
 
     // Check that filling out a single password field does not validate.
     $edit = array();
     $edit['pass[pass1]'] = '';
     $edit['pass[pass2]'] = $this->randomName();
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
 
     $edit['pass[pass1]'] = $this->randomName();
     $edit['pass[pass2]'] = '';
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
 
     // Test that the error message appears when attempting to change the mail or
     // pass without the current password.
     $edit = array();
     $edit['mail'] = $this->randomName() . '@new.example.com';
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertRaw(t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => t('E-mail address'))));
 
     $edit['current_pass'] = $user1->pass_raw;
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertRaw(t("The changes have been saved."));
 
     // Test that the user must enter current password before changing passwords.
     $edit = array();
     $edit['pass[pass1]'] = $new_pass = $this->randomName();
     $edit['pass[pass2]'] = $new_pass;
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertRaw(t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => t('Password'))));
 
     // Try again with the current password.
     $edit['current_pass'] = $user1->pass_raw;
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertRaw(t("The changes have been saved."));
 
     // Make sure the user can log in with their new password.
@@ -82,11 +82,11 @@ function testUserEdit() {
     $this->drupalLogin($user1);
 
     $config->set('password_strength', TRUE)->save();
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertRaw(t('Password strength:'), 'The password strength indicator is displayed.');
 
     $config->set('password_strength', FALSE)->save();
-    $this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", $edit, t('Save'));
     $this->assertNoRaw(t('Password strength:'), 'The password strength indicator is not displayed.');
   }
 
@@ -102,7 +102,7 @@ function testUserWithoutEmailEdit() {
     // This user has no e-mail address.
     $user1->mail = '';
     $user1->save();
-    $this->drupalPost("user/$user1->uid/edit", array('mail' => ''), t('Save'));
+    $this->drupalPost("user/$user1->id()/edit", array('mail' => ''), t('Save'));
     $this->assertRaw(t("The changes have been saved."));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
index e06298f..6bdb9d0 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEditedOwnAccountTest.php
@@ -34,7 +34,7 @@ function testUserEditedOwnAccount() {
     // Change own username.
     $edit = array();
     $edit['name'] = $this->randomName();
-    $this->drupalPost('user/' . $account->uid . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $account->id() . '/edit', $edit, t('Save'));
 
     // Log out.
     $this->drupalLogout();
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
index 13f6489..eb6f1c3 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserEntityCallbacksTest.php
@@ -53,6 +53,6 @@ function testLabelCallback() {
    */
   function testUriCallback() {
     $uri = $this->account->uri();
-    $this->assertEqual('user/' . $this->account->uid, $uri['path'], 'Correct user URI.');
+    $this->assertEqual('user/' . $this->account->id(), $uri['path'], 'Correct user URI.');
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
index 65e3c24..c89dd26 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageCreationTest.php
@@ -94,7 +94,7 @@ function testLocalUserCreation() {
 
     // Test if the admin can use the language selector and if the
     // correct language is was saved.
-    $user_edit = $langcode . '/user/' . $user->uid . '/edit';
+    $user_edit = $langcode . '/user/' . $user->id() . '/edit';
 
     $this->drupalLogin($admin_user);
     $this->drupalGet($user_edit);
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
index 407bd22..e2adf72 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLanguageTest.php
@@ -57,7 +57,7 @@ function testUserLanguageConfiguration() {
 
     // Login as normal user and edit account settings.
     $this->drupalLogin($web_user);
-    $path = 'user/' . $web_user->uid . '/edit';
+    $path = 'user/' . $web_user->id() . '/edit';
     $this->drupalGet($path);
     // Ensure language settings widget is available.
     $this->assertText(t('Language'), 'Language selector available.');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
index 36c5f47..4dd289b 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserLoginTest.php
@@ -115,7 +115,7 @@ function testPasswordRehashOnLogin() {
     $this->drupalLogin($account);
     $this->drupalLogout();
     // Load the stored user. The password hash should reflect $default_count_log2.
-    $account = user_load($account->uid);
+    $account = user_load($account->id());
     $this->assertIdentical($password_hasher->getCountLog2($account->pass), $default_count_log2);
 
     // Change the required number of iterations by loading a test-module
@@ -127,7 +127,7 @@ function testPasswordRehashOnLogin() {
     $account->pass_raw = $password;
     $this->drupalLogin($account);
     // Load the stored user, which should have a different password hash now.
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
     $this->assertIdentical($password_hasher->getCountLog2($account->pass), $overridden_count_log2);
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
index 68c28bb..9b53426 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPasswordResetTest.php
@@ -37,7 +37,7 @@ public function setUp() {
     // Activate user by logging in.
     $this->drupalLogin($account);
 
-    $this->account = user_load($account->uid);
+    $this->account = user_load($account->id());
     $this->drupalLogout();
   }
 
@@ -91,7 +91,7 @@ function testUserPasswordReset() {
     // Create a password reset link as if the request time was 60 seconds older than the allowed limit.
     $timeout = config('user.settings')->get('password_reset_timeout');
     $bogus_timestamp = REQUEST_TIME - $timeout - 60;
-    $_uid = $this->account->uid;
+    $_uid = $this->account->id();
     $this->drupalGet("user/reset/$_uid/$bogus_timestamp/" . user_pass_rehash($this->account->pass, $bogus_timestamp, $this->account->login));
     $this->assertText(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.');
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
index 633e0cf..34ec873 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
@@ -65,7 +65,7 @@ function testCreateDeletePicture() {
 
     // Delete the picture.
     $edit = array();
-    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Remove'));
+    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Remove'));
     $this->drupalPost(NULL, array(), t('Save'));
 
     // Call system_cron() to clean up the file. Make sure the timestamp
@@ -131,10 +131,10 @@ function testPictureOnNodeComment() {
    */
   function saveUserPicture($image) {
     $edit = array('files[user_picture_und_0]' => drupal_realpath($image->uri));
-    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
 
     // Load actual user data from database.
-    $account = user_load($this->web_user->uid, TRUE);
+    $account = user_load($this->web_user->id(), TRUE);
     return file_load($account->user_picture[Language::LANGCODE_NOT_SPECIFIED][0]['fid'], TRUE);
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
index e612374..e6e37dc 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserRolesAssignmentTest.php
@@ -38,13 +38,13 @@ function testAssignAndRemoveRole()  {
     $account = $this->drupalCreateUser();
 
     // Assign the role to the user.
-    $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => $rid), t('Save'));
+    $this->drupalPost('user/' . $account->id() . '/edit', array("roles[$rid]" => $rid), t('Save'));
     $this->assertText(t('The changes have been saved.'));
     $this->assertFieldChecked('edit-roles-' . $rid, 'Role is assigned.');
     $this->userLoadAndCheckRoleAssigned($account, $rid);
 
     // Remove the role from the user.
-    $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
+    $this->drupalPost('user/' . $account->id() . '/edit', array("roles[$rid]" => FALSE), t('Save'));
     $this->assertText(t('The changes have been saved.'));
     $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
@@ -69,12 +69,12 @@ function testCreateUserWithRole() {
     // Get the newly added user.
     $account = user_load_by_name($edit['name']);
 
-    $this->drupalGet('user/' . $account->uid . '/edit');
+    $this->drupalGet('user/' . $account->id() . '/edit');
     $this->assertFieldChecked('edit-roles-' . $rid, 'Role is assigned.');
     $this->userLoadAndCheckRoleAssigned($account, $rid);
 
     // Remove the role again.
-    $this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
+    $this->drupalPost('user/' . $account->id() . '/edit', array("roles[$rid]" => FALSE), t('Save'));
     $this->assertText(t('The changes have been saved.'));
     $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
     $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
@@ -92,7 +92,7 @@ function testCreateUserWithRole() {
    *   Defaults to TRUE.
    */
   private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) {
-    $account = user_load($account->uid, TRUE);
+    $account = user_load($account->id(), TRUE);
     if ($is_assigned) {
       $this->assertTrue(array_search($rid, $account->roles), 'The role is present in the user object.');
     }
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
index 85925e7..a83a8ca 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserSignatureTest.php
@@ -95,7 +95,7 @@ function testUserSignature() {
     $edit = array(
       'signature[value]' => $signature_text,
     );
-    $this->drupalPost('user/' . $this->web_user->uid . '/edit', $edit, t('Save'));
+    $this->drupalPost('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
 
     // Verify that values were stored.
     $this->assertFieldByName('signature[value]', $edit['signature[value]'], 'Submitted signature text found.');
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php
index 8b77915..c44f81d 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTimeZoneTest.php
@@ -60,7 +60,7 @@ function testUserTimeZone() {
     $edit = array();
     $edit['mail'] = $web_user->mail;
     $edit['timezone'] = 'America/Santiago';
-    $this->drupalPost("user/$web_user->uid/edit", $edit, t('Save'));
+    $this->drupalPost("user/$web_user->id()/edit", $edit, t('Save'));
     $this->assertText(t('The changes have been saved.'), 'Time zone changed to Santiago time.');
 
     // Confirm date format and time zone.
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
index 71d4a78..3deea5a 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserTokenReplaceTest.php
@@ -56,16 +56,16 @@ function testUserTokenReplacement() {
     $this->drupalLogout();
     $this->drupalLogin($user2);
 
-    $account = user_load($user1->uid);
-    $global_account = user_load($GLOBALS['user']->uid);
+    $account = user_load($user1->id());
+    $global_account = user_load($GLOBALS['user']->id());
 
     // Generate and test sanitized tokens.
     $tests = array();
-    $tests['[user:uid]'] = $account->uid;
+    $tests['[user:uid]'] = $account->id();
     $tests['[user:name]'] = check_plain(user_format_name($account));
     $tests['[user:mail]'] = check_plain($account->mail);
-    $tests['[user:url]'] = url("user/$account->uid", $url_options);
-    $tests['[user:edit-url]'] = url("user/$account->uid/edit", $url_options);
+    $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->login, 'medium', '', NULL, $language_interface->langcode);
     $tests['[user:last-login:short]'] = format_date($account->login, 'short', '', NULL, $language_interface->langcode);
     $tests['[user:created]'] = format_date($account->created, 'medium', '', NULL, $language_interface->langcode);
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php b/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php
index 56dbc62..8379bbe 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserValidateCurrentPassCustomFormTest.php
@@ -57,7 +57,7 @@ function testUserValidateCurrentPassCustomForm() {
     $edit = array();
     $edit['user_form_test_field'] = $this->accessUser->name;
     $edit['current_pass'] = $this->accessUser->pass_raw;
-    $this->drupalPost('user_form_test_current_password/' . $this->accessUser->uid, $edit, t('Test'));
+    $this->drupalPost('user_form_test_current_password/' . $this->accessUser->id(), $edit, t('Test'));
     $this->assertText(t('The password has been validated and the form submitted successfully.'));
   }
 }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
index 970e1c3..654d1d7 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentDefaultTest.php
@@ -41,7 +41,7 @@ public function test_plugin_argument_default_current_user() {
     $view = views_get_view('test_plugin_argument_default_current_user');
     $view->initHandlers();
 
-    $this->assertEqual($view->argument['null']->getDefaultArgument(), $account->uid, 'Uid of the current user is used.');
+    $this->assertEqual($view->argument['null']->getDefaultArgument(), $account->id(), 'Uid of the current user is used.');
     // Switch back.
     $user = $admin;
     drupal_save_session(TRUE);
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
index 0d89d47..6a1145e 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/ArgumentValidateTest.php
@@ -37,7 +37,7 @@ function testArgumentValidateUserUid() {
     $account = $this->account;
     // test 'uid' case
     $view = $this->view_argument_validate_user('uid');
-    $this->assertTrue($view->argument['null']->validateArgument($account->uid));
+    $this->assertTrue($view->argument['null']->validateArgument($account->id()));
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a string variable since type is 'uid'
@@ -56,7 +56,7 @@ function testArgumentValidateUserName() {
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a uid variable since type is 'name'
-    $this->assertFalse($view->argument['null']->validateArgument($account->uid));
+    $this->assertFalse($view->argument['null']->validateArgument($account->id()));
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a valid string, but for a user that doesn't exist
@@ -71,7 +71,7 @@ function testArgumentValidateUserEither() {
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a uid variable since type is 'name'
-    $this->assertTrue($view->argument['null']->validateArgument($account->uid));
+    $this->assertTrue($view->argument['null']->validateArgument($account->id()));
     // Reset safed argument validation.
     $view->argument['null']->argument_validated = NULL;
     // Fail for a valid string, but for a user that doesn't exist
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php
index 24be6f8..db9c51f 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerArgumentUserUidTest.php
@@ -40,7 +40,7 @@ public function testArgumentTitle() {
 
     // Tests a valid user.
     $account = $this->drupalCreateUser();
-    $this->executeView($view, array($account->uid));
+    $this->executeView($view, array($account->id()));
     $this->assertEqual($view->getTitle(), $account->label());
     $view->destroy();
   }
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
index 4e9b95a..45f77b3 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/HandlerFilterUserNameTest.php
@@ -172,7 +172,7 @@ public function testExposedFilter() {
     $this->assertNoRaw('Unable to find user');
     // The actual result should contain all of the user ids.
     foreach ($this->accounts as $account) {
-      $this->assertRaw($account->uid);
+      $this->assertRaw($account->id());
     }
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php b/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php
index 34a0d83..c2b3a30 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/RelationshipRepresentativeNode.php
@@ -36,11 +36,11 @@ public function testRelationship() {
     $map = array('node_users_nid' => 'nid', 'uid' => 'uid');
     $expected_result = array(
       array(
-        'uid' => $this->users[1]->uid,
+        'uid' => $this->users[1]->id(),
         'nid' => $this->nodes[1]->nid,
       ),
       array(
-        'uid' => $this->users[0]->uid,
+        'uid' => $this->users[0]->id(),
         'nid' => $this->nodes[0]->nid,
       ),
     );
diff --git a/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php b/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php
index 6ea9454..88b1c78 100644
--- a/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php
+++ b/core/modules/user/lib/Drupal/user/Tests/Views/UserTestBase.php
@@ -43,7 +43,7 @@ protected function setUp() {
 
     $this->users[] = $this->drupalCreateUser();
     $this->users[] = user_load(1);
-    $this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->uid));
+    $this->nodes[] = $this->drupalCreateNode(array('uid' => $this->users[0]->id()));
     $this->nodes[] = $this->drupalCreateNode(array('uid' => 1));
   }
 
diff --git a/core/modules/user/lib/Drupal/user/UserBCDecorator.php b/core/modules/user/lib/Drupal/user/UserBCDecorator.php
index f75da09..551c232 100644
--- a/core/modules/user/lib/Drupal/user/UserBCDecorator.php
+++ b/core/modules/user/lib/Drupal/user/UserBCDecorator.php
@@ -15,6 +15,12 @@
 class UserBCDecorator extends EntityBCDecorator implements UserInterface {
 
   /**
+   *
+   * @var \Drupal\user\UserInterface
+   */
+  protected $decorated;
+
+  /**
    * {@inheritdoc}
    */
   public function &__get($name) {
@@ -76,4 +82,151 @@ public function removeRole($rid) {
     $this->getBCEntity()->removeRole($rid);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getPassword() {
+    return $this->decorated->getPassword();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setPassword($password) {
+    $this->decorated->setPassword($password);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getEmail() {
+    return $this->decorated->getEmail();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setEmail($mail) {
+    $this->decorated->setEmail($mail);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDefaultTheme() {
+    return $this->decorated->getDefaultTheme();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getSignature() {
+    return $this->decorated->getDefaultTheme();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getSignatureFormat() {
+    return $this->decorated->getSignatureFormat();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCreatedTime() {
+    return $this->decorated->getCreatedTime();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getLastAccessedTime() {
+    return $this->decorated->getLastAccessedTime();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setLastAccessTime($timestamp) {
+    $this->decorated->setLastAccessTime($timestamp);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getLastLoginTime() {
+    return $this->decorated->getLastLoginTime();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setLastLoginTime($timestamp) {
+    $this->decorated->setLastLoginTime($timestamp);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isActive() {
+    $this->decorated->isActive();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isBlocked() {
+    return $this->decorated->isBlocked();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function activate() {
+    $this->decorated->activate();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function block() {
+    $this->decorated->block();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getTimeZone() {
+    return $this->decorated->getTimeZone();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getPreferredLangcode($type = NULL, $default = NULL) {
+    return $this->decorated->getPreferredLangcode();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getInitialEmail() {
+    return $this->decorated->getInitialEmail();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isAuthenticated() {
+    return $this->decorated->id() > 0;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isAnonymous() {
+    return $this->decorated->id() == 0;
+  }
+
 }
diff --git a/core/modules/user/lib/Drupal/user/UserInterface.php b/core/modules/user/lib/Drupal/user/UserInterface.php
index 4dc1481..59a13a8 100644
--- a/core/modules/user/lib/Drupal/user/UserInterface.php
+++ b/core/modules/user/lib/Drupal/user/UserInterface.php
@@ -50,4 +50,163 @@ public function addRole($rid);
    */
   public function removeRole($rid);
 
+  /**
+   * Returns the hashed password.
+   *
+   * @return string
+   *   The hashed password.
+   */
+  public function getPassword();
+
+  /**
+   * Sets the user password.
+   *
+   * @param string $password
+   *   The new unhashed password.
+   */
+  public function setPassword($password);
+
+  /**
+   * Returns the e-mail address of the user.
+   *
+   * @return string
+   *   The e-mail address.
+   */
+  public function getEmail();
+
+  /**
+   * Sets the e-mail address of the user.
+   *
+   * @param string $mail
+   *   The new e-mail address of the user.
+   */
+  public function setEmail($mail);
+
+  /**
+   * Returns the default theme of the user.
+   *
+   * @return string
+   *   Name of the theme.
+   */
+  public function getDefaultTheme();
+
+  /**
+   * Returns the user signature.
+   *
+   * @todo: Convert this to a field.
+   *
+   * @return string
+   *   The signature text.
+   */
+  public function getSignature();
+
+  /**
+   * Returns the signature format.
+   *
+   * @return string
+   *   Name of the filter format.
+   */
+  public function getSignatureFormat();
+
+  /**
+   * Returns the creation time of the user as a UNIX timestamp.
+   *
+   * @return int
+   *   Timestamp of the creation date.
+   *
+   */
+  public function getCreatedTime();
+
+  /**
+   * The timestamp when the user last accessed the site.
+   *
+   * A value of 0 means the user has never accessed the site.
+   *
+   * @return int
+   *   Timestamp of the last access.
+   */
+  public function getLastAccessedTime();
+
+  /**
+   * Sets the UNIX timestamp when the user last accessed the site..
+   *
+   * @param int $timestamp
+   *   Timestamp of the last access.
+   */
+  public function setLastAccessTime($timestamp);
+
+  /**
+   * Returns the UNIX timestamp when the user last logged in.
+   *
+   * @return int
+   *   Timestamp of the last login time.
+   */
+  public function getLastLoginTime();
+
+  /**
+   * Sets the UNIX timestamp when the user last logged in.
+   *
+   * @param int $timestamp
+   *   Timestamp of the last login time.
+   */
+  public function setLastLoginTime($timestamp);
+
+  /**
+   * Returns TRUE if the user is active.
+   *
+   * @return bool
+   *   TRUE if the user is active, false otherwise.
+   */
+  public function isActive();
+
+  /**
+   * Returns TRUE if the user is blocked.
+   *
+   * @return bool
+   *   TRUE if the user is blocked, false otherwise.
+   */
+  public function isBlocked();
+
+  /**
+   * Activates the user.
+   */
+  public function activate();
+
+  /**
+   * Blocks the user.
+   */
+  public function block();
+
+  /**
+   * Returns the timezone of the user.
+   *
+   * @return string
+   *   Name of the timezone.
+   */
+  public function getTimeZone();
+
+  /**
+   * Returns the preferred language code of the user.
+   *
+   * @param $type
+   *   Optional string to define which preferred langcode should be used.
+   *   Default to 'preferred_langcode' property.
+   *   If set 'preferred_$type_langcode' is used.
+   * @param $default
+   *   Optional default language code to return if the account
+   *   has no valid language.
+   *
+   * @return string
+   *   The language code that is preferred by the user.
+   */
+  public function getPreferredLangcode($type = NULL, $default = NULL);
+
+  /**
+   * Returns the e-mail that was used when the user was registered.
+   *
+   * @return string
+   *   Initial e-mail address of the user.
+   */
+  public function getInitialEmail();
+
 }
diff --git a/core/modules/user/lib/Drupal/user/UserStorageController.php b/core/modules/user/lib/Drupal/user/UserStorageController.php
index c8d40fd..9178677 100644
--- a/core/modules/user/lib/Drupal/user/UserStorageController.php
+++ b/core/modules/user/lib/Drupal/user/UserStorageController.php
@@ -165,7 +165,7 @@ protected function postSave(EntityInterface $entity, $update) {
       // user and recreate the current one.
       if ($entity->pass->value != $entity->original->pass->value) {
         drupal_session_destroy_uid($entity->id());
-        if ($entity->id() == $GLOBALS['user']->uid) {
+        if ($entity->id() == $GLOBALS['user']->id()) {
           drupal_session_regenerate();
         }
       }
diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc
index 95a0382..d2982f8 100644
--- a/core/modules/user/user.admin.inc
+++ b/core/modules/user/user.admin.inc
@@ -42,13 +42,13 @@ function user_admin_account() {
   foreach ($result as $account) {
     $account = user_load($account->uid);
     $users_roles = array();
-    $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => $account->uid));
+    $roles_result = db_query('SELECT rid FROM {users_roles} WHERE uid = :uid', array(':uid' => $account->id()));
     foreach ($roles_result as $user_role) {
       $users_roles[] = $roles[$user_role->rid];
     }
     asort($users_roles);
 
-    $options[$account->uid] = array(
+    $options[$account->id()] = array(
       'username' => theme('username', array('account' => $account)),
       'status' =>  $status[$account->status],
       'roles' => theme('item_list', array('items' => $users_roles)),
@@ -58,22 +58,22 @@ function user_admin_account() {
     $links = array();
     $links['edit'] = array(
       'title' => t('Edit'),
-      'href' => 'user/' . $account->uid . '/edit',
+      'href' => 'user/' . $account->id() . '/edit',
       'query' => $destination,
     );
     if (module_invoke('translation_entity', 'translate_access', $account)) {
       $links['translate'] = array(
         'title' => t('Translate'),
-        'href' => 'user/' . $account->uid . '/translations',
+        'href' => 'user/' . $account->id() . '/translations',
         'query' => $destination,
       );
     }
-    $options[$account->uid]['operations']['data'] = array(
+    $options[$account->id()]['operations']['data'] = array(
       '#type' => 'operations',
       '#links' => $links,
     );
 
-    $options[$account->uid]['title']['data']['#title'] = check_plain($account->name);
+    $options[$account->id()]['title']['data']['#title'] = check_plain($account->name);
 
   }
 
diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php
index 2f337d9..435bb96 100644
--- a/core/modules/user/user.api.php
+++ b/core/modules/user/user.api.php
@@ -65,7 +65,7 @@ function hook_user_load($users) {
  */
 function hook_user_predelete($account) {
   db_delete('mytable')
-    ->condition('uid', $account->uid)
+    ->condition('uid', $account->id())
     ->execute();
 }
 
@@ -121,7 +121,7 @@ function hook_user_cancel($edit, $account, $method) {
       module_load_include('inc', 'node', 'node.admin');
       $nodes = db_select('node_field_data', 'n')
         ->fields('n', array('nid'))
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('status' => 0), NULL, TRUE);
@@ -132,14 +132,14 @@ function hook_user_cancel($edit, $account, $method) {
       module_load_include('inc', 'node', 'node.admin');
       $nodes = db_select('node_field_data', 'n')
         ->fields('n', array('nid'))
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute()
         ->fetchCol();
       node_mass_update($nodes, array('uid' => 0), NULL, TRUE);
       // Anonymize old revisions.
       db_update('node_field_revision')
         ->fields(array('uid' => 0))
-        ->condition('uid', $account->uid)
+        ->condition('uid', $account->id())
         ->execute();
       break;
   }
@@ -200,8 +200,9 @@ function hook_user_cancel_methods_alter(&$methods) {
  */
 function hook_user_format_name_alter(&$name, $account) {
   // Display the user's uid instead of name.
-  if (isset($account->uid)) {
-    $name = t('User !uid', array('!uid' => $account->uid));
+  $uid = $account->id();
+  if (isset($uid)) {
+    $name = t('User !uid', array('!uid' => $uid));
   }
 }
 
@@ -244,7 +245,7 @@ function hook_user_presave($account) {
 function hook_user_insert($account) {
   db_insert('user_changes')
     ->fields(array(
-      'uid' => $account->uid,
+      'uid' => $account->id(),
       'created' => time(),
     ))
     ->execute();
@@ -271,7 +272,7 @@ function hook_user_insert($account) {
 function hook_user_update($account) {
   db_insert('user_changes')
     ->fields(array(
-      'uid' => $account->uid,
+      'uid' => $account->id(),
       'changed' => time(),
     ))
     ->execute();
@@ -287,7 +288,7 @@ function hook_user_login($account) {
   $config = config('system.timezone');
   // If the user has a NULL time zone, notify them to set a time zone.
   if (!$account->timezone && $config->get('user.configurable') && $config->get('user.warn')) {
-    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->uid/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
+    drupal_set_message(t('Configure your <a href="@user-edit">account time zone setting</a>.', array('@user-edit' => url("user/$account->id()/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone')))));
   }
 }
 
@@ -300,7 +301,7 @@ function hook_user_login($account) {
 function hook_user_logout($account) {
   db_insert('logouts')
     ->fields(array(
-      'uid' => $account->uid,
+      'uid' => $account->id(),
       'time' => time(),
     ))
     ->execute();
diff --git a/core/modules/user/user.install b/core/modules/user/user.install
index 69d96b6..ece0c85 100644
--- a/core/modules/user/user.install
+++ b/core/modules/user/user.install
@@ -696,7 +696,7 @@ function user_update_8011() {
         'uri' => $destination,
       ))
       ->fields(array(
-        'uid' => $user->uid,
+        'uid' => $user->id(),
         'status' => FILE_STATUS_PERMANENT,
         'filename' => drupal_basename($destination),
         'uuid' => $uuid->generate(),
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index c60e823..4193e6b 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -410,7 +410,8 @@ function user_password($length = 10) {
  * Determine the permissions for one or more roles.
  *
  * @param $roles
- *   An array whose values are the role IDs of interest, such as $user->roles.
+ *   An array whose values are the role IDs of interest, such as
+ *   \Drupal\Core\Session\AccountInterface::getRoles().
  *
  * @return
  *   An array indexed by role ID. Each value is an array whose keys are the
@@ -472,11 +473,8 @@ function user_access($string, AccountInterface $account = NULL) {
     $account = $user;
   }
 
-  // Make sure we are working with the BC decorator.
-  $account = $account instanceof User ? $account->getBCEntity() : $account;
-
   // User #1 has all privileges:
-  if ($account->uid == 1) {
+  if ($account->id() == 1) {
     return TRUE;
   }
 
@@ -488,17 +486,17 @@ function user_access($string, AccountInterface $account = NULL) {
     $drupal_static_fast['perm'] = &drupal_static(__FUNCTION__);
   }
   $perm = &$drupal_static_fast['perm'];
-  if (!isset($perm[$account->uid])) {
+  if (!isset($perm[$account->id()])) {
     $role_permissions = user_role_permissions($account->getRoles());
 
     $perms = array();
     foreach ($role_permissions as $one_role) {
       $perms += $one_role;
     }
-    $perm[$account->uid] = $perms;
+    $perm[$account->id()] = $perms;
   }
 
-  return isset($perm[$account->uid][$string]);
+  return isset($perm[$account->id()][$string]);
 }
 
 /**
@@ -599,10 +597,10 @@ function user_search_execute($keys = NULL, $conditions = NULL) {
   foreach ($accounts as $account) {
     $result = array(
       'title' => user_format_name($account),
-      'link' => url('user/' . $account->uid, array('absolute' => TRUE)),
+      'link' => url('user/' . $account->id(), array('absolute' => TRUE)),
     );
     if (user_access('administer users')) {
-      $result['title'] .= ' (' . $account->mail . ')';
+      $result['title'] .= ' (' . $account->getEmail() . ')';
     }
     $results[] = $result;
   }
@@ -720,7 +718,7 @@ function user_template_preprocess_default_variables_alter(&$variables) {
   unset($variables['user']->pass, $variables['user']->sid, $variables['user']->ssid);
 
   $variables['is_admin'] = user_access('access administration pages');
-  $variables['logged_in'] = ($user->uid > 0);
+  $variables['logged_in'] = $user->isAuthenticated();
 }
 
 /**
@@ -739,14 +737,16 @@ function template_preprocess_username(&$variables) {
   }
 
   $variables['extra'] = '';
-  if (empty($account->uid)) {
-   $variables['uid'] = 0;
-   if (theme_get_setting('features.comment_user_verification')) {
-     $variables['extra'] = ' (' . t('not verified') . ')';
-   }
+  $variables['attributes'] = array();
+  $uid = empty($account) ? 0 : $account->id();
+  if (empty($uid)) {
+    $variables['uid'] = 0;
+    if (theme_get_setting('features.comment_user_verification')) {
+      $variables['extra'] = ' (' . t('not verified') . ')';
+    }
   }
   else {
-    $variables['uid'] = (int) $account->uid;
+    $variables['uid'] = (int) $uid;
   }
 
   // Set the name to a formatted name that is safe for printing and
@@ -823,7 +823,7 @@ function theme_username($variables) {
  */
 function user_is_anonymous() {
   // Menu administrators can see items for anonymous when administering.
-  return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']);
+  return $GLOBALS['user']->isAnonymous() || !empty($GLOBALS['menu_admin']);
 }
 
 /**
@@ -831,9 +831,11 @@ function user_is_anonymous() {
  *
  * @return bool
  *   TRUE if the user is logged in, FALSE if the user is anonymous.
+ *
+ * @deprecated Use \Drupal\Core\Session\UserSession::isAuthenticated().
  */
 function user_is_logged_in() {
-  return (bool) $GLOBALS['user']->uid;
+  return $GLOBALS['user']->isAuthenticated();
 }
 
 /**
@@ -1062,7 +1064,7 @@ function user_menu_breadcrumb_alter(&$active_trail, $item) {
 function user_menu_link_load($menu_links) {
   // Hide the "User account" link for anonymous users.
   foreach ($menu_links as $link) {
-    if ($link['link_path'] == 'user' && $link['module'] == 'system' && !$GLOBALS['user']->uid) {
+    if ($link['link_path'] == 'user' && $link['module'] == 'system' && !$GLOBALS['user']->id()) {
       $link['hidden'] = 1;
     }
   }
@@ -1108,7 +1110,7 @@ function user_uid_only_optional_to_arg($arg) {
  */
 function user_uid_optional_load($uid = NULL) {
   if (!isset($uid)) {
-    $uid = $GLOBALS['user']->uid;
+    $uid = $GLOBALS['user']->id();
   }
   return user_load($uid);
 }
@@ -1122,7 +1124,7 @@ function user_uid_optional_to_arg($arg) {
   // Give back the current user uid when called from eg. tracker, aka.
   // with an empty arg. Also use the current user uid when called from
   // the menu with a % for the current account link.
-  return empty($arg) || $arg == '%' ? $GLOBALS['user']->uid : $arg;
+  return empty($arg) || $arg == '%' ? $GLOBALS['user']->id() : $arg;
 }
 
 /**
@@ -1132,7 +1134,7 @@ function user_uid_optional_to_arg($arg) {
  * authenticated users are expected to see "My account".
  */
 function user_menu_title() {
-  if (!user_is_logged_in()) {
+  if ($GLOBALS['user']->isAnonymous()) {
     switch (current_path()) {
       case 'user' :
       case 'user/login' :
@@ -1338,11 +1340,11 @@ function user_authenticate($name, $password) {
       $password_hasher = drupal_container()->get('password');
       if ($password_hasher->check($password, $account)) {
         // Successful authentication.
-        $uid = $account->uid;
+        $uid = $account->id();
 
         // Update user to new password scheme if needed.
         if ($password_hasher->userNeedsNewHash($account)) {
-          $account->pass = $password;
+          $account->setPassword($password);
           $account->save();
         }
       }
@@ -1364,13 +1366,13 @@ function user_authenticate($name, $password) {
  */
 function user_login_finalize(&$edit = array()) {
   global $user;
-  watchdog('user', 'Session opened for %name.', array('%name' => $user->name));
+  watchdog('user', 'Session opened for %name.', array('%name' => $user->label()));
   // Update the user table timestamp noting user has logged in.
   // This is also used to invalidate one-time login links.
-  $user->login = REQUEST_TIME;
+  $user->setLastLoginTime(REQUEST_TIME);
   db_update('users')
-    ->fields(array('login' => $user->login))
-    ->condition('uid', $user->uid)
+    ->fields(array('login' => $user->getLastLoginTime()))
+    ->condition('uid', $user->id())
     ->execute();
 
   // Regenerate the session ID to prevent against session fixation attacks.
@@ -1389,7 +1391,7 @@ function user_login_finalize(&$edit = array()) {
 function user_login_form_submit($form, &$form_state) {
   global $user;
   $user = user_load($form_state['uid']);
-  $form_state['redirect'] = 'user/' . $user->uid;
+  $form_state['redirect'] = 'user/' . $user->id();
 
   user_login_finalize($form_state);
 }
@@ -1431,9 +1433,9 @@ function user_user_logout($account) {
  */
 function user_pass_reset_url($account, $options = array()) {
   $timestamp = REQUEST_TIME;
-  $langcode = isset($options['langcode']) ? $options['langcode'] : user_preferred_langcode($account);
+  $langcode = isset($options['langcode']) ? $options['langcode'] : $account->getPreferredLangcode();
   $url_options = array('absolute' => TRUE, 'language' => language_load($langcode));
-  return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
+  return url("user/reset/" . $account->id() . "/$timestamp/" . user_pass_rehash($account->getPassword(), $timestamp, $account->getLastLoginTime()), $url_options);
 }
 
 /**
@@ -1459,9 +1461,9 @@ function user_pass_reset_url($account, $options = array()) {
  */
 function user_cancel_url($account, $options = array()) {
   $timestamp = REQUEST_TIME;
-  $langcode = isset($options['langcode']) ? $options['langcode'] : user_preferred_langcode($account);
+  $langcode = isset($options['langcode']) ? $options['langcode'] : $account->getPreferredLangcode();
   $url_options = array('absolute' => TRUE, 'language' => language_load($langcode));
-  return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
+  return url("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account->getPassword(), $timestamp, $account->login), $url_options);
 }
 
 /**
@@ -1540,7 +1542,7 @@ function user_cancel($edit, $uid, $method) {
   );
 
   // After cancelling account, ensure that user is logged out.
-  if ($account->uid == $user->uid) {
+  if ($account->id() == $user->id()) {
     // Batch API stores data in the session, so use the finished operation to
     // manipulate the current user's session id.
     $batch['finished'] = '_user_cancel_session_regenerate';
@@ -1583,7 +1585,7 @@ function _user_cancel($edit, $account, $method) {
       if (!empty($edit['user_cancel_notify'])) {
         _user_mail_notify('status_canceled', $account);
       }
-      user_delete($account->uid);
+      $account->delete();
       drupal_set_message(t('%name has been deleted.', array('%name' => $account->name)));
       watchdog('user', 'Deleted user: %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
       break;
@@ -1593,7 +1595,7 @@ function _user_cancel($edit, $account, $method) {
   // their session though, as we might have information in it, and we can't
   // regenerate it because batch API uses the session ID, we will regenerate it
   // in _user_cancel_session_regenerate().
-  if ($account->uid == $user->uid) {
+  if ($account->id() == $user->id()) {
     $user = drupal_anonymous_user();
   }
 
@@ -1990,7 +1992,7 @@ function user_role_revoke_permissions($rid, array $permissions = array()) {
 
 function user_multiple_cancel_confirm($form, &$form_state) {
   // Retrieve the accounts to be canceled from the temp store.
-  $accounts = Drupal::service('user.tempstore')->get('user_user_operations_cancel')->get($GLOBALS['user']->uid);
+  $accounts = Drupal::service('user.tempstore')->get('user_user_operations_cancel')->get($GLOBALS['user']->id());
   $form['accounts'] = array('#prefix' => '<ul>', '#suffix' => '</ul>', '#tree' => TRUE);
   foreach ($accounts as $account) {
     $uid = $account->id();
@@ -2058,7 +2060,7 @@ function user_multiple_cancel_confirm_submit($form, &$form_state) {
   global $user;
 
   // Clear out the accounts from the temp store.
-  Drupal::service('user.tempstore')->get('user_user_operations_cancel')->delete($user->uid);
+  Drupal::service('user.tempstore')->get('user_user_operations_cancel')->delete($user->id());
   if ($form_state['values']['confirm']) {
     foreach ($form_state['values']['accounts'] as $uid => $value) {
       // Prevent programmatic form submissions from cancelling user 1.
@@ -2066,12 +2068,12 @@ function user_multiple_cancel_confirm_submit($form, &$form_state) {
         continue;
       }
       // Prevent user administrators from deleting themselves without confirmation.
-      if ($uid == $user->uid) {
+      if ($uid == $user->id()) {
         $admin_form_state = $form_state;
         unset($admin_form_state['values']['user_cancel_confirm']);
         // The $user global is not a complete user entity, so load the full
         // entity.
-        $admin_form_state['values']['_account'] = user_load($user->uid);
+        $admin_form_state['values']['_account'] = user_load($user->id());
         user_cancel_confirm_form_submit(array(), $admin_form_state);
       }
       else {
@@ -2196,31 +2198,18 @@ function theme_user_signature($variables) {
  * choose a preferred language, or is the anonymous user, the $default
  * value, or if it is not set, the site default language will be returned.
  *
- * @param $account
+ * @param \Drupal\Core\Session\AccountInterface $account
  *   User account to look up language for.
- * @param $type
+ * @param string $type
  *   Optional string to define which preferred langcode should be used.
  *   Default to 'preferred_langcode' property.
  *   If set 'preferred_$type_langcode' is used.
- * @param $default
+ * @param string $default
  *   Optional default language code to return if the account
  *   has no valid language.
  */
-function user_preferred_langcode($account, $type = NULL, $default = NULL) {
-  $language_list = language_list();
-  $account = $account->getBCEntity();
-  if (isset($type)) {
-    $preferred_langcode = $account->{'preferred_' . $type . '_langcode'};
-  }
-  else {
-    $preferred_langcode = $account->preferred_langcode;
-  }
-  if (!empty($preferred_langcode) && isset($language_list[$preferred_langcode])) {
-    return $language_list[$preferred_langcode]->langcode;
-  }
-  else {
-    return $default ? $default : language_default()->langcode;
-  }
+function user_preferred_langcode(AccountInterface $account, $type = NULL, $default = NULL) {
+  return $account->getPreferredLangcode($type, $default);
 }
 
 /**
@@ -2259,7 +2248,7 @@ function _user_mail_notify($op, $account, $langcode = NULL) {
   $notify = config('user.settings')->get('notify.' . $op);
   if ($notify || ($op != 'status_canceled' && $op != 'status_blocked')) {
     $params['account'] = $account;
-    $langcode = $langcode ? $langcode : user_preferred_langcode($account);
+    $langcode = $langcode ? $langcode : $account->getPreferredLangcode();
     // Get the custom site notification email to use as the from email address
     // if it has been set.
     $site_mail = config('system.site')->get('mail_notification');
@@ -2512,7 +2501,7 @@ function user_toolbar() {
   global $user;
 
   // Add logout & user account links or login link.
-  if ($user->uid) {
+  if ($user->isAuthenticated()) {
     $links = array(
       'account' => array(
         'title' => t('View profile'),
@@ -2524,7 +2513,7 @@ function user_toolbar() {
       ),
       'account_edit' => array(
         'title' => t('Edit profile'),
-        'href' => 'user/' . $user->uid . '/edit',
+        'href' => 'user/' . $user->id() . '/edit',
         'html' => TRUE,
         'attributes' => array(
           'title' => t('Edit user account'),
diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc
index 26fb040..250a7ee 100644
--- a/core/modules/user/user.pages.inc
+++ b/core/modules/user/user.pages.inc
@@ -37,7 +37,7 @@ function user_pass() {
     ),
   );
   // Allow logged in users to request this also.
-  if ($user->uid > 0) {
+  if ($user->id() > 0) {
     $form['name']['#type'] = 'value';
     $form['name']['#value'] = $user->mail;
     $form['mail'] = array(
@@ -65,7 +65,8 @@ function user_pass_validate($form, &$form_state) {
     $users = entity_load_multiple_by_properties('user', array('name' => $name, 'status' => '1'));
     $account = reset($users);
   }
-  if (isset($account->uid)) {
+  $uid = $account->id();
+  if (isset($uid)) {
     form_set_value(array('#parents' => array('account')), $account, $form_state);
   }
   else {
@@ -96,10 +97,10 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
 
   // When processing the one-time login link, we have to make sure that a user
   // isn't already logged in.
-  if ($user->uid) {
+  if ($user->id()) {
     // The existing user is already logged in.
-    if ($user->uid == $uid) {
-      drupal_set_message(t('You are logged in as %user. <a href="!user_edit">Change your password.</a>', array('%user' => $user->name, '!user_edit' => url("user/$user->uid/edit"))));
+    if ($user->id() == $uid) {
+      drupal_set_message(t('You are logged in as %user. <a href="!user_edit">Change your password.</a>', array('%user' => $user->name, '!user_edit' => url("user/$user->id()/edit"))));
     }
     // A different user is already logged in on the computer.
     else {
@@ -126,7 +127,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
         drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
         drupal_goto('user/password');
       }
-      elseif ($account->uid && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
+      elseif ($account->id() && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
         // First stage is a confirmation form, then login
         if ($action == 'login') {
           // Set the new user.
@@ -138,8 +139,8 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
           drupal_set_message(t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.'));
           // Let the user's password be changed without the current password check.
           $token = Crypt::randomStringHashed(55);
-          $_SESSION['pass_reset_' . $user->uid] = $token;
-          drupal_goto('user/' . $user->uid . '/edit', array('query' => array('pass-reset-token' => $token)));
+          $_SESSION['pass_reset_' . $user->id()] = $token;
+          drupal_goto('user/' . $user->id() . '/edit', array('query' => array('pass-reset-token' => $token)));
         }
         else {
           if (!$account->login) {
@@ -204,7 +205,7 @@ function user_edit_cancel_submit($form, &$form_state) {
   }
   // Note: We redirect from user/uid/edit to user/uid/cancel to make the tabs disappear.
   $account = $form_state['controller']->getEntity();
-  $form_state['redirect'] = array("user/" . $account->uid . "/cancel", array('query' => $destination));
+  $form_state['redirect'] = array("user/" . $account->id() . "/cancel", array('query' => $destination));
 }
 
 /**
@@ -223,7 +224,7 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   $can_select_method = $admin_access || user_access('select account cancellation method');
   $form['user_cancel_method'] = array(
     '#type' => 'radios',
-    '#title' => ($account->uid == $user->uid ? t('When cancelling your account') : t('When cancelling the account')),
+    '#title' => ($account->id() == $user->id() ? t('When cancelling your account') : t('When cancelling the account')),
     '#access' => $can_select_method,
   );
   $form['user_cancel_method'] += user_cancel_methods();
@@ -231,7 +232,7 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   // Allow user administrators to skip the account cancellation confirmation
   // mail (by default), as long as they do not attempt to cancel their own
   // account.
-  $override_access = $admin_access && ($account->uid != $user->uid);
+  $override_access = $admin_access && ($account->id() != $user->id());
   $form['user_cancel_confirm'] = array(
     '#type' => 'checkbox',
     '#title' => t('Require e-mail confirmation to cancel account.'),
@@ -250,7 +251,7 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   );
 
   // Prepare confirmation form page title and description.
-  if ($account->uid == $user->uid) {
+  if ($account->id() == $user->id()) {
     $question = t('Are you sure you want to cancel your account?');
   }
   else {
@@ -268,10 +269,10 @@ function user_cancel_confirm_form($form, &$form_state, $account) {
   }
 
   // Always provide entity id in the same form key as in the entity edit form.
-  $form['uid'] = array('#type' => 'value', '#value' => $account->uid);
+  $form['uid'] = array('#type' => 'value', '#value' => $account->id());
   return confirm_form($form,
     $question,
-    'user/' . $account->uid,
+    'user/' . $account->id(),
     $description . ' ' . t('This action cannot be undone.'),
     t('Cancel account'), t('Cancel'));
 }
@@ -289,8 +290,8 @@ function user_cancel_confirm_form_submit($form, &$form_state) {
   // Cancel account immediately, if the current user has administrative
   // privileges, no confirmation mail shall be sent, and the user does not
   // attempt to cancel the own account.
-  if (user_access('administer users') && empty($form_state['values']['user_cancel_confirm']) && $account->uid != $user->uid) {
-    user_cancel($form_state['values'], $account->uid, $form_state['values']['user_cancel_method']);
+  if (user_access('administer users') && empty($form_state['values']['user_cancel_confirm']) && $account->id() != $user->id()) {
+    user_cancel($form_state['values'], $account->id(), $form_state['values']['user_cancel_method']);
 
     $form_state['redirect'] = 'admin/people';
   }
@@ -304,7 +305,7 @@ function user_cancel_confirm_form_submit($form, &$form_state) {
     drupal_set_message(t('A confirmation request to cancel your account has been sent to your e-mail address.'));
     watchdog('user', 'Sent account cancellation request to %name %email.', array('%name' => $account->name, '%email' => '<' . $account->mail . '>'), WATCHDOG_NOTICE);
 
-    $form_state['redirect'] = "user/$account->uid";
+    $form_state['redirect'] = "user/$account->id()";
   }
 }
 
@@ -381,7 +382,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
   $account_data = drupal_container()->get('user.data')->get('user', $account->id());
   if (isset($account_data['cancel_method']) && !empty($timestamp) && !empty($hashed_pass)) {
     // Validate expiration and hashed password/login.
-    if ($timestamp <= $current && $current - $timestamp < $timeout && $account->uid && $timestamp >= $account->login && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
+    if ($timestamp <= $current && $current - $timestamp < $timeout && $account->id() && $timestamp >= $account->login && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
       $edit = array(
         'user_cancel_notify' => isset($account_data['cancel_notify']) ? $account_data['cancel_notify'] : config('user.settings')->get('notify.status_canceled'),
       );
@@ -393,7 +394,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
     }
     else {
       drupal_set_message(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'));
-      drupal_goto("user/$account->uid/cancel");
+      drupal_goto("user/$account->id()/cancel");
     }
   }
   throw new AccessDeniedHttpException();
@@ -407,8 +408,8 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
  */
 function user_page() {
   global $user;
-  if ($user->uid) {
-    return new RedirectResponse(url('user/' . $user->uid, array('absolute' => TRUE)));
+  if ($user->id()) {
+    return new RedirectResponse(url('user/' . $user->id(), array('absolute' => TRUE)));
   }
   else {
     return drupal_get_form('user_login_form');
diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc
index 185ad6e..3e80a9f 100644
--- a/core/modules/user/user.tokens.inc
+++ b/core/modules/user/user.tokens.inc
@@ -83,7 +83,8 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
         // Basic user account information.
         case 'uid':
           // In the case of hook user_presave uid is not set yet.
-          $replacements[$original] = !empty($account->uid) ? $account->uid : t('not yet assigned');
+          $uid = $account->id();
+          $replacements[$original] = !empty($uid) ? $uid : t('not yet assigned');
           break;
 
         case 'name':
@@ -96,11 +97,13 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
           break;
 
         case 'url':
-          $replacements[$original] = !empty($account->uid) ? url("user/$account->uid", $url_options) : t('not yet assigned');
+          $uid = $account->id();
+          $replacements[$original] = !empty($uid) ? url("user/$uid", $url_options) : t('not yet assigned');
           break;
 
         case 'edit-url':
-          $replacements[$original] = !empty($account->uid) ? url("user/$account->uid/edit", $url_options) : t('not yet assigned');
+          $uid = $account->id();
+          $replacements[$original] = !empty($uid) ? url("user/$uid/edit", $url_options) : t('not yet assigned');
           break;
 
         // These tokens are default variations on the chained tokens handled below.
@@ -125,7 +128,7 @@ function user_tokens($type, $tokens, array $data = array(), array $options = arr
   }
 
   if ($type == 'current-user') {
-    $account = user_load($GLOBALS['user']->uid);
+    $account = user_load($GLOBALS['user']->id());
     $replacements += $token_service->generate('user', $tokens, array('user' => $account), $options);
   }
 
diff --git a/core/modules/user/user.views_execution.inc b/core/modules/user/user.views_execution.inc
index 371d112..4839198 100644
--- a/core/modules/user/user.views_execution.inc
+++ b/core/modules/user/user.views_execution.inc
@@ -14,5 +14,5 @@
  */
 function user_views_query_substitutions(ViewExecutable $view) {
   global $user;
-  return array('***CURRENT_USER***' => intval($user->uid));
+  return array('***CURRENT_USER***' => intval($user->id()));
 }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
index 0316139..02fa235 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
@@ -286,7 +286,7 @@ public function generateResultsKey() {
       $key_data = array(
         'build_info' => $build_info,
         'roles' => $user->roles,
-        'super-user' => $user->uid == 1, // special caching for super user.
+        'super-user' => $user->id() == 1, // special caching for super user.
         'langcode' => language(Language::TYPE_INTERFACE)->langcode,
         'base_url' => $GLOBALS['base_url'],
       );
@@ -315,7 +315,7 @@ public function generateOutputKey() {
       $key_data = array(
         'result' => $this->view->result,
         'roles' => $user->roles,
-        'super-user' => $user->uid == 1, // special caching for super user.
+        'super-user' => $user->id() == 1, // special caching for super user.
         'theme' => $GLOBALS['theme'],
         'langcode' => language(Language::TYPE_INTERFACE)->langcode,
         'base_url' => $GLOBALS['base_url'],
diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
index 9cfdce9..d1c7d74 100644
--- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php
@@ -102,7 +102,7 @@ protected function setUp() {
       search_index($node->nid, 'node', $node->body[Language::LANGCODE_NOT_SPECIFIED][0]['value'], Language::LANGCODE_NOT_SPECIFIED);
 
       $comment = array(
-        'uid' => $user->uid,
+        'uid' => $user->id(),
         'nid' => $node->nid,
         'node_type' => 'node_type_' . $node->bundle(),
       );
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
index f83e84f..ee48db6 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -776,7 +776,7 @@ public function cacheSet() {
    *   TRUE if the view is locked, FALSE otherwise.
    */
   public function isLocked() {
-    return is_object($this->lock) && ($this->lock->owner != $GLOBALS['user']->uid);
+    return is_object($this->lock) && ($this->lock->owner != $GLOBALS['user']->id());
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php b/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php
index b6e5ab5..32cb9e0 100644
--- a/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php
+++ b/core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php
@@ -172,7 +172,7 @@ public function testRoleAccess($path, $grant_accounts, $deny_accounts) {
       $GLOBALS['user'] = $account;
 
       $subrequest = Request::create($path, 'GET');
-      $message = sprintf('Access denied for user %s with the roles %s on path: %s', $account->uid, implode(', ', $account->roles), $path);
+      $message = sprintf('Access denied for user %s with the roles %s on path: %s', $account->id(), implode(', ', $account->roles), $path);
       $has_access = $role_access_check->access($collection->get($path), $subrequest);
       $this->assertSame(AccessCheckInterface::DENY, $has_access , $message);
     }
