diff --git a/core/includes/file.inc b/core/includes/file.inc
index e3ac8ea..a0cfff1 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1156,22 +1156,22 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
     if (!empty($extensions)) {
       // Munge the filename to protect against possible malicious extension
       // hiding within an unknown file type (ie: filename.html.foo).
-      $file->filename = file_munge_filename($file->filename, $extensions);
+      $file->filename = file_munge_filename($file->filename->value, $extensions);
     }
 
     // Rename potentially executable files, to help prevent exploits (i.e. will
     // rename filename.php.foo and filename.php to filename.php.foo.txt and
     // filename.php.txt, respectively). Don't rename if 'allow_insecure_uploads'
     // evaluates to TRUE.
-    if (!config('system.file')->get('allow_insecure_uploads') && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
-      $file->filemime = 'text/plain';
-      $file->uri .= '.txt';
-      $file->filename .= '.txt';
+    if (!config('system.file')->get('allow_insecure_uploads') && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->filename->value) && (substr($file->filename->value, -4) != '.txt')) {
+      $file->filemime->value = 'text/plain';
+      $file->uri->value .= '.txt';
+      $file->filename->value .= '.txt';
       // The .txt extension may not be in the allowed list of extensions. We have
       // to add it here or else the file upload will fail.
       if (!empty($extensions)) {
         $validators['file_validate_extensions'][0] .= ' txt';
-        drupal_set_message(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $file->filename)));
+        drupal_set_message(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $file->filename->value)));
       }
     }
 
@@ -1193,7 +1193,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
     if (substr($destination, -1) != '/') {
       $destination .= '/';
     }
-    $file->destination = file_destination($destination . $file->filename, $replace);
+    $file->destination = file_destination($destination . $file->filename->value, $replace);
     // If file_destination() returns FALSE then $replace === FILE_EXISTS_ERROR and
     // there's an existing file so we need to bail.
     if ($file->destination === FALSE) {
@@ -1210,7 +1210,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
 
     // Check for errors.
     if (!empty($errors)) {
-      $message = t('The specified file %name could not be uploaded.', array('%name' => $file->filename));
+      $message = t('The specified file %name could not be uploaded.', array('%name' => $file->filename->value));
       if (count($errors) > 1) {
         $message .= theme('item_list', array('items' => $errors));
       }
@@ -1226,7 +1226,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
     // directory. This overcomes open_basedir restrictions for future file
     // operations.
     $file->uri = $file->destination;
-    if (!drupal_move_uploaded_file($uploaded_files['files']['tmp_name'][$source][$i], $file->uri)) {
+    if (!drupal_move_uploaded_file($uploaded_files['files']['tmp_name'][$source][$i], $file->uri->value)) {
       form_set_error($source, t('File upload error. Could not move uploaded file.'));
       watchdog('file', 'Upload error. Could not move uploaded file %file to destination %destination.', array('%file' => $file->filename, '%destination' => $file->uri));
       $files[$i] = FALSE;
@@ -1234,14 +1234,14 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
     }
 
     // Set the permissions on the new file.
-    drupal_chmod($file->uri);
+    drupal_chmod($file->uri->value);
 
     // If we are replacing an existing file re-use its database record.
     if ($replace == FILE_EXISTS_REPLACE) {
-      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $file->uri));
+      $existing_files = entity_load_multiple_by_properties('file', array('uri' => $file->uri->value));
       if (count($existing_files)) {
         $existing = reset($existing_files);
-        $file->fid = $existing->fid;
+        $file->fid = $existing->fid->value;
       }
     }
 
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php
index 7e1121e..083ca37 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php
@@ -157,7 +157,7 @@ public function submitForm(array &$form, array &$form_state) {
     $data = '';
     $validators = array('file_validate_extensions' => array('opml xml'));
     if ($file = file_save_upload('upload', $validators, FALSE, 0)) {
-      $data = file_get_contents($file->uri);
+      $data = file_get_contents($file->uri->value);
     }
     else {
       // @todo Move this to a fetcher implementation.
diff --git a/core/modules/file/file.api.php b/core/modules/file/file.api.php
index a6d11d5..58665f1 100644
--- a/core/modules/file/file.api.php
+++ b/core/modules/file/file.api.php
@@ -60,10 +60,10 @@ function hook_file_load($files) {
 function hook_file_validate(Drupal\file\File $file) {
   $errors = array();
 
-  if (empty($file->filename)) {
+  if (empty($file->filename->value)) {
     $errors[] = t("The file's name is empty. Please give a name to the file.");
   }
-  if (strlen($file->filename) > 255) {
+  if (strlen($file->filename->value) > 255) {
     $errors[] = t("The file's name exceeds the 255 characters limit. Please rename the file and try again.");
   }
 
@@ -112,14 +112,14 @@ function hook_file_insert(Drupal\file\File $file) {
  *   The file that has just been updated.
  */
 function hook_file_update(Drupal\file\File $file) {
-  $file_user = user_load($file->uid);
+  $file_user = user_load($file->uid->value);
   // Make sure that the file name starts with the owner's user name.
-  if (strpos($file->filename, $file_user->name) !== 0) {
-    $old_filename = $file->filename;
-    $file->filename = $file_user->name . '_' . $file->filename;
+  if (strpos($file->filename->value, $file_user->name) !== 0) {
+    $old_filename = $file->filename->value;
+    $file->filename->value = $file_user->name . '_' . $file->filename->value;
     $file->save();
 
-    watchdog('file', t('%source has been renamed to %destination', array('%source' => $old_filename, '%destination' => $file->filename)));
+    watchdog('file', t('%source has been renamed to %destination', array('%source' => $old_filename, '%destination' => $file->filename->value)));
   }
 }
 
@@ -134,13 +134,13 @@ function hook_file_update(Drupal\file\File $file) {
  * @see file_copy()
  */
 function hook_file_copy(Drupal\file\File $file, Drupal\file\File $source) {
-  $file_user = user_load($file->uid);
+  $file_user = user_load($file->uid->value);
   // Make sure that the file name starts with the owner's user name.
-  if (strpos($file->filename, $file_user->name) !== 0) {
-    $file->filename = $file_user->name . '_' . $file->filename;
+  if (strpos($file->filename->value, $file_user->name) !== 0) {
+    $file->filename->value = $file_user->name . '_' . $file->filename->value;
     $file->save();
 
-    watchdog('file', t('Copied file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
+    watchdog('file', t('Copied file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename->value)));
   }
 }
 
@@ -155,13 +155,13 @@ function hook_file_copy(Drupal\file\File $file, Drupal\file\File $source) {
  * @see file_move()
  */
 function hook_file_move(Drupal\file\File $file, Drupal\file\File $source) {
-  $file_user = user_load($file->uid);
+  $file_user = user_load($file->uid->value);
   // Make sure that the file name starts with the owner's user name.
-  if (strpos($file->filename, $file_user->name) !== 0) {
-    $file->filename = $file_user->name . '_' . $file->filename;
+  if (strpos($file->filename->value, $file_user->name) !== 0) {
+    $file->filename->value = $file_user->name . '_' . $file->filename->value;
     $file->save();
 
-    watchdog('file', t('Moved file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename)));
+    watchdog('file', t('Moved file %source has been renamed to %destination', array('%source' => $source->filename, '%destination' => $file->filename->value)));
   }
 }
 
@@ -180,7 +180,7 @@ function hook_file_move(Drupal\file\File $file, Drupal\file\File $source) {
  */
 function hook_file_predelete(Drupal\file\File $file) {
   // Delete all information associated with the file.
-  db_delete('upload')->condition('fid', $file->fid)->execute();
+  db_delete('upload')->condition('fid', $file->id())->execute();
 }
 
 /**
@@ -197,7 +197,7 @@ function hook_file_predelete(Drupal\file\File $file) {
  */
 function hook_file_delete(Drupal\file\File $file) {
   // Delete all information associated with the file.
-  db_delete('upload')->condition('fid', $file->fid)->execute();
+  db_delete('upload')->condition('fid', $file->id())->execute();
 }
 
 /**
diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc
index 59d068b..5433ef2 100644
--- a/core/modules/file/file.field.inc
+++ b/core/modules/file/file.field.inc
@@ -419,7 +419,7 @@ function file_field_widget_multiple_count_validate($element, &$form_state, $form
     $removed_names = array();
     foreach ($removed_files as $fid) {
       $file = file_load($fid);
-      $removed_names[] = $file->filename;
+      $removed_names[] = $file->filename->value;
     }
     drupal_set_message(
       t(
@@ -654,7 +654,7 @@ function theme_file_widget($variables) {
   if (!empty($element['fids']['#value'])) {
     // Add the file size after the file name.
     $file = reset($element['#files']);
-    $element['file_' . $file->fid]['filename']['#markup'] .= ' <span class="file-size">(' . format_size($file->filesize) . ')</span> ';
+    $element['file_' . $file->id()]['filename']['#markup'] .= ' <span class="file-size">(' . format_size($file->filesize->value) . ')</span> ';
   }
   $output .= drupal_render_children($element);
   $output .= '</div>';
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 18dae26..77587f5 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -175,34 +175,33 @@ function file_usage() {
  */
 function file_copy(File $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
   if (!file_valid_uri($destination)) {
-    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
-      watchdog('file', 'File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
+    if (($realpath = drupal_realpath($source->uri->value)) !== FALSE) {
+      watchdog('file', 'File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri->value, '%realpath' => $realpath, '%destination' => $destination));
     }
     else {
-      watchdog('file', 'File %file could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%destination' => $destination));
+      watchdog('file', 'File %file could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri->value, '%destination' => $destination));
     }
-    drupal_set_message(t('The specified file %file could not be copied because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
+    drupal_set_message(t('The specified file %file could not be copied because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri->value)), 'error');
     return FALSE;
   }
 
-  if ($uri = file_unmanaged_copy($source->uri, $destination, $replace)) {
-    $file = clone $source;
-    $file->fid = NULL;
-    $file->uri = $uri;
-    $file->filename = drupal_basename($uri);
+  if ($uri = file_unmanaged_copy($source->uri->value, $destination, $replace)) {
+    $file = $source->createDuplicate();
+    $file->uri->value = $uri;
+    $file->filename->value = drupal_basename($uri);
     // If we are replacing an existing file re-use its database record.
     if ($replace == FILE_EXISTS_REPLACE) {
       $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
       if (count($existing_files)) {
         $existing = reset($existing_files);
-        $file->fid = $existing->fid;
-        $file->filename = $existing->filename;
+        $file->fid = $existing->id();
+        $file->filename->value = $existing->filename->value;
       }
     }
     // If we are renaming around an existing file (rather than a directory),
     // use its basename for the filename.
     elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
-      $file->filename = drupal_basename($destination);
+      $file->filename->value = drupal_basename($destination);
     }
 
     $file->save();
@@ -250,34 +249,34 @@ function file_copy(File $source, $destination = NULL, $replace = FILE_EXISTS_REN
  */
 function file_move(File $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
   if (!file_valid_uri($destination)) {
-    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
-      watchdog('file', 'File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
+    if (($realpath = drupal_realpath($source->uri->value)) !== FALSE) {
+      watchdog('file', 'File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri->value, '%realpath' => $realpath, '%destination' => $destination));
     }
     else {
-      watchdog('file', 'File %file could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%destination' => $destination));
+      watchdog('file', 'File %file could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri->value, '%destination' => $destination));
     }
-    drupal_set_message(t('The specified file %file could not be moved because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri)), 'error');
+    drupal_set_message(t('The specified file %file could not be moved because the destination is invalid. More information is available in the system log.', array('%file' => $source->uri->value)), 'error');
     return FALSE;
   }
 
-  if ($uri = file_unmanaged_move($source->uri, $destination, $replace)) {
+  if ($uri = file_unmanaged_move($source->uri->value, $destination, $replace)) {
     $delete_source = FALSE;
 
     $file = clone $source;
-    $file->uri = $uri;
+    $file->uri->value = $uri;
     // If we are replacing an existing file re-use its database record.
     if ($replace == FILE_EXISTS_REPLACE) {
       $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
       if (count($existing_files)) {
         $existing = reset($existing_files);
         $delete_source = TRUE;
-        $file->fid = $existing->fid;
+        $file->fid = $existing->id();
       }
     }
     // If we are renaming around an existing file (rather than a directory),
     // use its basename for the filename.
     elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
-      $file->filename = drupal_basename($destination);
+      $file->filename->value = drupal_basename($destination);
     }
 
     $file->save();
@@ -342,10 +341,10 @@ function file_validate(File $file, $validators = array()) {
 function file_validate_name_length(File $file) {
   $errors = array();
 
-  if (empty($file->filename)) {
+  if (empty($file->filename->value)) {
     $errors[] = t("The file's name is empty. Please give a name to the file.");
   }
-  if (strlen($file->filename) > 240) {
+  if (strlen($file->filename->value) > 240) {
     $errors[] = t("The file's name exceeds the 240 characters limit. Please rename the file and try again.");
   }
   return $errors;
@@ -369,7 +368,7 @@ function file_validate_extensions(File $file, $extensions) {
   $errors = array();
 
   $regex = '/\.(' . preg_replace('/ +/', '|', preg_quote($extensions)) . ')$/i';
-  if (!preg_match($regex, $file->filename)) {
+  if (!preg_match($regex, $file->filename->value)) {
     $errors[] = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $extensions));
   }
   return $errors;
@@ -399,13 +398,13 @@ function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) {
   global $user;
   $errors = array();
 
-  if ($file_limit && $file->filesize > $file_limit) {
-    $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit)));
+  if ($file_limit && $file->filesize->value > $file_limit) {
+    $errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize->value), '%maxsize' => format_size($file_limit)));
   }
 
   // Save a query by only calling spaceUsed() when a limit is provided.
-  if ($user_limit && (Drupal::entityManager()->getStorageController('file')->spaceUsed($user->uid) + $file->filesize) > $user_limit) {
-    $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit)));
+  if ($user_limit && (Drupal::entityManager()->getStorageController('file')->spaceUsed($user->uid) + $file->filesize->value) > $user_limit) {
+    $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize->value), '%quota' => format_size($user_limit)));
   }
 
   return $errors;
@@ -425,7 +424,7 @@ function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) {
 function file_validate_is_image(File $file) {
   $errors = array();
 
-  $info = image_get_info($file->uri);
+  $info = image_get_info($file->uri->value);
   if (!$info || empty($info['extension'])) {
     $errors[] = t('Only JPEG, PNG and GIF images are allowed.');
   }
@@ -460,13 +459,13 @@ function file_validate_image_resolution(File $file, $maximum_dimensions = 0, $mi
   $errors = array();
 
   // Check first that the file is an image.
-  if ($info = image_get_info($file->uri)) {
+  if ($info = image_get_info($file->uri->value)) {
     if ($maximum_dimensions) {
       // Check that it is smaller than the given dimensions.
       list($width, $height) = explode('x', $maximum_dimensions);
       if ($info['width'] > $width || $info['height'] > $height) {
         // Try to resize the image to fit the dimensions.
-        if ($image = image_load($file->uri)) {
+        if ($image = image_load($file->uri->value)) {
           image_scale($image, $width, $height);
           image_save($image);
           $file->filesize = $image->info['file_size'];
@@ -537,14 +536,14 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
       $existing_files = entity_load_multiple_by_properties('file', array('uri' => $uri));
       if (count($existing_files)) {
         $existing = reset($existing_files);
-        $file->fid = $existing->fid;
-        $file->filename = $existing->filename;
+        $file->fid = $existing->id();
+        $file->filename->value = $existing->filename->value;
       }
     }
     // If we are renaming around an existing file (rather than a directory),
     // use its basename for the filename.
     elseif ($replace == FILE_EXISTS_RENAME && is_file($destination)) {
-      $file->filename = drupal_basename($destination);
+      $file->filename->value = drupal_basename($destination);
     }
 
     $file->save();
@@ -564,12 +563,12 @@ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAM
  *   \Symfony\Component\HttpFoundation\StreamedResponse.
  */
 function file_get_content_headers(File $file) {
-  $name = mime_header_encode($file->filename);
-  $type = mime_header_encode($file->filemime);
+  $name = mime_header_encode($file->filename->value);
+  $type = mime_header_encode($file->filemime->value);
 
   return array(
     'Content-Type' => $type,
-    'Content-Length' => $file->filesize,
+    'Content-Length' => $file->filesize->value,
     'Cache-Control' => 'private',
   );
 }
@@ -621,7 +620,7 @@ function file_file_download($uri, $field_type = 'file') {
     foreach ($files as $item) {
       // Since some database servers sometimes use a case-insensitive comparison
       // by default, double check that the filename is an exact match.
-      if ($item->uri === $uri) {
+      if ($item->uri->value === $uri) {
         $file = $item;
         break;
       }
@@ -639,7 +638,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->status == FILE_STATUS_PERMANENT || $file->uid != $user->uid)) {
+  if (empty($references) && ($file->status->value == FILE_STATUS_PERMANENT || $file->uid->value != $user->uid)) {
     return;
   }
 
@@ -711,15 +710,15 @@ function file_cron() {
     if ($file = file_load($row->fid)) {
       $references = file_usage()->listUsage($file);
       if (empty($references)) {
-        if (file_exists($file->uri)) {
+        if (file_exists($file->uri->value)) {
           $file->delete();
         }
         else {
-          watchdog('file system', 'Could not delete temporary file "%path" during garbage collection', array('%path' => $file->uri), WATCHDOG_ERROR);
+          watchdog('file system', 'Could not delete temporary file "%path" during garbage collection', array('%path' => $file->uri->value), WATCHDOG_ERROR);
         }
       }
       else {
-        watchdog('file system', 'Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.', array('%path' => $file->uri, '%modules' => implode(', ', array_keys($references))), WATCHDOG_INFO);
+        watchdog('file system', 'Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.', array('%path' => $file->uri->value, '%modules' => implode(', ', array_keys($references))), WATCHDOG_INFO);
       }
     }
   }
@@ -1034,7 +1033,7 @@ function file_managed_file_value(&$element, $input = FALSE, $form_state = NULL)
         $fids = array();
         foreach ($input['fids'] as $key => $fid) {
           if ($file = file_load($fid)) {
-            $fids[] = $file->fid;
+            $fids[] = $file->id();
           }
         }
       }
@@ -1057,7 +1056,7 @@ function file_managed_file_value(&$element, $input = FALSE, $form_state = NULL)
       $fids = array();
       foreach ($default_fids as $key => $fid) {
         if ($file = file_load($fid)) {
-          $fids[] = $file->fid;
+          $fids[] = $file->id();
         }
       }
     }
@@ -1082,7 +1081,7 @@ function file_managed_file_validate(&$element, &$form_state) {
     $fids = $element['fids']['#value'];
     foreach ($fids as $fid) {
       if ($file = file_load($fid)) {
-        if ($file->status == FILE_STATUS_PERMANENT) {
+        if ($file->status->value == FILE_STATUS_PERMANENT) {
           $references = file_usage()->listUsage($file);
           if (empty($references)) {
             form_error($element, t('The file used in the !name field may not be referenced.', array('!name' => $element['#title'])));
@@ -1142,8 +1141,8 @@ function file_managed_file_submit($form, &$form_state) {
       // If it's a temporary file we can safely remove it immediately, otherwise
       // it's up to the implementing module to remove usages of files to have them
       // removed.
-      if ($element['#files'][$fid] && $element['#files'][$fid]->status == 0) {
-        file_delete($element['#files'][$fid]->fid);
+      if ($element['#files'][$fid] && $element['#files'][$fid]->status->value == 0) {
+        file_delete($element['#files'][$fid]->id());
       }
     }
     // Update both $form_state['values'] and $form_state['input'] to reflect
@@ -1201,7 +1200,7 @@ function file_managed_file_save_upload($element) {
 
     // Value callback expects FIDs to be keys.
     $files = array_filter($files);
-    $fids = array_map(function($file) { return $file->fid; }, $files);
+    $fids = array_map(function($file) { return $file->id(); }, $files);
 
     return empty($files) ? array() : array_combine($fids, $files);
   }
@@ -1291,7 +1290,7 @@ function theme_file_link($variables) {
   $file = $variables['file'];
   $icon_directory = $variables['icon_directory'];
 
-  $url = file_create_url($file->uri);
+  $url = file_create_url($file->uri->value);
   // theme_file_icon() requires a file entity, make sure it gets one.
   $icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
 
@@ -1299,17 +1298,17 @@ function theme_file_link($variables) {
   // http://microformats.org/wiki/file-format-examples
   $options = array(
     'attributes' => array(
-      'type' => $file->filemime . '; length=' . $file->filesize,
+      'type' => $file->filemime->value . '; length=' . $file->filesize->value,
     ),
   );
 
   // Use the description as the link text if available.
   if (empty($variables['description'])) {
-    $link_text = $file->filename;
+    $link_text = $file->filename->value;
   }
   else {
     $link_text = $variables['description'];
-    $options['attributes']['title'] = check_plain($file->filename);
+    $options['attributes']['title'] = check_plain($file->filename->value);
   }
 
   return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
@@ -1331,7 +1330,7 @@ function theme_file_icon($variables) {
   $file = $variables['file'];
   $icon_directory = $variables['icon_directory'];
 
-  $mime = check_plain($file->filemime);
+  $mime = check_plain($file->filemime->value);
   $icon_url = file_icon_url($file, $icon_directory);
   return '<img class="file-icon" alt="" title="' . $mime . '" src="' . $icon_url . '" />';
 }
@@ -1375,7 +1374,7 @@ function file_icon_path(File $file, $icon_directory = NULL) {
   }
 
   // If there's an icon matching the exact mimetype, go for it.
-  $dashed_mime = strtr($file->filemime, array('/' => '-'));
+  $dashed_mime = strtr($file->filemime->value, array('/' => '-'));
   $icon_path = $icon_directory . '/' . $dashed_mime . '.png';
   if (file_exists($icon_path)) {
     return $icon_path;
@@ -1390,7 +1389,7 @@ function file_icon_path(File $file, $icon_directory = NULL) {
 
   // Use generic icons for each category that provides such icons.
   foreach (array('audio', 'image', 'text', 'video') as $category) {
-    if (strpos($file->filemime, $category . '/') === 0) {
+    if (strpos($file->filemime->value, $category . '/') === 0) {
       $icon_path = $icon_directory . '/' . $category . '-x-generic.png';
       if (file_exists($icon_path)) {
         return $icon_path;
@@ -1418,7 +1417,7 @@ function file_icon_path(File $file, $icon_directory = NULL) {
  *   The generic icon MIME package expected for this file.
  */
 function file_icon_map(File $file) {
-  switch ($file->filemime) {
+  switch ($file->filemime->value) {
     // Word document types.
     case 'application/msword':
     case 'application/vnd.ms-word.document.macroEnabled.12':
@@ -1567,8 +1566,8 @@ function file_get_file_references(File $file, $field = NULL, $age = FIELD_LOAD_R
   $field_columns = &drupal_static(__FUNCTION__ . ':field_columns', array());
 
   // Fill the static cache, disregard $field and $field_type for now.
-  if (!isset($references[$file->fid][$age])) {
-    $references[$file->fid][$age] = array();
+  if (!isset($references[$file->id()][$age])) {
+    $references[$file->id()][$age] = array();
     $usage_list = file_usage()->listUsage($file);
     $file_usage_list = isset($usage_list['file']) ? $usage_list['file'] : array();
     foreach ($file_usage_list as $entity_type => $entity_ids) {
@@ -1606,20 +1605,20 @@ function file_get_file_references(File $file, $field = NULL, $age = FIELD_LOAD_R
           // revision.
           if (!$match && ($field_items = field_get_items($entity, $field_name))) {
             foreach ($field_items as $item) {
-              if ($file->fid == $item[$field_column]) {
+              if ($file->id() == $item[$field_column]) {
                 $match = TRUE;
                 break;
               }
             }
           }
           if ($match) {
-            $references[$file->fid][$age][$field_name][$entity_type][$entity->id()] = $entity;
+            $references[$file->id()][$age][$field_name][$entity_type][$entity->id()] = $entity;
           }
         }
       }
     }
   }
-  $return = $references[$file->fid][$age];
+  $return = $references[$file->id()][$age];
   // Filter the static cache down to the requested entries. The usual static
   // cache is very small so this will be very fast.
   if ($field || $field_type) {
diff --git a/core/modules/file/lib/Drupal/file/FileStorageController.php b/core/modules/file/lib/Drupal/file/FileStorageController.php
index fb72a5d..2211da3 100644
--- a/core/modules/file/lib/Drupal/file/FileStorageController.php
+++ b/core/modules/file/lib/Drupal/file/FileStorageController.php
@@ -7,13 +7,13 @@
 
 namespace Drupal\file;
 
-use Drupal\Core\Entity\DatabaseStorageController;
+use Drupal\Core\Entity\DatabaseStorageControllerNG;
 use Drupal\Core\Entity\EntityInterface;
 
 /**
  * File storage controller for files.
  */
-class FileStorageController extends DatabaseStorageController {
+class FileStorageController extends DatabaseStorageControllerNG {
 
   /**
    * Overrides Drupal\Core\Entity\DatabaseStorageController::create().
@@ -36,8 +36,8 @@ public function create(array $values) {
    */
   protected function preSave(EntityInterface $entity) {
     $entity->timestamp = REQUEST_TIME;
-    $entity->filesize = filesize($entity->uri);
-    if (!isset($entity->langcode)) {
+    $entity->filesize = filesize($entity->uri->value);
+    if (!$entity->langcode->value) {
       // Default the file's language code to none, because files are language
       // neutral more often than language dependent. Until we have better
       // flexible settings.
@@ -54,7 +54,7 @@ public function preDelete($entities) {
       // Delete the actual file. Failures due to invalid files and files that
       // were already deleted are logged to watchdog but ignored, the
       // corresponding file entity will be deleted.
-      file_unmanaged_delete($entity->uri);
+      file_unmanaged_delete($entity->uri->value);
     }
     // Delete corresponding file usage entries.
     db_delete('file_usage')
@@ -99,4 +99,61 @@ public function retrieveTemporaryFiles() {
       ':timestamp' => REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE
     ));
   }
+
+  public function baseFieldDefinitions() {
+    $properties['fid'] = array(
+      'label' => t('File ID'),
+      'description' => t('The file ID.'),
+      'type' => 'integer_field',
+      'read-only' => TRUE,
+    );
+    $properties['uuid'] = array(
+      'label' => t('UUID'),
+      'description' => t('The file UUID.'),
+      'type' => 'string_field',
+      'read-only' => TRUE,
+    );
+    $properties['langcode'] = array(
+      'label' => t('Language code'),
+      'description' => t('The file language code.'),
+      'type' => 'language_field',
+    );
+    $properties['uid'] = array(
+      'label' => t('User ID'),
+      'description' => t('The user ID of the file.'),
+      'type' => 'entity_reference_field',
+      'settings' => array('target_type' => 'user'),
+    );
+    $properties['filename'] = array(
+      'label' => t('Filename'),
+      'description' => t('Name of the file with no path components.'),
+      'type' => 'string_field',
+    );
+    $properties['uri'] = array(
+      'label' => t('URI'),
+      'description' => t('The URI to access the file (either local or remote).'),
+      'type' => 'string_field',
+    );
+    $properties['filemime'] = array(
+      'label' => t('File MIME type'),
+      'description' => t("The file's MIME type."),
+      'type' => 'string_field',
+    );
+    $properties['filesize'] = array(
+      'label' => t('File size'),
+      'description' => t('The size of the file in bytes.'),
+      'type' => 'boolean_field',
+    );
+    $properties['status'] = array(
+      'label' => t('Status'),
+      'description' => t('The status of the file, temporary (0) and permanent (1)'),
+      'type' => 'integer_field',
+    );
+    $properties['timestamp'] = array(
+      'label' => t('Created'),
+      'description' => t('The time that the node was created.'),
+      'type' => 'integer_field',
+    );
+    return $properties;
+  }
 }
diff --git a/core/modules/file/lib/Drupal/file/FileUsage/DatabaseFileUsageBackend.php b/core/modules/file/lib/Drupal/file/FileUsage/DatabaseFileUsageBackend.php
index eaca4bf..80163c4 100644
--- a/core/modules/file/lib/Drupal/file/FileUsage/DatabaseFileUsageBackend.php
+++ b/core/modules/file/lib/Drupal/file/FileUsage/DatabaseFileUsageBackend.php
@@ -51,7 +51,7 @@ public function __construct(Connection $connection, $table = 'file_usage') {
   public function add(File $file, $module, $type, $id, $count = 1) {
     $this->connection->merge($this->tableName)
       ->key(array(
-        'fid' => $file->fid,
+        'fid' => $file->id(),
         'module' => $module,
         'type' => $type,
         'id' => $id,
@@ -70,7 +70,7 @@ public function delete(File $file, $module, $type = NULL, $id = NULL, $count = 1
     // Delete rows that have a exact or less value to prevent empty rows.
     $query = $this->connection->delete($this->tableName)
       ->condition('module', $module)
-      ->condition('fid', $file->fid);
+      ->condition('fid', $file->id());
     if ($type && $id) {
       $query
         ->condition('type', $type)
@@ -85,7 +85,7 @@ public function delete(File $file, $module, $type = NULL, $id = NULL, $count = 1
     if (!$result && $count > 0) {
       $query = $this->connection->update($this->tableName)
         ->condition('module', $module)
-        ->condition('fid', $file->fid);
+        ->condition('fid', $file->id());
       if ($type && $id) {
         $query
           ->condition('type', $type)
@@ -104,7 +104,7 @@ public function delete(File $file, $module, $type = NULL, $id = NULL, $count = 1
   public function listUsage(File $file) {
     $result = $this->connection->select($this->tableName, 'f')
       ->fields('f', array('module', 'type', 'id', 'count'))
-      ->condition('fid', $file->fid)
+      ->condition('fid', $file->id())
       ->condition('count', 0, '>')
       ->execute();
     $references = array();
diff --git a/core/modules/file/lib/Drupal/file/FileUsage/FileUsageBase.php b/core/modules/file/lib/Drupal/file/FileUsage/FileUsageBase.php
index 9ba2ac7..f6dee23 100644
--- a/core/modules/file/lib/Drupal/file/FileUsage/FileUsageBase.php
+++ b/core/modules/file/lib/Drupal/file/FileUsage/FileUsageBase.php
@@ -19,8 +19,8 @@
    */
   public function add(File $file, $module, $type, $id, $count = 1) {
     // Make sure that a used file is permament.
-    if ($file->status != FILE_STATUS_PERMANENT) {
-      $file->status = FILE_STATUS_PERMANENT;
+    if ($file->status->value != FILE_STATUS_PERMANENT) {
+      $file->status->value = FILE_STATUS_PERMANENT;
       $file->save();
     }
   }
@@ -33,7 +33,7 @@ public function delete(File $file, $module, $type = NULL, $id = NULL, $count = 1
     // which result in a delete through system_cron().
     $usage = file_usage()->listUsage($file);
     if (empty($usage)) {
-      $file->status = 0;
+      $file->status->value = 0;
       $file->save();
     }
   }
diff --git a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php
index 6a0e80d..8e832eb 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/Core/Entity/File.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\file\Plugin\Core\Entity;
 
-use Drupal\Core\Entity\Entity;
+use Drupal\Core\Entity\EntityNG;
 use Drupal\Core\Entity\Annotation\EntityType;
 use Drupal\Core\Annotation\Translation;
 use Drupal\file\FileInterface;
@@ -31,7 +31,7 @@
  *   }
  * )
  */
-class File extends Entity implements FileInterface {
+class File extends EntityNG implements FileInterface {
 
   /**
    * The file ID.
@@ -111,10 +111,37 @@ class File extends Entity implements FileInterface {
   public $timestamp;
 
   /**
+   * The plain data values of the contained properties.
+   *
+   * Define default values.
+   *
+   * @var array
+   */
+  protected $values = array(
+    'langcode' => array(LANGUAGE_DEFAULT => array(0 => array('value' => LANGUAGE_NOT_SPECIFIED))),
+  );
+
+  /**
    * Overrides Drupal\Core\Entity\Entity::id().
    */
   public function id() {
-    return $this->fid;
+    return $this->get('fid')->value;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function init() {
+    parent::init();
+    unset($this->fid);
+    unset($this->filename);
+    unset($this->uri);
+    unset($this->filemime);
+    unset($this->filesize);
+    unset($this->status);
+    unset($this->uid);
+    unset($this->timestamp);
+    unset($this->uuid);
   }
 
 }
diff --git a/core/modules/file/lib/Drupal/file/Plugin/field/formatter/RSSEnclosureFormatter.php b/core/modules/file/lib/Drupal/file/Plugin/field/formatter/RSSEnclosureFormatter.php
index 16b872e..0dccd5d 100644
--- a/core/modules/file/lib/Drupal/file/Plugin/field/formatter/RSSEnclosureFormatter.php
+++ b/core/modules/file/lib/Drupal/file/Plugin/field/formatter/RSSEnclosureFormatter.php
@@ -35,12 +35,13 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) {
     // enclosure per item. See: http://en.wikipedia.org/wiki/RSS_enclosure
     foreach ($items as $item) {
       if ($item['display']) {
+        $file = file_load($item['fid']);
         $entity->rss_elements[] = array(
           'key' => 'enclosure',
           'attributes' => array(
-            'url' => file_create_url($item['uri']),
-            'length' => $item['filesize'],
-            'type' => $item['filemime'],
+            'url' => file_create_url($file->uri->value),
+            'length' => $file->filesize->value,
+            'type' => $file->filemime->value,
           ),
         );
         break;
diff --git a/core/modules/file/lib/Drupal/file/Tests/CopyTest.php b/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
index 7f20c9f..2ec7b24 100644
--- a/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
@@ -33,19 +33,19 @@ function testNormal() {
 
     // Check the return status and that the contents changed.
     $this->assertTrue($result, t('File copied successfully.'));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were copied correctly.'));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of file were copied correctly.'));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('copy', 'insert'));
 
     $this->assertDifferentFile($source, $result);
-    $this->assertEqual($result->uri, $desired_uri, t('The copied file entity has the desired filepath.'));
-    $this->assertTrue(file_exists($source->uri), t('The original file still exists.'));
-    $this->assertTrue(file_exists($result->uri), t('The copied file exists.'));
+    $this->assertEqual($result->uri->value, $desired_uri, t('The copied file entity has the desired filepath.'));
+    $this->assertTrue(file_exists($source->uri->value), t('The original file still exists.'));
+    $this->assertTrue(file_exists($result->uri->value), t('The copied file exists.'));
 
     // Reload the file from the database and check that the changes were
     // actually saved.
-    $this->assertFileUnchanged($result, file_load($result->fid, TRUE));
+    $this->assertFileUnchanged($result, file_load($result->id(), TRUE));
   }
 
   /**
@@ -60,21 +60,21 @@ function testExistingRename() {
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
-    $result = file_copy(clone $source, $target->uri, FILE_EXISTS_RENAME);
+    $result = file_copy(clone $source, $target->uri->value, FILE_EXISTS_RENAME);
 
     // Check the return status and that the contents changed.
     $this->assertTrue($result, t('File copied successfully.'));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were copied correctly.'));
-    $this->assertNotEqual($result->uri, $source->uri, t('Returned file path has changed from the original.'));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of file were copied correctly.'));
+    $this->assertNotEqual($result->uri->value, $source->uri->value, t('Returned file path has changed from the original.'));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('copy', 'insert'));
 
     // Load all the affected files to check the changes that actually made it
     // to the database.
-    $loaded_source = file_load($source->fid, TRUE);
-    $loaded_target = file_load($target->fid, TRUE);
-    $loaded_result = file_load($result->fid, TRUE);
+    $loaded_source = file_load($source->id(), TRUE);
+    $loaded_target = file_load($target->id(), TRUE);
+    $loaded_result = file_load($result->id(), TRUE);
 
     // Verify that the source file wasn't changed.
     $this->assertFileUnchanged($source, $loaded_source);
@@ -100,11 +100,11 @@ function testExistingReplace() {
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
-    $result = file_copy(clone $source, $target->uri, FILE_EXISTS_REPLACE);
+    $result = file_copy(clone $source, $target->uri->value, FILE_EXISTS_REPLACE);
 
     // Check the return status and that the contents changed.
     $this->assertTrue($result, t('File copied successfully.'));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were overwritten.'));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of file were overwritten.'));
     $this->assertDifferentFile($source, $result);
 
     // Check that the correct hooks were called.
@@ -112,9 +112,9 @@ function testExistingReplace() {
 
     // Load all the affected files to check the changes that actually made it
     // to the database.
-    $loaded_source = file_load($source->fid, TRUE);
-    $loaded_target = file_load($target->fid, TRUE);
-    $loaded_result = file_load($result->fid, TRUE);
+    $loaded_source = file_load($source->id(), TRUE);
+    $loaded_target = file_load($target->id(), TRUE);
+    $loaded_result = file_load($result->id(), TRUE);
 
     // Verify that the source file wasn't changed.
     $this->assertFileUnchanged($source, $loaded_source);
@@ -138,16 +138,16 @@ function testExistingError() {
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
-    $result = file_copy(clone $source, $target->uri, FILE_EXISTS_ERROR);
+    $result = file_copy(clone $source, $target->uri->value, FILE_EXISTS_ERROR);
 
     // Check the return status and that the contents were not changed.
     $this->assertFalse($result, t('File copy failed.'));
-    $this->assertEqual($contents, file_get_contents($target->uri), t('Contents of file were not altered.'));
+    $this->assertEqual($contents, file_get_contents($target->uri->value), t('Contents of file were not altered.'));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array());
 
-    $this->assertFileUnchanged($source, file_load($source->fid, TRUE));
-    $this->assertFileUnchanged($target, file_load($target->fid, TRUE));
+    $this->assertFileUnchanged($source, file_load($source->id(), TRUE));
+    $this->assertFileUnchanged($target, file_load($target->id(), TRUE));
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php b/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php
index ca2f712..a8a1a66 100644
--- a/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/DeleteTest.php
@@ -26,11 +26,11 @@ function testUnused() {
     $file = $this->createFile();
 
     // Check that deletion removes the file and database record.
-    $this->assertTrue(is_file($file->uri), t('File exists.'));
+    $this->assertTrue(is_file($file->uri->value), t('File exists.'));
     $file->delete();
     $this->assertFileHooksCalled(array('delete'));
-    $this->assertFalse(file_exists($file->uri), t('Test file has actually been deleted.'));
-    $this->assertFalse(file_load($file->fid), t('File was removed from the database.'));
+    $this->assertFalse(file_exists($file->uri->value), t('Test file has actually been deleted.'));
+    $this->assertFalse(file_load($file->id()), t('File was removed from the database.'));
   }
 
   /**
@@ -44,8 +44,8 @@ function testInUse() {
     file_usage()->delete($file, 'testing', 'test', 1);
     $usage = file_usage()->listUsage($file);
     $this->assertEqual($usage['testing']['test'], array(1 => 1), t('Test file is still in use.'));
-    $this->assertTrue(file_exists($file->uri), t('File still exists on the disk.'));
-    $this->assertTrue(file_load($file->fid), t('File still exists in the database.'));
+    $this->assertTrue(file_exists($file->uri->value), t('File still exists on the disk.'));
+    $this->assertTrue(file_load($file->id()), t('File still exists in the database.'));
 
     // Clear out the call to hook_file_load().
     file_test_reset();
@@ -54,10 +54,10 @@ function testInUse() {
     $usage = file_usage()->listUsage($file);
     $this->assertFileHooksCalled(array('load', 'update'));
     $this->assertTrue(empty($usage), t('File usage data was removed.'));
-    $this->assertTrue(file_exists($file->uri), 'File still exists on the disk.');
-    $file = file_load($file->fid);
+    $this->assertTrue(file_exists($file->uri->value), 'File still exists on the disk.');
+    $file = file_load($file->id());
     $this->assertTrue($file, 'File still exists in the database.');
-    $this->assertEqual($file->status, 0, 'File is temporary.');
+    $this->assertEqual($file->status->value, 0, 'File is temporary.');
     file_test_reset();
 
     // Call system_cron() to clean up the file. Make sure the timestamp
@@ -66,13 +66,13 @@ function testInUse() {
       ->fields(array(
         'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
       ))
-      ->condition('fid', $file->fid)
+      ->condition('fid', $file->id())
       ->execute();
     drupal_cron_run();
 
     // system_cron() loads
     $this->assertFileHooksCalled(array('delete'));
-    $this->assertFalse(file_exists($file->uri), t('File has been deleted after its last usage was removed.'));
-    $this->assertFalse(file_load($file->fid), t('File was removed from the database.'));
+    $this->assertFalse(file_exists($file->uri->value), t('File has been deleted after its last usage was removed.'));
+    $this->assertFalse(file_load($file->id()), t('File was removed from the database.'));
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php b/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
index 0763507..2473af2 100644
--- a/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/DownloadTest.php
@@ -31,10 +31,10 @@ function setUp() {
   function testPublicFileTransfer() {
     // Test generating an URL to a created file.
     $file = $this->createFile();
-    $url = file_create_url($file->uri);
+    $url = file_create_url($file->uri->value);
     // URLs can't contain characters outside the ASCII set so $filename has to be
     // encoded.
-    $filename = $GLOBALS['base_url'] . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . rawurlencode($file->filename);
+    $filename = $GLOBALS['base_url'] . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . rawurlencode($file->filename->value);
     $this->assertEqual($filename, $url, t('Correctly generated a URL for a created file.'));
     $this->drupalHead($url);
     $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the created file.'));
@@ -57,7 +57,7 @@ function testPrivateFileTransfer() {
     // Create a file.
     $contents = $this->randomName(8);
     $file = $this->createFile(NULL, $contents, 'private');
-    $url  = file_create_url($file->uri);
+    $url  = file_create_url($file->uri->value);
 
     // Set file_test access header to allow the download.
     file_test_set_return('download', array('x-foo' => 'Bar'));
@@ -133,7 +133,7 @@ private function checkUrl($scheme, $directory, $filename, $expected_url) {
     file_prepare_directory($directory_uri, FILE_CREATE_DIRECTORY);
     $file = $this->createFile($filepath, NULL, $scheme);
 
-    $url = file_create_url($file->uri);
+    $url = file_create_url($file->uri->value);
     $this->assertEqual($url, $expected_url, t('Generated URL matches expected URL.'));
 
     if ($scheme == 'private') {
@@ -144,7 +144,7 @@ private function checkUrl($scheme, $directory, $filename, $expected_url) {
 
     $this->drupalGet($url);
     if ($this->assertResponse(200) == 'pass') {
-      $this->assertRaw(file_get_contents($file->uri), t('Contents of the file are correct.'));
+      $this->assertRaw(file_get_contents($file->uri->value), t('Contents of the file are correct.'));
     }
 
     $file->delete();
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
index fddbcca..5920eee 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
@@ -34,7 +34,7 @@ function testUploadPath() {
     // Check that the file was uploaded to the file root.
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
-    $this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
+    $this->assertPathMatch('public://' . $test_file->filename->value, $node_file->uri->value, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri->value)));
 
     // Change the path to contain multiple subdirectories.
     $this->updateFileField($field_name, $type_name, array('file_directory' => 'foo/bar/baz'));
@@ -45,7 +45,7 @@ function testUploadPath() {
     // Check that the file was uploaded into the subdirectory.
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
-    $this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
+    $this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename->value, $node_file->uri->value, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri->value)));
 
     // Check the path when used with tokens.
     // Change the path to contain multiple token directories.
@@ -61,7 +61,7 @@ function testUploadPath() {
     // the user running the test case.
     $data = array('user' => $this->admin_user);
     $subdirectory = \Drupal::token()->replace('[user:uid]/[user:name]', $data);
-    $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri)));
+    $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename->value, $node_file->uri->value, t('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri->value)));
   }
 
   /**
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php
index a66fd8d..729cc1f 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRSSContentTest.php
@@ -69,14 +69,14 @@ function testFileFieldRSSContent() {
 
     // Check that the RSS enclosure appears in the RSS feed.
     $this->drupalGet('rss.xml');
-    $uploaded_filename = str_replace('public://', '', $node_file->uri);
+    $uploaded_filename = str_replace('public://', '', $node_file->uri->value);
     $test_element = array(
       'key' => 'enclosure',
       'value' => "",
       'attributes' => array(
         'url' => url("$this->public_files_directory/$uploaded_filename", array('absolute' => TRUE)),
-        'length' => $node_file->filesize,
-        'type' => $node_file->filemime
+        'length' => $node_file->filesize->value,
+        'type' => $node_file->filemime->value
       ),
     );
     $this->assertRaw(format_xml_elements(array($test_element)), 'File field RSS enclosure is displayed when viewing the RSS feed.');
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
index 3f2003a..1ce6f6f 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldRevisionTest.php
@@ -93,7 +93,7 @@ function testRevisions() {
 
     // Attach the second file to a user.
     $user = $this->drupalCreateUser();
-    $user->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'] = $node_file_r3->fid;
+    $user->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'] = $node_file_r3->id();
     $user->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['display'] = 1;
     $user->save();
     $this->drupalGet('user/' . $user->uid . '/edit');
@@ -109,10 +109,10 @@ function testRevisions() {
     // 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.
-    clearstatcache($node_file_r1->uri);
-    clearstatcache($node_file_r2->uri);
-    clearstatcache($node_file_r3->uri);
-    clearstatcache($node_file_r4->uri);
+    clearstatcache($node_file_r1->uri->value);
+    clearstatcache($node_file_r2->uri->value);
+    clearstatcache($node_file_r3->uri->value);
+    clearstatcache($node_file_r4->uri->value);
 
     // Call system_cron() to clean up the file. Make sure the timestamp
     // of the file is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
@@ -120,7 +120,7 @@ function testRevisions() {
       ->fields(array(
         'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
       ))
-      ->condition('fid', $node_file_r3->fid)
+      ->condition('fid', $node_file_r3->id())
       ->execute();
     drupal_cron_run();
 
@@ -135,7 +135,7 @@ function testRevisions() {
       ->fields(array(
         'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
       ))
-      ->condition('fid', $node_file_r1->fid)
+      ->condition('fid', $node_file_r1->id())
       ->execute();
     drupal_cron_run();
     $this->assertFileNotExists($node_file_r1, t('Original file is deleted after deleting the entire node with two revisions remaining.'));
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
index ac2f428..07ac0d8 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php
@@ -161,7 +161,7 @@ function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE,
     if ($field['cardinality'] != 1) {
       $name .= '[]';
     }
-    $edit[$name] = drupal_realpath($file->uri);
+    $edit[$name] = drupal_realpath($file->uri->value);
     $this->drupalPost("node/$nid/edit", $edit, t('Save and keep published'));
 
     return $nid;
@@ -186,7 +186,7 @@ function removeNodeFile($nid, $new_revision = TRUE) {
    */
   function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
     $edit = array(
-      'files[' . $field_name . '_' . LANGUAGE_NOT_SPECIFIED . '_0]' => drupal_realpath($file->uri),
+      'files[' . $field_name . '_' . LANGUAGE_NOT_SPECIFIED . '_0]' => drupal_realpath($file->uri->value),
       'revision' => (string) (int) $new_revision,
     );
 
@@ -198,8 +198,8 @@ function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
    * Asserts that a file exists physically on disk.
    */
   function assertFileExists($file, $message = NULL) {
-    $message = isset($message) ? $message : t('File %file exists on the disk.', array('%file' => $file->uri));
-    $this->assertTrue(is_file($file->uri), $message);
+    $message = isset($message) ? $message : t('File %file exists on the disk.', array('%file' => $file->uri->value));
+    $this->assertTrue(is_file($file->uri->value), $message);
   }
 
   /**
@@ -207,17 +207,17 @@ function assertFileExists($file, $message = NULL) {
    */
   function assertFileEntryExists($file, $message = NULL) {
     $this->container->get('plugin.manager.entity')->getStorageController('file')->resetCache();
-    $db_file = file_load($file->fid);
-    $message = isset($message) ? $message : t('File %file exists in database at the correct path.', array('%file' => $file->uri));
-    $this->assertEqual($db_file->uri, $file->uri, $message);
+    $db_file = file_load($file->id());
+    $message = isset($message) ? $message : t('File %file exists in database at the correct path.', array('%file' => $file->uri->value));
+    $this->assertEqual($db_file->uri->value, $file->uri->value, $message);
   }
 
   /**
    * Asserts that a file does not exist on disk.
    */
   function assertFileNotExists($file, $message = NULL) {
-    $message = isset($message) ? $message : t('File %file exists on the disk.', array('%file' => $file->uri));
-    $this->assertFalse(is_file($file->uri), $message);
+    $message = isset($message) ? $message : t('File %file exists on the disk.', array('%file' => $file->uri->value));
+    $this->assertFalse(is_file($file->uri->value), $message);
   }
 
   /**
@@ -225,15 +225,15 @@ function assertFileNotExists($file, $message = NULL) {
    */
   function assertFileEntryNotExists($file, $message) {
     $this->container->get('plugin.manager.entity')->getStorageController('file')->resetCache();
-    $message = isset($message) ? $message : t('File %file exists in database at the correct path.', array('%file' => $file->uri));
-    $this->assertFalse(file_load($file->fid), $message);
+    $message = isset($message) ? $message : t('File %file exists in database at the correct path.', array('%file' => $file->uri->value));
+    $this->assertFalse(file_load($file->id()), $message);
   }
 
   /**
    * Asserts that a file's status is set to permanent in the database.
    */
   function assertFileIsPermanent($file, $message = NULL) {
-    $message = isset($message) ? $message : t('File %file is permanent.', array('%file' => $file->uri));
-    $this->assertTrue($file->status == FILE_STATUS_PERMANENT, $message);
+    $message = isset($message) ? $message : t('File %file is permanent.', array('%file' => $file->uri->value));
+    $this->assertTrue($file->status->value == FILE_STATUS_PERMANENT, $message);
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
index faceb99..010eeb7 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
@@ -41,7 +41,7 @@ function testRequired() {
 
     // Create a new node with the uploaded file.
     $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
-    $this->assertTrue($nid !== FALSE, t('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->uri, '@field_name' => $field_name, '@type_name' => $type_name)));
+    $this->assertTrue($nid !== FALSE, t('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->uri->value, '@field_name' => $field_name, '@type_name' => $type_name)));
 
     $node = node_load($nid, TRUE);
 
@@ -92,13 +92,13 @@ function testFileMaxSize() {
       $nid = $this->uploadNodeFile($small_file, $field_name, $type_name);
       $node = node_load($nid, TRUE);
       $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
-      $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
-      $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
+      $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize->value), '%maxsize' => $max_filesize)));
+      $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize->value), '%maxsize' => $max_filesize)));
 
       // Check that uploading the large file fails (1M limit).
       $nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
-      $error_message = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($large_file->filesize), '%maxsize' => format_size($file_limit)));
-      $this->assertRaw($error_message, t('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', array('%filesize' => format_size($large_file->filesize), '%maxsize' => $max_filesize)));
+      $error_message = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($large_file->filesize->value), '%maxsize' => format_size($file_limit)));
+      $this->assertRaw($error_message, t('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', array('%filesize' => format_size($large_file->filesize->value), '%maxsize' => $max_filesize)));
     }
 
     // Turn off the max filesize.
@@ -108,8 +108,8 @@ function testFileMaxSize() {
     $nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
-    $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
-    $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
+    $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize->value))));
+    $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize->value))));
   }
 
   /**
@@ -121,7 +121,7 @@ function testFileExtension() {
     $this->createFileField($field_name, $type_name);
 
     $test_file = $this->getTestFile('image');
-    list(, $test_file_extension) = explode('.', $test_file->filename);
+    list(, $test_file_extension) = explode('.', $test_file->filename->value);
 
     // Disable extension checking.
     $this->updateFileField($field_name, $type_name, array('file_extensions' => ''));
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
index 4991892..1a3eb4b 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
@@ -48,7 +48,7 @@ function testSingleValuedWidget() {
       $this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
 
       // Ensure the file can be downloaded.
-      $this->drupalGet(file_create_url($node_file->uri));
+      $this->drupalGet(file_create_url($node_file->uri->value));
       $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
 
       // Ensure the edit page has a remove button instead of an upload button.
@@ -111,7 +111,7 @@ function testMultiValuedWidget() {
       $this->drupalGet("node/add/$type_name");
       foreach (array($field_name2, $field_name) as $each_field_name) {
         for ($delta = 0; $delta < 3; $delta++) {
-          $edit = array('files[' . $each_field_name . '_' . LANGUAGE_NOT_SPECIFIED . '_' . $delta . '][]' => drupal_realpath($test_file->uri));
+          $edit = array('files[' . $each_field_name . '_' . LANGUAGE_NOT_SPECIFIED . '_' . $delta . '][]' => drupal_realpath($test_file->uri->value));
           // If the Upload button doesn't exist, drupalPost() will automatically
           // fail with an assertion message.
           $this->drupalPost(NULL, $edit, t('Upload'));
@@ -218,7 +218,7 @@ function testPrivateFileSetting() {
     $this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
 
     // Ensure the private file is available to the user who uploaded it.
-    $this->drupalGet(file_create_url($node_file->uri));
+    $this->drupalGet(file_create_url($node_file->uri->value));
     $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
 
     // Ensure we can't change 'uri_scheme' field settings while there are some
@@ -272,7 +272,7 @@ function testPrivateFileComment() {
     // Add a comment with a file.
     $text_file = $this->getTestFile('text');
     $edit = array(
-      'files[field_' . $name . '_' . LANGUAGE_NOT_SPECIFIED . '_' . 0 . ']' => drupal_realpath($text_file->uri),
+      'files[field_' . $name . '_' . LANGUAGE_NOT_SPECIFIED . '_' . 0 . ']' => drupal_realpath($text_file->uri->value),
       'comment_body[' . LANGUAGE_NOT_SPECIFIED . '][0][value]' => $comment_body = $this->randomName(),
     );
     $this->drupalPost(NULL, $edit, t('Save'));
@@ -288,14 +288,14 @@ function testPrivateFileComment() {
     $comment_file = $comment->{'field_' . $name}->entity;
     $this->assertFileExists($comment_file, t('New file saved to disk on node creation.'));
     // Test authenticated file download.
-    $url = file_create_url($comment_file->uri);
+    $url = file_create_url($comment_file->uri->value);
     $this->assertNotEqual($url, NULL, t('Confirmed that the URL is valid'));
-    $this->drupalGet(file_create_url($comment_file->uri));
+    $this->drupalGet(file_create_url($comment_file->uri->value));
     $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
 
     // Test anonymous file download.
     $this->drupalLogout();
-    $this->drupalGet(file_create_url($comment_file->uri));
+    $this->drupalGet(file_create_url($comment_file->uri->value));
     $this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
 
     // Unpublishes node.
@@ -304,7 +304,7 @@ function testPrivateFileComment() {
 
     // Ensures normal user can no longer download the file.
     $this->drupalLogin($user);
-    $this->drupalGet(file_create_url($comment_file->uri));
+    $this->drupalGet(file_create_url($comment_file->uri->value));
     $this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
   }
 
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php b/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php
index 2ec9dfa..fabf4ca 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileItemTest.php
@@ -81,7 +81,7 @@ public function testFileItem() {
     $this->assertEqual($entity->file_test->fid, $this->file->id());
     $this->assertEqual($entity->file_test->display, 1);
     $this->assertEqual($entity->file_test->description, $description);
-    $this->assertEqual($entity->file_test->entity->uri, $this->file->uri);
+    $this->assertEqual($entity->file_test->entity->uri->value, $this->file->uri->value);
     $this->assertEqual($entity->file_test->entity->id(), $this->file->id());
     $this->assertEqual($entity->file_test->entity->uuid(), $this->file->uuid());
 
@@ -94,7 +94,7 @@ public function testFileItem() {
 
     $entity->file_test->fid = $file2->id();
     $this->assertEqual($entity->file_test->entity->id(), $file2->id());
-    $this->assertEqual($entity->file_test->entity->uri, $file2->uri);
+    $this->assertEqual($entity->file_test->entity->uri->value, $file2->uri->value);
   }
 
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileManagedFileElementTest.php b/core/modules/file/lib/Drupal/file/Tests/FileManagedFileElementTest.php
index 6e43fc1..3b289c1 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileManagedFileElementTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileManagedFileElementTest.php
@@ -46,7 +46,7 @@ function testManagedFile() {
 
           // Submit a new file, without using the Upload button.
           $last_fid_prior = $this->getLastFileId();
-          $edit = array($file_field_name => drupal_realpath($test_file->uri));
+          $edit = array($file_field_name => drupal_realpath($test_file->uri->value));
           $this->drupalPost($path, $edit, t('Save'));
           $last_fid = $this->getLastFileId();
           $this->assertTrue($last_fid > $last_fid_prior, t('New file got saved.'));
@@ -61,7 +61,7 @@ function testManagedFile() {
             // Upload, then Submit.
             $last_fid_prior = $this->getLastFileId();
             $this->drupalGet($path);
-            $edit = array($file_field_name => drupal_realpath($test_file->uri));
+            $edit = array($file_field_name => drupal_realpath($test_file->uri->value));
             if ($ajax) {
               $this->drupalPostAJAX(NULL, $edit, $input_base_name . '_upload_button');
             }
@@ -92,7 +92,7 @@ function testManagedFile() {
 
             // Upload, then Remove, then Submit.
             $this->drupalGet($path);
-            $edit = array($file_field_name => drupal_realpath($test_file->uri));
+            $edit = array($file_field_name => drupal_realpath($test_file->uri->value));
             if ($ajax) {
               $this->drupalPostAJAX(NULL, $edit, $input_base_name . '_upload_button');
             }
@@ -120,7 +120,7 @@ function testManagedFile() {
 
     // The multiple file upload has additional conditions that need checking.
     $path = 'file/test/1/1/1';
-    $edit = array('files[nested_file][]' => drupal_realpath($test_file->uri));
+    $edit = array('files[nested_file][]' => drupal_realpath($test_file->uri->value));
     $fid_list = array();
 
     $this->drupalGet($path);
diff --git a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
index 42c0b09..94edf6a 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php
@@ -50,10 +50,10 @@ function testPrivateFile() {
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     // Ensure the file can be downloaded.
-    $this->drupalGet(file_create_url($node_file->uri));
+    $this->drupalGet(file_create_url($node_file->uri->value));
     $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
     $this->drupalLogOut();
-    $this->drupalGet(file_create_url($node_file->uri));
+    $this->drupalGet(file_create_url($node_file->uri->value));
     $this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.'));
 
     // Test with the field that should deny access through field access.
@@ -62,7 +62,7 @@ function testPrivateFile() {
     $node = node_load($nid, TRUE);
     $node_file = file_load($node->{$no_access_field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
     // Ensure the file cannot be downloaded.
-    $this->drupalGet(file_create_url($node_file->uri));
+    $this->drupalGet(file_create_url($node_file->uri->value));
     $this->assertResponse(403, t('Confirmed that access is denied for the file without view field access permission.'));
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
index f8f4807..8ac7826 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php
@@ -37,7 +37,7 @@ function testFileTokenReplacement() {
 
     $test_file = $this->getTestFile('text');
     // Coping a file to test uploads with non-latin filenames.
-    $filename = drupal_dirname($test_file->uri) . '/текстовый файл.txt';
+    $filename = drupal_dirname($test_file->uri->value) . '/текстовый файл.txt';
     $test_file = file_copy($test_file, $filename);
 
     // Create a new node with the uploaded file.
@@ -49,16 +49,16 @@ function testFileTokenReplacement() {
 
     // Generate and test sanitized tokens.
     $tests = array();
-    $tests['[file:fid]'] = $file->fid;
-    $tests['[file:name]'] = check_plain($file->filename);
-    $tests['[file:path]'] = check_plain($file->uri);
-    $tests['[file:mime]'] = check_plain($file->filemime);
-    $tests['[file:size]'] = format_size($file->filesize);
-    $tests['[file:url]'] = check_plain(file_create_url($file->uri));
-    $tests['[file:timestamp]'] = format_date($file->timestamp, 'medium', '', NULL, $language_interface->langcode);
-    $tests['[file:timestamp:short]'] = format_date($file->timestamp, 'short', '', NULL, $language_interface->langcode);
+    $tests['[file:fid]'] = $file->id();
+    $tests['[file:name]'] = check_plain($file->filename->value);
+    $tests['[file:path]'] = check_plain($file->uri->value);
+    $tests['[file:mime]'] = check_plain($file->filemime->value);
+    $tests['[file:size]'] = format_size($file->filesize->value);
+    $tests['[file:url]'] = check_plain(file_create_url($file->uri->value));
+    $tests['[file:timestamp]'] = format_date($file->timestamp->value, 'medium', '', NULL, $language_interface->langcode);
+    $tests['[file:timestamp:short]'] = format_date($file->timestamp->value, 'short', '', NULL, $language_interface->langcode);
     $tests['[file:owner]'] = check_plain(user_format_name($this->admin_user));
-    $tests['[file:owner:uid]'] = $file->uid;
+    $tests['[file:owner:uid]'] = $file->uid->value;
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
@@ -69,10 +69,10 @@ function testFileTokenReplacement() {
     }
 
     // Generate and test unsanitized tokens.
-    $tests['[file:name]'] = $file->filename;
-    $tests['[file:path]'] = $file->uri;
-    $tests['[file:mime]'] = $file->filemime;
-    $tests['[file:size]'] = format_size($file->filesize);
+    $tests['[file:name]'] = $file->filename->value;
+    $tests['[file:path]'] = $file->uri->value;
+    $tests['[file:mime]'] = $file->filemime->value;
+    $tests['[file:size]'] = format_size($file->filesize->value);
 
     foreach ($tests as $input => $expected) {
       $output = $token_service->replace($input, array('file' => $file), array('langcode' => $language_interface->langcode, 'sanitize' => FALSE));
diff --git a/core/modules/file/lib/Drupal/file/Tests/LoadTest.php b/core/modules/file/lib/Drupal/file/Tests/LoadTest.php
index aaaec27..bff9b6d 100644
--- a/core/modules/file/lib/Drupal/file/Tests/LoadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/LoadTest.php
@@ -52,14 +52,14 @@ function testSingleValues() {
     // Create a new file entity from scratch so we know the values.
     $file = $this->createFile('druplicon.txt', NULL, 'public');
 
-    $by_fid_file = file_load($file->fid);
+    $by_fid_file = file_load($file->id());
     $this->assertFileHookCalled('load');
     $this->assertTrue(is_object($by_fid_file), t('file_load() returned an object.'));
-    $this->assertEqual($by_fid_file->fid, $file->fid, t("Loading by fid got the same fid."), 'File');
-    $this->assertEqual($by_fid_file->uri, $file->uri, t("Loading by fid got the correct filepath."), 'File');
-    $this->assertEqual($by_fid_file->filename, $file->filename, t("Loading by fid got the correct filename."), 'File');
-    $this->assertEqual($by_fid_file->filemime, $file->filemime, t("Loading by fid got the correct MIME type."), 'File');
-    $this->assertEqual($by_fid_file->status, $file->status, t("Loading by fid got the correct status."), 'File');
+    $this->assertEqual($by_fid_file->id(), $file->id(), t("Loading by fid got the same fid."), 'File');
+    $this->assertEqual($by_fid_file->uri->value, $file->uri->value, t("Loading by fid got the correct filepath."), 'File');
+    $this->assertEqual($by_fid_file->filename->value, $file->filename->value, t("Loading by fid got the correct filename."), 'File');
+    $this->assertEqual($by_fid_file->filemime->value, $file->filemime->value, t("Loading by fid got the correct MIME type."), 'File');
+    $this->assertEqual($by_fid_file->status->value, $file->status->value, t("Loading by fid got the correct status."), 'File');
     $this->assertTrue($by_fid_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
   }
 
@@ -72,20 +72,20 @@ function testMultiple() {
 
     // Load by path.
     file_test_reset();
-    $by_path_files = entity_load_multiple_by_properties('file', array('uri' => $file->uri));
+    $by_path_files = entity_load_multiple_by_properties('file', array('uri' => $file->uri->value));
     $this->assertFileHookCalled('load');
     $this->assertEqual(1, count($by_path_files), t('file_load_multiple() returned an array of the correct size.'));
     $by_path_file = reset($by_path_files);
     $this->assertTrue($by_path_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
-    $this->assertEqual($by_path_file->fid, $file->fid, t("Loading by filepath got the correct fid."), 'File');
+    $this->assertEqual($by_path_file->id(), $file->id(), t("Loading by filepath got the correct fid."), 'File');
 
     // Load by fid.
     file_test_reset();
-    $by_fid_files = file_load_multiple(array($file->fid));
+    $by_fid_files = file_load_multiple(array($file->id()));
     $this->assertFileHooksCalled(array());
     $this->assertEqual(1, count($by_fid_files), t('file_load_multiple() returned an array of the correct size.'));
     $by_fid_file = reset($by_fid_files);
     $this->assertTrue($by_fid_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
-    $this->assertEqual($by_fid_file->uri, $file->uri, t("Loading by fid got the correct filepath."), 'File');
+    $this->assertEqual($by_fid_file->uri->value, $file->uri->value, t("Loading by fid got the correct filepath."), 'File');
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/MoveTest.php b/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
index 15868b1..d2d918b 100644
--- a/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
@@ -33,18 +33,18 @@ function testNormal() {
 
     // Check the return status and that the contents changed.
     $this->assertTrue($result, t('File moved successfully.'));
-    $this->assertFalse(file_exists($source->uri));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file correctly written.'));
+    $this->assertFalse(file_exists($source->uri->value));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of file correctly written.'));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('move', 'load', 'update'));
 
     // Make sure we got the same file back.
-    $this->assertEqual($source->fid, $result->fid, t("Source file id's' %fid is unchanged after move.", array('%fid' => $source->fid)));
+    $this->assertEqual($source->id(), $result->id(), t("Source file id's' %fid is unchanged after move.", array('%fid' => $source->id())));
 
     // Reload the file from the database and check that the changes were
     // actually saved.
-    $loaded_file = file_load($result->fid, TRUE);
+    $loaded_file = file_load($result->id(), TRUE);
     $this->assertTrue($loaded_file, t('File can be loaded from the database.'));
     $this->assertFileUnchanged($result, $loaded_file);
   }
@@ -61,27 +61,27 @@ function testExistingRename() {
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
-    $result = file_move(clone $source, $target->uri, FILE_EXISTS_RENAME);
+    $result = file_move(clone $source, $target->uri->value, FILE_EXISTS_RENAME);
 
     // Check the return status and that the contents changed.
     $this->assertTrue($result, t('File moved successfully.'));
-    $this->assertFalse(file_exists($source->uri));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file correctly written.'));
+    $this->assertFalse(file_exists($source->uri->value));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of file correctly written.'));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('move', 'load', 'update'));
 
     // Compare the returned value to what made it into the database.
-    $this->assertFileUnchanged($result, file_load($result->fid, TRUE));
+    $this->assertFileUnchanged($result, file_load($result->id(), TRUE));
     // The target file should not have been altered.
-    $this->assertFileUnchanged($target, file_load($target->fid, TRUE));
+    $this->assertFileUnchanged($target, file_load($target->id(), TRUE));
     // Make sure we end up with two distinct files afterwards.
     $this->assertDifferentFile($target, $result);
 
     // Compare the source and results.
-    $loaded_source = file_load($source->fid, TRUE);
-    $this->assertEqual($loaded_source->fid, $result->fid, t("Returned file's id matches the source."));
-    $this->assertNotEqual($loaded_source->uri, $source->uri, t("Returned file path has changed from the original."));
+    $loaded_source = file_load($source->id(), TRUE);
+    $this->assertEqual($loaded_source->id(), $result->id(), t("Returned file's id matches the source."));
+    $this->assertNotEqual($loaded_source->uri->value, $source->uri->value, t("Returned file path has changed from the original."));
   }
 
   /**
@@ -96,11 +96,11 @@ function testExistingReplace() {
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
-    $result = file_move(clone $source, $target->uri, FILE_EXISTS_REPLACE);
+    $result = file_move(clone $source, $target->uri->value, FILE_EXISTS_REPLACE);
 
     // Look at the results.
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were overwritten.'));
-    $this->assertFalse(file_exists($source->uri));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of file were overwritten.'));
+    $this->assertFalse(file_exists($source->uri->value));
     $this->assertTrue($result, t('File moved successfully.'));
 
     // Check that the correct hooks were called.
@@ -108,7 +108,7 @@ function testExistingReplace() {
 
     // Reload the file from the database and check that the changes were
     // actually saved.
-    $loaded_result = file_load($result->fid, TRUE);
+    $loaded_result = file_load($result->id(), TRUE);
     $this->assertFileUnchanged($result, $loaded_result);
     // Check that target was re-used.
     $this->assertSameFile($target, $loaded_result);
@@ -126,16 +126,16 @@ function testExistingReplaceSelf() {
 
     // Copy the file over itself. Clone the object so we don't have to worry
     // about the function changing our reference copy.
-    $result = file_move(clone $source, $source->uri, FILE_EXISTS_REPLACE);
+    $result = file_move(clone $source, $source->uri->value, FILE_EXISTS_REPLACE);
     $this->assertFalse($result, t('File move failed.'));
-    $this->assertEqual($contents, file_get_contents($source->uri), t('Contents of file were not altered.'));
+    $this->assertEqual($contents, file_get_contents($source->uri->value), t('Contents of file were not altered.'));
 
     // Check that no hooks were called while failing.
     $this->assertFileHooksCalled(array());
 
     // Load the file from the database and make sure it is identical to what
     // was returned.
-    $this->assertFileUnchanged($source, file_load($source->fid, TRUE));
+    $this->assertFileUnchanged($source, file_load($source->id(), TRUE));
   }
 
   /**
@@ -150,19 +150,19 @@ function testExistingError() {
 
     // Clone the object so we don't have to worry about the function changing
     // our reference copy.
-    $result = file_move(clone $source, $target->uri, FILE_EXISTS_ERROR);
+    $result = file_move(clone $source, $target->uri->value, FILE_EXISTS_ERROR);
 
     // Check the return status and that the contents did not change.
     $this->assertFalse($result, t('File move failed.'));
-    $this->assertTrue(file_exists($source->uri));
-    $this->assertEqual($contents, file_get_contents($target->uri), t('Contents of file were not altered.'));
+    $this->assertTrue(file_exists($source->uri->value));
+    $this->assertEqual($contents, file_get_contents($target->uri->value), t('Contents of file were not altered.'));
 
     // Check that no hooks were called while failing.
     $this->assertFileHooksCalled(array());
 
     // Load the file from the database and make sure it is identical to what
     // was returned.
-    $this->assertFileUnchanged($source, file_load($source->fid, TRUE));
-    $this->assertFileUnchanged($target, file_load($target->fid, TRUE));
+    $this->assertFileUnchanged($source, file_load($source->id(), TRUE));
+    $this->assertFileUnchanged($target, file_load($target->id(), TRUE));
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
index ecdb201..249541f 100644
--- a/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveDataTest.php
@@ -28,17 +28,17 @@ function testWithoutFilename() {
     $result = file_save_data($contents);
     $this->assertTrue($result, t('Unnamed file saved correctly.'));
 
-    $this->assertEqual(file_default_scheme(), file_uri_scheme($result->uri), t("File was placed in Drupal's files directory."));
-    $this->assertEqual($result->filename, drupal_basename($result->uri), t("Filename was set to the file's basename."));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
-    $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.'));
-    $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+    $this->assertEqual(file_default_scheme(), file_uri_scheme($result->uri->value), t("File was placed in Drupal's files directory."));
+    $this->assertEqual($result->filename->value, drupal_basename($result->uri->value), t("Filename was set to the file's basename."));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of the file are correct.'));
+    $this->assertEqual($result->filemime->value, 'application/octet-stream', t('A MIME type was set.'));
+    $this->assertEqual($result->status->value, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('insert'));
 
     // Verify that what was returned is what's in the database.
-    $this->assertFileUnchanged($result, file_load($result->fid, TRUE));
+    $this->assertFileUnchanged($result, file_load($result->id(), TRUE));
   }
 
   /**
@@ -53,17 +53,17 @@ function testWithFilename() {
     $result = file_save_data($contents, 'public://' . $filename);
     $this->assertTrue($result, t('Unnamed file saved correctly.'));
 
-    $this->assertEqual('public', file_uri_scheme($result->uri), t("File was placed in Drupal's files directory."));
-    $this->assertEqual($filename, drupal_basename($result->uri), t('File was named correctly.'));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
-    $this->assertEqual($result->filemime, 'text/plain', t('A MIME type was set.'));
-    $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+    $this->assertEqual('public', file_uri_scheme($result->uri->value), t("File was placed in Drupal's files directory."));
+    $this->assertEqual($filename, drupal_basename($result->uri->value), t('File was named correctly.'));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of the file are correct.'));
+    $this->assertEqual($result->filemime->value, 'text/plain', t('A MIME type was set.'));
+    $this->assertEqual($result->status->value, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('insert'));
 
     // Verify that what was returned is what's in the database.
-    $this->assertFileUnchanged($result, file_load($result->fid, TRUE));
+    $this->assertFileUnchanged($result, file_load($result->id(), TRUE));
   }
 
   /**
@@ -74,24 +74,24 @@ function testExistingRename() {
     $existing = $this->createFile();
     $contents = $this->randomName(8);
 
-    $result = file_save_data($contents, $existing->uri, FILE_EXISTS_RENAME);
+    $result = file_save_data($contents, $existing->uri->value, FILE_EXISTS_RENAME);
     $this->assertTrue($result, t("File saved successfully."));
 
-    $this->assertEqual('public', file_uri_scheme($result->uri), t("File was placed in Drupal's files directory."));
-    $this->assertEqual($result->filename, $existing->filename, t("Filename was set to the basename of the source, rather than that of the renamed file."));
-    $this->assertEqual($contents, file_get_contents($result->uri), t("Contents of the file are correct."));
-    $this->assertEqual($result->filemime, 'application/octet-stream', t("A MIME type was set."));
-    $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+    $this->assertEqual('public', file_uri_scheme($result->uri->value), t("File was placed in Drupal's files directory."));
+    $this->assertEqual($result->filename->value, $existing->filename->value, t("Filename was set to the basename of the source, rather than that of the renamed file."));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t("Contents of the file are correct."));
+    $this->assertEqual($result->filemime->value, 'application/octet-stream', t("A MIME type was set."));
+    $this->assertEqual($result->status->value, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('insert'));
 
     // Ensure that the existing file wasn't overwritten.
     $this->assertDifferentFile($existing, $result);
-    $this->assertFileUnchanged($existing, file_load($existing->fid, TRUE));
+    $this->assertFileUnchanged($existing, file_load($existing->id(), TRUE));
 
     // Verify that was returned is what's in the database.
-    $this->assertFileUnchanged($result, file_load($result->fid, TRUE));
+    $this->assertFileUnchanged($result, file_load($result->id(), TRUE));
   }
 
   /**
@@ -102,14 +102,14 @@ function testExistingReplace() {
     $existing = $this->createFile();
     $contents = $this->randomName(8);
 
-    $result = file_save_data($contents, $existing->uri, FILE_EXISTS_REPLACE);
+    $result = file_save_data($contents, $existing->uri->value, FILE_EXISTS_REPLACE);
     $this->assertTrue($result, t('File saved successfully.'));
 
-    $this->assertEqual('public', file_uri_scheme($result->uri), t("File was placed in Drupal's files directory."));
-    $this->assertEqual($result->filename, $existing->filename, t('Filename was set to the basename of the existing file, rather than preserving the original name.'));
-    $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
-    $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.'));
-    $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+    $this->assertEqual('public', file_uri_scheme($result->uri->value), t("File was placed in Drupal's files directory."));
+    $this->assertEqual($result->filename->value, $existing->filename->value, t('Filename was set to the basename of the existing file, rather than preserving the original name.'));
+    $this->assertEqual($contents, file_get_contents($result->uri->value), t('Contents of the file are correct.'));
+    $this->assertEqual($result->filemime->value, 'application/octet-stream', t('A MIME type was set.'));
+    $this->assertEqual($result->status->value, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('load', 'update'));
@@ -118,7 +118,7 @@ function testExistingReplace() {
     $this->assertSameFile($existing, $result);
 
     // Verify that what was returned is what's in the database.
-    $this->assertFileUnchanged($result, file_load($result->fid, TRUE));
+    $this->assertFileUnchanged($result, file_load($result->id(), TRUE));
   }
 
   /**
@@ -129,14 +129,14 @@ function testExistingError() {
     $existing = $this->createFile(NULL, $contents);
 
     // Check the overwrite error.
-    $result = file_save_data('asdf', $existing->uri, FILE_EXISTS_ERROR);
+    $result = file_save_data('asdf', $existing->uri->value, FILE_EXISTS_ERROR);
     $this->assertFalse($result, t('Overwriting a file fails when FILE_EXISTS_ERROR is specified.'));
-    $this->assertEqual($contents, file_get_contents($existing->uri), t('Contents of existing file were unchanged.'));
+    $this->assertEqual($contents, file_get_contents($existing->uri->value), t('Contents of existing file were unchanged.'));
 
     // Check that no hooks were called while failing.
     $this->assertFileHooksCalled(array());
 
     // Ensure that the existing file wasn't overwritten.
-    $this->assertFileUnchanged($existing, file_load($existing->fid, TRUE));
+    $this->assertFileUnchanged($existing, file_load($existing->id(), TRUE));
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveTest.php
index e2611e5..50cfe5b 100644
--- a/core/modules/file/lib/Drupal/file/Tests/SaveTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveTest.php
@@ -29,7 +29,7 @@ function testFileSave() {
       'timestamp' => 1,
       'status' => FILE_STATUS_PERMANENT,
     ));
-    file_put_contents($file->uri, 'hello world');
+    file_put_contents($file->uri->value, 'hello world');
 
     // Save it, inserting a new record.
     $file->save();
@@ -37,29 +37,29 @@ function testFileSave() {
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('insert'));
 
-    $this->assertTrue($file->fid > 0, t("A new file ID is set when saving a new file to the database."), 'File');
-    $loaded_file = db_query('SELECT * FROM {file_managed} f WHERE f.fid = :fid', array(':fid' => $file->fid))->fetchObject();
+    $this->assertTrue($file->id() > 0, t("A new file ID is set when saving a new file to the database."), 'File');
+    $loaded_file = file_load($file->id());
     $this->assertNotNull($loaded_file, t("Record exists in the database."));
-    $this->assertEqual($loaded_file->status, $file->status, t("Status was saved correctly."));
-    $this->assertEqual($file->filesize, filesize($file->uri), t("File size was set correctly."), 'File');
-    $this->assertTrue($file->timestamp > 1, t("File size was set correctly."), 'File');
-    $this->assertEqual($loaded_file->langcode, LANGUAGE_NOT_SPECIFIED, t("Langcode was defaulted correctly."));
+    $this->assertEqual($loaded_file->status->value, $file->status->value, t("Status was saved correctly."));
+    $this->assertEqual($file->filesize->value, filesize($file->uri->value), t("File size was set correctly."), 'File');
+    $this->assertTrue($file->timestamp->value > 1, t("File size was set correctly."), 'File');
+    $this->assertEqual($loaded_file->langcode->value, LANGUAGE_NOT_SPECIFIED, t("Langcode was defaulted correctly."));
 
     // Resave the file, updating the existing record.
     file_test_reset();
-    $file->status = 7;
+    $file->status->value = 7;
     $file->langcode = 'en';
     $file->save();
 
     // Check that the correct hooks were called.
     $this->assertFileHooksCalled(array('load', 'update'));
 
-    $this->assertEqual($file->fid, $file->fid, t("The file ID of an existing file is not changed when updating the database."), 'File');
-    $this->assertTrue($file->timestamp >= $file->timestamp, t("Timestamp didn't go backwards."), 'File');
-    $loaded_file = db_query('SELECT * FROM {file_managed} f WHERE f.fid = :fid', array(':fid' => $file->fid))->fetchObject();
+    $this->assertEqual($file->id(), $file->id(), t("The file ID of an existing file is not changed when updating the database."), 'File');
+    $this->assertTrue($file->timestamp->value >= $file->timestamp->value, t("Timestamp didn't go backwards."), 'File');
+    $loaded_file = file_load($file->id());
     $this->assertNotNull($loaded_file, t("Record still exists in the database."), 'File');
-    $this->assertEqual($loaded_file->status, $file->status, t("Status was saved correctly."));
-    $this->assertEqual($loaded_file->langcode, 'en', t("Langcode was saved correctly."));
+    $this->assertEqual($loaded_file->status->value, $file->status->value, t("Status was saved correctly."));
+    $this->assertEqual($loaded_file->langcode->value, 'en', t("Langcode was saved correctly."));
 
     // Try to insert a second file with the same name apart from case insensitivity
     // to ensure the 'uri' index allows for filenames with different cases.
@@ -71,7 +71,7 @@ function testFileSave() {
       'timestamp' => 1,
       'status' => FILE_STATUS_PERMANENT,
     ));
-    file_put_contents($file->uri, 'hello world');
+    file_put_contents($file->uri->value, 'hello world');
     $file->save();
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
index 90fec9d..84940a9 100644
--- a/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php
@@ -42,8 +42,8 @@ function setUp() {
     $image_files = $this->drupalGetTestFiles('image');
     $this->image = entity_create('file', (array) current($image_files));
 
-    list(, $this->image_extension) = explode('.', $this->image->filename);
-    $this->assertTrue(is_file($this->image->uri), t("The image file we're going to upload exists."));
+    list(, $this->image_extension) = explode('.', $this->image->filename->value);
+    $this->assertTrue(is_file($this->image->uri->value), t("The image file we're going to upload exists."));
 
     $this->phpfile = current($this->drupalGetTestFiles('php'));
     $this->assertTrue(is_file($this->phpfile->uri), t("The PHP file we're going to upload exists."));
@@ -53,7 +53,7 @@ function setUp() {
     // Upload with replace to guarantee there's something there.
     $edit = array(
       'file_test_replace' => FILE_EXISTS_REPLACE,
-      'files[file_test_upload]' => drupal_realpath($this->image->uri),
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value),
     );
     $this->drupalPost('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, t('Received a 200 response for posted test file.'));
@@ -74,7 +74,7 @@ function testNormal() {
     $file1 = file_load($max_fid_after);
     $this->assertTrue($file1, t('Loaded the file.'));
     // MIME type of the uploaded image may be either image/jpeg or image/png.
-    $this->assertEqual(substr($file1->filemime, 0, 5), 'image', 'A MIME type was set.');
+    $this->assertEqual(substr($file1->filemime->value, 0, 5), 'image', 'A MIME type was set.');
 
     // Reset the hook counters to get rid of the 'load' we just called.
     file_test_reset();
@@ -92,14 +92,14 @@ function testNormal() {
     $this->assertFileHooksCalled(array('validate', 'insert'));
 
     $file2 = file_load($max_fid_after);
-    $this->assertTrue($file2);
+    $this->assertTrue($file2, 'Loaded the file');
     // MIME type of the uploaded image may be either image/jpeg or image/png.
-    $this->assertEqual(substr($file2->filemime, 0, 5), 'image', 'A MIME type was set.');
+    $this->assertEqual(substr($file2->filemime->value, 0, 5), 'image', 'A MIME type was set.');
 
     // Load both files using file_load_multiple().
-    $files = file_load_multiple(array($file1->fid, $file2->fid));
-    $this->assertTrue(isset($files[$file1->fid]), t('File was loaded successfully'));
-    $this->assertTrue(isset($files[$file2->fid]), t('File was loaded successfully'));
+    $files = file_load_multiple(array($file1->id(), $file2->id()));
+    $this->assertTrue(isset($files[$file1->id()]), t('File was loaded successfully'));
+    $this->assertTrue(isset($files[$file2->id()]), t('File was loaded successfully'));
 
     // Upload a third file to a subdirectory.
     $image3 = current($this->drupalGetTestFiles('image'));
@@ -126,7 +126,7 @@ function testHandleExtension() {
     $extensions = 'foo';
     $edit = array(
       'file_test_replace' => FILE_EXISTS_REPLACE,
-      'files[file_test_upload]' => drupal_realpath($this->image->uri),
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value),
       'extensions' => $extensions,
     );
 
@@ -146,7 +146,7 @@ function testHandleExtension() {
     // Now tell file_save_upload() to allow the extension of our test image.
     $edit = array(
       'file_test_replace' => FILE_EXISTS_REPLACE,
-      'files[file_test_upload]' => drupal_realpath($this->image->uri),
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value),
       'extensions' => $extensions,
     );
 
@@ -164,7 +164,7 @@ function testHandleExtension() {
     // Now tell file_save_upload() to allow any extension.
     $edit = array(
       'file_test_replace' => FILE_EXISTS_REPLACE,
-      'files[file_test_upload]' => drupal_realpath($this->image->uri),
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value),
       'allow_all_extensions' => TRUE,
     );
     $this->drupalPost('file-test/upload', $edit, t('Submit'));
@@ -225,18 +225,18 @@ function testHandleDangerousFile() {
   function testHandleFileMunge() {
     // Ensure insecure uploads are disabled for this test.
     config('system.file')->set('allow_insecure_uploads', 0)->save();
-    $this->image = file_move($this->image, $this->image->uri . '.foo.' . $this->image_extension);
+    $this->image = file_move($this->image, $this->image->uri->value . '.foo.' . $this->image_extension);
 
     // Reset the hook counters to get rid of the 'move' we just called.
     file_test_reset();
 
     $extensions = $this->image_extension;
     $edit = array(
-      'files[file_test_upload]' => drupal_realpath($this->image->uri),
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value),
       'extensions' => $extensions,
     );
 
-    $munged_filename = $this->image->filename;
+    $munged_filename = $this->image->filename->value;
     $munged_filename = substr($munged_filename, 0, strrpos($munged_filename, '.'));
     $munged_filename .= '_.' . $this->image_extension;
 
@@ -254,14 +254,14 @@ function testHandleFileMunge() {
     file_test_reset();
 
     $edit = array(
-      'files[file_test_upload]' => drupal_realpath($this->image->uri),
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value),
       'allow_all_extensions' => TRUE,
     );
 
     $this->drupalPost('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, t('Received a 200 response for posted test file.'));
     $this->assertNoRaw(t('For security reasons, your upload has been renamed'), t('Found no security message.'));
-    $this->assertRaw(t('File name is !filename', array('!filename' => $this->image->filename)), t('File was not munged when allowing any extension.'));
+    $this->assertRaw(t('File name is !filename', array('!filename' => $this->image->filename->value)), t('File was not munged when allowing any extension.'));
     $this->assertRaw(t('You WIN!'), t('Found the success message.'));
 
     // Check that the correct hooks were called.
@@ -274,7 +274,7 @@ function testHandleFileMunge() {
   function testExistingRename() {
     $edit = array(
       'file_test_replace' => FILE_EXISTS_RENAME,
-      'files[file_test_upload]' => drupal_realpath($this->image->uri)
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value)
     );
     $this->drupalPost('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, t('Received a 200 response for posted test file.'));
@@ -290,7 +290,7 @@ function testExistingRename() {
   function testExistingReplace() {
     $edit = array(
       'file_test_replace' => FILE_EXISTS_REPLACE,
-      'files[file_test_upload]' => drupal_realpath($this->image->uri)
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value)
     );
     $this->drupalPost('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, t('Received a 200 response for posted test file.'));
@@ -306,7 +306,7 @@ function testExistingReplace() {
   function testExistingError() {
     $edit = array(
       'file_test_replace' => FILE_EXISTS_ERROR,
-      'files[file_test_upload]' => drupal_realpath($this->image->uri)
+      'files[file_test_upload]' => drupal_realpath($this->image->uri->value)
     );
     $this->drupalPost('file-test/upload', $edit, t('Submit'));
     $this->assertResponse(200, t('Received a 200 response for posted test file.'));
diff --git a/core/modules/file/lib/Drupal/file/Tests/UsageTest.php b/core/modules/file/lib/Drupal/file/Tests/UsageTest.php
index 00c82ef..4300b95 100644
--- a/core/modules/file/lib/Drupal/file/Tests/UsageTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/UsageTest.php
@@ -26,7 +26,7 @@ function testGetUsage() {
     $file = $this->createFile();
     db_insert('file_usage')
       ->fields(array(
-        'fid' => $file->fid,
+        'fid' => $file->id(),
         'module' => 'testing',
         'type' => 'foo',
         'id' => 1,
@@ -35,7 +35,7 @@ function testGetUsage() {
       ->execute();
     db_insert('file_usage')
       ->fields(array(
-        'fid' => $file->fid,
+        'fid' => $file->id(),
         'module' => 'testing',
         'type' => 'bar',
         'id' => 2,
@@ -65,7 +65,7 @@ function testAddUsage() {
 
     $usage = db_select('file_usage', 'f')
       ->fields('f')
-      ->condition('f.fid', $file->fid)
+      ->condition('f.fid', $file->id())
       ->execute()
       ->fetchAllAssoc('id');
     $this->assertEqual(count($usage), 2, t('Created two records'));
@@ -84,7 +84,7 @@ function testRemoveUsage() {
     $file = $this->createFile();
     db_insert('file_usage')
       ->fields(array(
-        'fid' => $file->fid,
+        'fid' => $file->id(),
         'module' => 'testing',
         'type' => 'bar',
         'id' => 2,
@@ -96,7 +96,7 @@ function testRemoveUsage() {
     file_usage()->delete($file, 'testing', 'bar', 2);
     $count = db_select('file_usage', 'f')
       ->fields('f', array('count'))
-      ->condition('f.fid', $file->fid)
+      ->condition('f.fid', $file->id())
       ->execute()
       ->fetchField();
     $this->assertEqual(2, $count, t('The count was decremented correctly.'));
@@ -105,7 +105,7 @@ function testRemoveUsage() {
     file_usage()->delete($file, 'testing', 'bar', 2, 2);
     $count = db_select('file_usage', 'f')
       ->fields('f', array('count'))
-      ->condition('f.fid', $file->fid)
+      ->condition('f.fid', $file->id())
       ->execute()
       ->fetchField();
     $this->assertIdentical(FALSE, $count, t('The count was removed entirely when empty.'));
@@ -114,7 +114,7 @@ function testRemoveUsage() {
     file_usage()->delete($file, 'testing', 'bar', 2);
     $count = db_select('file_usage', 'f')
       ->fields('f', array('count'))
-      ->condition('f.fid', $file->fid)
+      ->condition('f.fid', $file->id())
       ->execute()
       ->fetchField();
     $this->assertIdentical(FALSE, $count, t('Decrementing non-exist record complete.'));
@@ -134,35 +134,35 @@ function testTempFileCleanup() {
         'status' => 0,
         'timestamp' => 1,
       ))
-      ->condition('fid', $temp_old->fid)
+      ->condition('fid', $temp_old->id())
       ->execute();
-    $this->assertTrue(file_exists($temp_old->uri), t('Old temp file was created correctly.'));
+    $this->assertTrue(file_exists($temp_old->uri->value), t('Old temp file was created correctly.'));
 
     // Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
     $temp_new = file_save_data('');
     db_update('file_managed')
       ->fields(array('status' => 0))
-      ->condition('fid', $temp_new->fid)
+      ->condition('fid', $temp_new->id())
       ->execute();
-    $this->assertTrue(file_exists($temp_new->uri), t('New temp file was created correctly.'));
+    $this->assertTrue(file_exists($temp_new->uri->value), t('New temp file was created correctly.'));
 
     // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
     $perm_old = file_save_data('');
     db_update('file_managed')
       ->fields(array('timestamp' => 1))
-      ->condition('fid', $temp_old->fid)
+      ->condition('fid', $temp_old->id())
       ->execute();
-    $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was created correctly.'));
+    $this->assertTrue(file_exists($perm_old->uri->value), t('Old permanent file was created correctly.'));
 
     // Permanent file that is newer than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
     $perm_new = file_save_data('');
-    $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was created correctly.'));
+    $this->assertTrue(file_exists($perm_new->uri->value), t('New permanent file was created correctly.'));
 
     // Run cron and then ensure that only the old, temp file was deleted.
     $this->cronRun();
-    $this->assertFalse(file_exists($temp_old->uri), t('Old temp file was correctly removed.'));
-    $this->assertTrue(file_exists($temp_new->uri), t('New temp file was correctly ignored.'));
-    $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was correctly ignored.'));
-    $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was correctly ignored.'));
+    $this->assertFalse(file_exists($temp_old->uri->value), t('Old temp file was correctly removed.'));
+    $this->assertTrue(file_exists($temp_new->uri->value), t('New temp file was correctly ignored.'));
+    $this->assertTrue(file_exists($perm_old->uri->value), t('Old permanent file was correctly ignored.'));
+    $this->assertTrue(file_exists($perm_new->uri->value), t('New permanent file was correctly ignored.'));
   }
 }
diff --git a/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php b/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
index d8164c1..97435a3 100644
--- a/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/ValidatorTest.php
@@ -23,12 +23,12 @@ function setUp() {
     parent::setUp();
 
     $this->image = entity_create('file', array());
-    $this->image->uri = 'core/misc/druplicon.png';
-    $this->image->filename = drupal_basename($this->image->uri);
+    $this->image->uri->value = 'core/misc/druplicon.png';
+    $this->image->filename = drupal_basename($this->image->uri->value);
 
     $this->non_image = entity_create('file', array());
-    $this->non_image->uri = 'core/misc/jquery.js';
-    $this->non_image->filename = drupal_basename($this->non_image->uri);
+    $this->non_image->uri->value = 'core/misc/jquery.js';
+    $this->non_image->filename = drupal_basename($this->non_image->uri->value);
   }
 
   /**
@@ -39,7 +39,7 @@ function testFileValidateExtensions() {
     $errors = file_validate_extensions($file, 'asdf txt pork');
     $this->assertEqual(count($errors), 0, t('Valid extension accepted.'), 'File');
 
-    $file->filename = 'asdf.txt';
+    $file->filename->value = 'asdf.txt';
     $errors = file_validate_extensions($file, 'exe png');
     $this->assertEqual(count($errors), 1, t('Invalid extension blocked.'), 'File');
   }
@@ -48,11 +48,11 @@ function testFileValidateExtensions() {
    *  This ensures a specific file is actually an image.
    */
   function testFileValidateIsImage() {
-    $this->assertTrue(file_exists($this->image->uri), t('The image being tested exists.'), 'File');
+    $this->assertTrue(file_exists($this->image->uri->value), t('The image being tested exists.'), 'File');
     $errors = file_validate_is_image($this->image);
     $this->assertEqual(count($errors), 0, t('No error reported for our image file.'), 'File');
 
-    $this->assertTrue(file_exists($this->non_image->uri), t('The non-image being tested exists.'), 'File');
+    $this->assertTrue(file_exists($this->non_image->uri->value), t('The non-image being tested exists.'), 'File');
     $errors = file_validate_is_image($this->non_image);
     $this->assertEqual(count($errors), 1, t('An error reported for our non-image file.'), 'File');
   }
@@ -82,12 +82,12 @@ function testFileValidateImageResolution() {
     if ($this->container->has('image.toolkit')) {
       // Copy the image so that the original doesn't get resized.
       copy('core/misc/druplicon.png', 'temporary://druplicon.png');
-      $this->image->uri = 'temporary://druplicon.png';
+      $this->image->uri->value = 'temporary://druplicon.png';
 
       $errors = file_validate_image_resolution($this->image, '10x5');
       $this->assertEqual(count($errors), 0, t('No errors should be reported when an oversized image can be scaled down.'), 'File');
 
-      $info = image_get_info($this->image->uri);
+      $info = image_get_info($this->image->uri->value);
       $this->assertTrue($info['width'] <= 10, t('Image scaled to correct width.'), 'File');
       $this->assertTrue($info['height'] <= 5, t('Image scaled to correct height.'), 'File');
 
@@ -108,18 +108,18 @@ function testFileValidateNameLength() {
     $file = entity_create('file', array());
 
     // Add a filename with an allowed length and test it.
-    $file->filename = str_repeat('x', 240);
-    $this->assertEqual(strlen($file->filename), 240);
+    $file->filename->value = str_repeat('x', 240);
+    $this->assertEqual(strlen($file->filename->value), 240);
     $errors = file_validate_name_length($file);
     $this->assertEqual(count($errors), 0, t('No errors reported for 240 length filename.'), 'File');
 
     // Add a filename with a length too long and test it.
-    $file->filename = str_repeat('x', 241);
+    $file->filename->value = str_repeat('x', 241);
     $errors = file_validate_name_length($file);
     $this->assertEqual(count($errors), 1, t('An error reported for 241 length filename.'), 'File');
 
     // Add a filename with an empty string and test it.
-    $file->filename = '';
+    $file->filename->value = '';
     $errors = file_validate_name_length($file);
     $this->assertEqual(count($errors), 1, t('An error reported for 0 length filename.'), 'File');
   }
diff --git a/core/modules/file/tests/file_test/file_test.module b/core/modules/file/tests/file_test/file_test.module
index 8cff297..7189fdf 100644
--- a/core/modules/file/tests/file_test/file_test.module
+++ b/core/modules/file/tests/file_test/file_test.module
@@ -129,9 +129,9 @@ function _file_test_form_submit(&$form, &$form_state) {
   $file = file_save_upload('file_test_upload', $validators, $destination, 0, $form_state['values']['file_test_replace']);
   if ($file) {
     $form_state['values']['file_test_upload'] = $file;
-    drupal_set_message(t('File @filepath was uploaded.', array('@filepath' => $file->uri)));
-    drupal_set_message(t('File name is @filename.', array('@filename' => $file->filename)));
-    drupal_set_message(t('File MIME type is @mimetype.', array('@mimetype' => $file->filemime)));
+    drupal_set_message(t('File @filepath was uploaded.', array('@filepath' => $file->uri->value)));
+    drupal_set_message(t('File name is @filename.', array('@filename' => $file->filename->value)));
+    drupal_set_message(t('File MIME type is @mimetype.', array('@mimetype' => $file->filemime->value)));
     drupal_set_message(t('You WIN!'));
   }
   elseif ($file === FALSE) {
@@ -256,7 +256,7 @@ function file_test_set_return($op, $value) {
  */
 function file_test_file_load($files) {
   foreach ($files as $file) {
-    _file_test_log_call('load', array($file->fid));
+    _file_test_log_call('load', array($file->id()));
     // Assign a value on the object so that we can test that the $file is passed
     // by reference.
     $file->file_test['loaded'] = TRUE;
@@ -267,7 +267,7 @@ function file_test_file_load($files) {
  * Implements hook_file_validate().
  */
 function file_test_file_validate(File $file) {
-  _file_test_log_call('validate', array($file->fid));
+  _file_test_log_call('validate', array($file->id()));
   return _file_test_get_return('validate');
 }
 
@@ -283,35 +283,35 @@ function file_test_file_download($uri) {
  * Implements hook_file_insert().
  */
 function file_test_file_insert(File $file) {
-  _file_test_log_call('insert', array($file->fid));
+  _file_test_log_call('insert', array($file->id()));
 }
 
 /**
  * Implements hook_file_update().
  */
 function file_test_file_update(File $file) {
-  _file_test_log_call('update', array($file->fid));
+  _file_test_log_call('update', array($file->id()));
 }
 
 /**
  * Implements hook_file_copy().
  */
 function file_test_file_copy(File $file, $source) {
-  _file_test_log_call('copy', array($file->fid, $source->fid));
+  _file_test_log_call('copy', array($file->id(), $source->id()));
 }
 
 /**
  * Implements hook_file_move().
  */
 function file_test_file_move(File $file, File $source) {
-  _file_test_log_call('move', array($file->fid, $source->fid));
+  _file_test_log_call('move', array($file->id(), $source->id()));
 }
 
 /**
  * Implements hook_file_predelete().
  */
 function file_test_file_predelete(File $file) {
-  _file_test_log_call('delete', array($file->fid));
+  _file_test_log_call('delete', array($file->id()));
 }
 
 /**
diff --git a/core/modules/image/image.field.inc b/core/modules/image/image.field.inc
index a287620..6c4f6f4 100644
--- a/core/modules/image/image.field.inc
+++ b/core/modules/image/image.field.inc
@@ -261,7 +261,7 @@ function image_field_presave(EntityInterface $entity, $field, $instance, $langco
   // Determine the dimensions if necessary.
   foreach ($items as &$item) {
     if (!isset($item['width']) || !isset($item['height'])) {
-      $info = image_get_info(file_load($item['fid'])->uri);
+      $info = image_get_info(file_load($item['fid'])->uri->value);
 
       if (is_array($info)) {
         $item['width'] = $info['width'];
@@ -323,7 +323,7 @@ function image_field_widget_process($element, &$form_state, $form) {
     $file = reset($element['#files']);
     $variables = array(
       'style_name' => $element['#preview_image_style'],
-      'uri' => $file->uri,
+      'uri' => $file->uri->value,
     );
 
     // Determine image dimensions.
@@ -332,7 +332,7 @@ function image_field_widget_process($element, &$form_state, $form) {
       $variables['height'] = $element['#value']['height'];
     }
     else {
-      $info = image_get_info($file->uri);
+      $info = image_get_info($file->uri->value);
 
       if (is_array($info)) {
         $variables['width'] = $info['width'];
@@ -440,7 +440,7 @@ function theme_image_widget($variables) {
   $output .= '<div class="image-widget-data">';
   if (!empty($element['fids']['#value'])) {
     $file = reset($element['#files']);
-    $element['file_' . $file->fid]['filename']['#markup'] .= ' <span class="file-size">(' . format_size($file->filesize) . ')</span> ';
+    $element['file_' . $file->id()]['filename']['#markup'] .= ' <span class="file-size">(' . format_size($file->filesize->value) . ')</span> ';
   }
   $output .= drupal_render_children($element);
   $output .= '</div>';
@@ -468,6 +468,10 @@ function theme_image_formatter($variables) {
     unset($item['title']);
   }
 
+  if (isset($item['fid']) && empty($item['uri'])) {
+    $item['uri'] = file_load($item['fid'])->uri->value;
+  }
+
   if ($variables['image_style']) {
     $item['style_name'] = $variables['image_style'];
     $output = theme('image_style', $item);
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index a7696a6..879b87c 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -330,7 +330,7 @@ function image_file_download($uri) {
  */
 function image_file_move(File $file, File $source) {
   // Delete any image derivatives at the original image path.
-  image_path_flush($source->uri);
+  image_path_flush($source->uri->value);
 }
 
 /**
@@ -338,7 +338,7 @@ function image_file_move(File $file, File $source) {
  */
 function image_file_predelete(File $file) {
   // Delete any image derivatives of this image.
-  image_path_flush($file->uri);
+  image_path_flush($file->uri->value);
 }
 
 /**
@@ -386,7 +386,7 @@ function image_field_update_field($field, $prior_field, $has_data) {
   }
 
   // If the upload destination changed, then move the file.
-  if ($file_new && (file_uri_scheme($file_new->uri) != $field['settings']['uri_scheme'])) {
+  if ($file_new && (file_uri_scheme($file_new->uri->value) != $field['settings']['uri_scheme'])) {
     $directory = $field['settings']['uri_scheme'] . '://default_images/';
     file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
     file_move($file_new, $directory . $file_new->filename);
@@ -453,7 +453,7 @@ function image_field_update_instance($instance, $prior_instance) {
   }
 
   // If the upload destination changed, then move the file.
-  if ($file_new && (file_uri_scheme($file_new->uri) != $field['settings']['uri_scheme'])) {
+  if ($file_new && (file_uri_scheme($file_new->uri->value) != $field['settings']['uri_scheme'])) {
     $directory = $field['settings']['uri_scheme'] . '://default_images/';
     file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
     file_move($file_new, $directory . $file_new->filename);
diff --git a/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatter.php b/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatter.php
index 3edb751..e13583e 100644
--- a/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatter.php
+++ b/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatter.php
@@ -108,8 +108,9 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) {
     $image_style_setting = $this->getSetting('image_style');
     foreach ($items as $delta => $item) {
       if (isset($link_file)) {
+        $image_uri = file_load($item['fid'])->uri->value;
         $uri = array(
-          'path' => file_create_url($item['uri']),
+          'path' => file_create_url($image_uri),
           'options' => array(),
         );
       }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
index f667a67..15ee750 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php
@@ -246,7 +246,7 @@ function testStyle() {
   /**
    * Test deleting a style and choosing a replacement style.
    */
-  function testStyleReplacement() {
+  function imagtestStyleReplacement() {
     // Create a new style.
     $style_name = strtolower($this->randomName(10));
     $style_label = $this->randomString();
@@ -271,7 +271,7 @@ function testStyleReplacement() {
 
     // Test that image is displayed using newly created style.
     $this->drupalGet('node/' . $nid);
-    $this->assertRaw(image_style_url($style_name, file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri), format_string('Image displayed using style @style.', array('@style' => $style_name)));
+    $this->assertRaw(image_style_url($style_name, file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value), format_string('Image displayed using style @style.', array('@style' => $style_name)));
 
     // Rename the style and make sure the image field is updated.
     $new_style_name = strtolower($this->randomName(10));
@@ -283,7 +283,7 @@ function testStyleReplacement() {
     $this->drupalPost($style_path . $style_name, $edit, t('Update style'));
     $this->assertText(t('Changes to the style have been saved.'), format_string('Style %name was renamed to %new_name.', array('%name' => $style_name, '%new_name' => $new_style_name)));
     $this->drupalGet('node/' . $nid);
-    $this->assertRaw(image_style_url($new_style_name, file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri), 'Image displayed using style replacement style.');
+    $this->assertRaw(image_style_url($new_style_name, file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value), 'Image displayed using style replacement style.');
 
     // Delete the style and choose a replacement style.
     $edit = array(
@@ -294,7 +294,7 @@ function testStyleReplacement() {
     $this->assertRaw($message);
 
     $this->drupalGet('node/' . $nid);
-    $this->assertRaw(image_style_url('thumbnail', file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri), 'Image displayed using style replacement style.');
+    $this->assertRaw(image_style_url('thumbnail', file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value), 'Image displayed using style replacement style.');
   }
 
   /**
@@ -360,7 +360,7 @@ function testConfigImport() {
 
     // Test that image is displayed using newly created style.
     $this->drupalGet('node/' . $nid);
-    $this->assertRaw(image_style_url($style_name, file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri), format_string('Image displayed using style @style.', array('@style' => $style_name)));
+    $this->assertRaw(image_style_url($style_name, file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value), format_string('Image displayed using style @style.', array('@style' => $style_name)));
 
     // Write empty manifest to staging.
     $manifest_data = config('manifest.image.style')->get();
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php
index e7552d2..b5536c6 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php
@@ -38,7 +38,7 @@ function testImageDimensions() {
     // Create a working copy of the file.
     $files = $this->drupalGetTestFiles('image');
     $file = reset($files);
-    $original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
+    $original_uri = file_unmanaged_copy($file->uri->value, 'public://', FILE_EXISTS_RENAME);
 
     // Create a style.
     $style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
index 40e380d..f085fe9 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
@@ -43,10 +43,10 @@ function testDefaultImages() {
     // Create an image field and add an instance to the article content type.
     $field_name = strtolower($this->randomName());
     $field_settings = array(
-      'default_image' => array($default_images['field']->fid),
+      'default_image' => array($default_images['field']->id()),
     );
     $instance_settings = array(
-      'default_image' => array($default_images['instance']->fid),
+      'default_image' => array($default_images['instance']->id()),
     );
     $widget_settings = array(
       'preview_image_style' => 'medium',
@@ -63,7 +63,7 @@ function testDefaultImages() {
       'label' => $instance['label'],
       'required' => $instance['required'],
       'settings' => array(
-        'default_image' => array($default_images['instance2']->fid),
+        'default_image' => array($default_images['instance2']->id()),
       ),
     );
     field_create_instance($instance2);
@@ -81,20 +81,20 @@ function testDefaultImages() {
     $this->drupalGet("admin/structure/types/manage/article/fields/$instance->id/field");
     $this->assertFieldByXpath(
       '//input[@name="field[settings][default_image][fids]"]',
-      $default_images['field']->fid,
+      $default_images['field']->id(),
       format_string(
         'Article image field default equals expected file ID of @fid.',
-        array('@fid' => $default_images['field']->fid)
+        array('@fid' => $default_images['field']->id())
       )
     );
     // Confirm the defaults are present on the article field edit form.
     $this->drupalGet("admin/structure/types/manage/article/fields/$instance->id");
     $this->assertFieldByXpath(
       '//input[@name="instance[settings][default_image][fids]"]',
-      $default_images['instance']->fid,
+      $default_images['instance']->id(),
       format_string(
         'Article image field instance default equals expected file ID of @fid.',
-        array('@fid' => $default_images['instance']->fid)
+        array('@fid' => $default_images['instance']->id())
       )
     );
 
@@ -102,20 +102,20 @@ function testDefaultImages() {
     $this->drupalGet("admin/structure/types/manage/page/fields/$instance->id/field");
     $this->assertFieldByXpath(
       '//input[@name="field[settings][default_image][fids]"]',
-      $default_images['field']->fid,
+      $default_images['field']->id(),
       format_string(
         'Page image field default equals expected file ID of @fid.',
-        array('@fid' => $default_images['field']->fid)
+        array('@fid' => $default_images['field']->id())
       )
     );
     // Confirm the defaults are present on the page field edit form.
     $this->drupalGet("admin/structure/types/manage/page/fields/$instance2->id");
     $this->assertFieldByXpath(
       '//input[@name="instance[settings][default_image][fids]"]',
-      $default_images['instance2']->fid,
+      $default_images['instance2']->id(),
       format_string(
         'Page image field instance default equals expected file ID of @fid.',
-        array('@fid' => $default_images['instance2']->fid)
+        array('@fid' => $default_images['instance2']->id())
       )
     );
 
@@ -124,10 +124,10 @@ function testDefaultImages() {
     $article_built = node_view($article);
     $this->assertEqual(
       $article_built[$field_name]['#items'][0]['fid'],
-      $default_images['instance']->fid,
+      $default_images['instance']->id(),
       format_string(
         'A new article node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['instance']->fid)
+        array('@fid' => $default_images['instance']->id())
       )
     );
 
@@ -136,25 +136,25 @@ function testDefaultImages() {
     $page_built = node_view($page);
     $this->assertEqual(
       $page_built[$field_name]['#items'][0]['fid'],
-      $default_images['instance2']->fid,
+      $default_images['instance2']->id(),
       format_string(
         'A new page node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['instance2']->fid)
+        array('@fid' => $default_images['instance2']->id())
       )
     );
 
     // Upload a new default for the field.
-    $field['settings']['default_image'] = array($default_images['field_new']->fid);
+    $field['settings']['default_image'] = array($default_images['field_new']->id());
     field_update_field($field);
 
     // Confirm that the new default is used on the article field settings form.
     $this->drupalGet("admin/structure/types/manage/article/fields/$instance->id/field");
     $this->assertFieldByXpath(
       '//input[@name="field[settings][default_image][fids]"]',
-      $default_images['field_new']->fid,
+      $default_images['field_new']->id(),
       format_string(
         'Updated image field default equals expected file ID of @fid.',
-        array('@fid' => $default_images['field_new']->fid)
+        array('@fid' => $default_images['field_new']->id())
       )
     );
 
@@ -163,23 +163,23 @@ function testDefaultImages() {
     $page_built = node_view($page = node_load($page->nid, TRUE));
     $this->assertEqual(
       $article_built[$field_name]['#items'][0]['fid'],
-      $default_images['instance']->fid,
+      $default_images['instance']->id(),
       format_string(
         'An existing article node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['instance']->fid)
+        array('@fid' => $default_images['instance']->id())
       )
     );
     $this->assertEqual(
       $page_built[$field_name]['#items'][0]['fid'],
-      $default_images['instance2']->fid,
+      $default_images['instance2']->id(),
       format_string(
         'An existing page node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['instance2']->fid)
+        array('@fid' => $default_images['instance2']->id())
       )
     );
 
     // Upload a new default for the article's field instance.
-    $instance['settings']['default_image'] = array($default_images['instance_new']->fid);
+    $instance['settings']['default_image'] = array($default_images['instance_new']->id());
     field_update_instance($instance);
 
     // Confirm the new field instance default is used on the article field
@@ -187,10 +187,10 @@ function testDefaultImages() {
     $this->drupalGet("admin/structure/types/manage/article/fields/$instance->id");
     $this->assertFieldByXpath(
       '//input[@name="instance[settings][default_image][fids]"]',
-      $default_images['instance_new']->fid,
+      $default_images['instance_new']->id(),
       format_string(
         'Updated article image field instance default equals expected file ID of @fid.',
-        array('@fid' => $default_images['instance_new']->fid)
+        array('@fid' => $default_images['instance_new']->id())
       )
     );
 
@@ -201,19 +201,19 @@ function testDefaultImages() {
     // Confirm the article uses the new default.
     $this->assertEqual(
       $article_built[$field_name]['#items'][0]['fid'],
-      $default_images['instance_new']->fid,
+      $default_images['instance_new']->id(),
       format_string(
         'An existing article node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['instance_new']->fid)
+        array('@fid' => $default_images['instance_new']->id())
       )
     );
     // Confirm the page remains unchanged.
     $this->assertEqual(
       $page_built[$field_name]['#items'][0]['fid'],
-      $default_images['instance2']->fid,
+      $default_images['instance2']->id(),
       format_string(
         'An existing page node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['instance2']->fid)
+        array('@fid' => $default_images['instance2']->id())
       )
     );
 
@@ -235,19 +235,19 @@ function testDefaultImages() {
     // Confirm the article uses the new field (not instance) default.
     $this->assertEqual(
       $article_built[$field_name]['#items'][0]['fid'],
-      $default_images['field_new']->fid,
+      $default_images['field_new']->id(),
       format_string(
         'An existing article node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['field_new']->fid)
+        array('@fid' => $default_images['field_new']->id())
       )
     );
     // Confirm the page remains unchanged.
     $this->assertEqual(
       $page_built[$field_name]['#items'][0]['fid'],
-      $default_images['instance2']->fid,
+      $default_images['instance2']->id(),
       format_string(
         'An existing page node without an image has the expected default image file ID of @fid.',
-        array('@fid' => $default_images['instance2']->fid)
+        array('@fid' => $default_images['instance2']->id())
       )
     );
   }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
index c30c686..3e9aa65 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDisplayTest.php
@@ -56,7 +56,7 @@ function _testImageFieldFormatters($scheme) {
     $node = node_load($nid, TRUE);
 
     // Test that the default formatter is being used.
-    $image_uri = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri;
+    $image_uri = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value;
     $image_info = array(
       'uri' => $image_uri,
       'width' => 40,
@@ -163,7 +163,7 @@ function testImageFieldSettings() {
     // style.
     $node = node_load($nid, TRUE);
     $image_info = array(
-      'uri' => file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri,
+      'uri' => file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value,
       'width' => 220,
       'height' => 110,
       'style_name' => 'medium',
@@ -173,7 +173,7 @@ function testImageFieldSettings() {
 
     // Add alt/title fields to the image and verify that they are displayed.
     $image_info = array(
-      'uri' => file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri,
+      'uri' => file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value,
       'alt' => $this->randomName(),
       'title' => $this->randomName(),
       'width' => 40,
@@ -231,8 +231,8 @@ function testImageFieldDefaultImage() {
     field_info_cache_clear();
     $field = field_info_field($field_name);
     $image = file_load($field['settings']['default_image'][0]);
-    $this->assertTrue($image->status == FILE_STATUS_PERMANENT, 'The default image status is permanent.');
-    $default_output = theme('image', array('uri' => $image->uri));
+    $this->assertTrue($image->status->value == FILE_STATUS_PERMANENT, 'The default image status is permanent.');
+    $default_output = theme('image', array('uri' => $image->uri->value));
     $this->drupalGet('node/' . $node->nid);
     $this->assertRaw($default_output, 'Default image displayed when no user supplied image is present.');
 
@@ -241,7 +241,7 @@ function testImageFieldDefaultImage() {
     $nid = $this->uploadNodeImage($images[1], $field_name, 'article');
     $node = node_load($nid, TRUE);
     $image_info = array(
-      'uri' => file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri,
+      'uri' => file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid'])->uri->value,
       'width' => 40,
       'height' => 20,
     );
@@ -273,12 +273,12 @@ function testImageFieldDefaultImage() {
 
     $private_field = field_info_field($private_field_name);
     $image = file_load($private_field['settings']['default_image'][0]);
-    $this->assertEqual('private', file_uri_scheme($image->uri), 'Default image uses private:// scheme.');
-    $this->assertTrue($image->status == FILE_STATUS_PERMANENT, 'The default image status is permanent.');
+    $this->assertEqual('private', file_uri_scheme($image->uri->value), 'Default image uses private:// scheme.');
+    $this->assertTrue($image->status->value == FILE_STATUS_PERMANENT, 'The default image status is permanent.');
     // Create a new node with no image attached and ensure that default private
     // image is displayed.
     $node = $this->drupalCreateNode(array('type' => 'article'));
-    $default_output = theme('image', array('uri' => $image->uri));
+    $default_output = theme('image', array('uri' => $image->uri->value));
     $this->drupalGet('node/' . $node->nid);
     $this->assertRaw($default_output, 'Default private image displayed when no user supplied image is present.');
   }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
index 709073d..e1570d1 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php
@@ -99,7 +99,7 @@ public function testImageItem() {
     $entity->image_test->width = NULL;
     $entity->save();
     $this->assertEqual($entity->image_test->entity->id(), $image2->id());
-    $this->assertEqual($entity->image_test->entity->uri, $image2->uri);
+    $this->assertEqual($entity->image_test->entity->uri->value, $image2->uri->value);
     $info = image_get_info('public://example-2.jpg');
     $this->assertEqual($entity->image_test->width, $info['width']);
     $this->assertEqual($entity->image_test->height, $info['height']);
diff --git a/core/modules/locale/lib/Drupal/locale/Gettext.php b/core/modules/locale/lib/Drupal/locale/Gettext.php
index 859e4a7..376e544 100644
--- a/core/modules/locale/lib/Drupal/locale/Gettext.php
+++ b/core/modules/locale/lib/Drupal/locale/Gettext.php
@@ -82,8 +82,8 @@ static function fileToDatabase($file, $options) {
     );
     // Instantiate and initialize the stream reader for this file.
     $reader = new PoStreamReader();
-    $reader->setLangcode($file->langcode);
-    $reader->setURI($file->uri);
+    $reader->setLangcode($file->langcode->value);
+    $reader->setURI($file->uri->value);
 
     try {
       $reader->open();
@@ -99,7 +99,7 @@ static function fileToDatabase($file, $options) {
 
     // Initialize the database writer.
     $writer = new PoDatabaseWriter();
-    $writer->setLangcode($file->langcode);
+    $writer->setLangcode($file->langcode->value);
     $writer_options = array(
       'overwrite_options' => $options['overwrite_options'],
       'customized' => $options['customized'],
diff --git a/core/modules/locale/locale.batch.inc b/core/modules/locale/locale.batch.inc
index 3709406..c090584 100644
--- a/core/modules/locale/locale.batch.inc
+++ b/core/modules/locale/locale.batch.inc
@@ -37,15 +37,15 @@ function locale_translation_batch_status_fetch_remote($source, &$context) {
   // data with the remote status.
   if (isset($source->files[LOCALE_TRANSLATION_REMOTE])) {
     $remote_file = $source->files[LOCALE_TRANSLATION_REMOTE];
-    $result = locale_translation_http_check($remote_file->uri);
+    $result = locale_translation_http_check($remote_file->uri->value);
 
     if ($result) {
       // Update the file object with the result data. In case of a redirect we
       // store the resulting uri. If a file is not found we don't update the
       // file object, and store it unchanged.
       if (isset($result['last_modified'])) {
-        $remote_file->uri = isset($result['location']) ? $result['location'] : $remote_file->uri;
-        $remote_file->timestamp = $result['last_modified'];
+        $remote_file->uri->value = isset($result['location']) ? $result['location'] : $remote_file->uri->value;
+        $remote_file->timestamp->value = $result['last_modified'];
         $source->files[LOCALE_TRANSLATION_REMOTE] = $remote_file;
       }
       // Record success.
@@ -333,7 +333,7 @@ function locale_translation_batch_fetch_import($project, $langcode, $options, &$
             // translations after successfull import. Otherwise the temporary
             // file is deleted after being imported.
             if ($import_type == LOCALE_TRANSLATION_DOWNLOADED && config('locale.settings')->get('translation.path') && isset($source_result->files[LOCALE_TRANSLATION_LOCAL])) {
-              if (file_unmanaged_move($file->uri, $source_result->files[LOCALE_TRANSLATION_LOCAL]->uri, FILE_EXISTS_REPLACE)) {
+              if (file_unmanaged_move($file->uri->value, $source_result->files[LOCALE_TRANSLATION_LOCAL]->uri->value, FILE_EXISTS_REPLACE)) {
                 // The downloaded file is now moved to the local file location.
                 // From this point forward we can treat it as if we imported a
                 // local file.
@@ -343,15 +343,15 @@ function locale_translation_batch_fetch_import($project, $langcode, $options, &$
             // The downloaded file is imported but will not be stored locally.
             // Store the timestamp and delete the file.
             if ($import_type == LOCALE_TRANSLATION_DOWNLOADED) {
-              $timestamp = filemtime($source_result->files[$import_type]->uri);
+              $timestamp = filemtime($source_result->files[$import_type]->uri->value);
               $source_result->files[LOCALE_TRANSLATION_IMPORTED]->timestamp = $timestamp;
               $source_result->files[LOCALE_TRANSLATION_IMPORTED]->last_checked = REQUEST_TIME;
-              file_unmanaged_delete($file->uri);
+              file_unmanaged_delete($file->uri->value);
             }
             // If the translation file is stored in the local directory. The
             // timestamp of the file is stored.
             if ($import_type == LOCALE_TRANSLATION_LOCAL) {
-              $timestamp = filemtime($source_result->files[$import_type]->uri);
+              $timestamp = filemtime($source_result->files[$import_type]->uri->value);
               $source_result->files[LOCALE_TRANSLATION_LOCAL]->timestamp = $timestamp;
               $source_result->files[LOCALE_TRANSLATION_IMPORTED]->timestamp = $timestamp;
               $source_result->files[LOCALE_TRANSLATION_IMPORTED]->last_checked = REQUEST_TIME;
@@ -361,7 +361,7 @@ function locale_translation_batch_fetch_import($project, $langcode, $options, &$
           else {
             // File import failed. We can delete the temporary file.
             if ($import_type == LOCALE_TRANSLATION_DOWNLOADED) {
-              file_unmanaged_delete($file->uri);
+              file_unmanaged_delete($file->uri->value);
             }
           }
         }
@@ -501,7 +501,7 @@ function locale_translation_http_check($uri) {
  *   File object if download was successful. FALSE on failure.
  */
 function locale_translation_download_source($source_file) {
-  if ($uri = system_retrieve_file($source_file->uri, 'temporary://')) {
+  if ($uri = system_retrieve_file($source_file->uri->value, 'temporary://')) {
     $file = new stdClass();
     $file->project = $source_file->project;
     $file->langcode = $source_file->langcode;
diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc
index 5173132..a35b4eb 100644
--- a/core/modules/locale/locale.bulk.inc
+++ b/core/modules/locale/locale.bulk.inc
@@ -125,7 +125,7 @@ function locale_translate_import_form_submit($form, &$form_state) {
       'customized' => $form_state['values']['customized'] ? LOCALE_CUSTOMIZED : LOCALE_NOT_CUSTOMIZED,
     );
     $file = locale_translate_file_attach_properties($file, $options);
-    $batch = locale_translate_batch_build(array($file->uri => $file), $options);
+    $batch = locale_translate_batch_build(array($file->uri->value => $file), $options);
     batch_set($batch);
   }
   else {
@@ -453,7 +453,7 @@ function locale_translate_batch_import($file, $options, &$context) {
     try {
       if (empty($context['sandbox'])) {
         $context['sandbox']['parse_state'] = array(
-          'filesize' => filesize(drupal_realpath($file->uri)),
+          'filesize' => filesize(drupal_realpath($file->uri->value)),
           'chunk_size' => 200,
           'seek' => 0,
         );
@@ -464,7 +464,7 @@ function locale_translate_batch_import($file, $options, &$context) {
       $report = GetText::fileToDatabase($file, $options);
       // If not yet finished with reading, mark progress based on size and
       // position.
-      if ($report['seek'] < filesize($file->uri)) {
+      if ($report['seek'] < filesize($file->uri->value)) {
 
         $context['sandbox']['parse_state']['seek'] = $report['seek'];
         // Maximize the progress bar at 95% before completion, the batch API
@@ -484,34 +484,34 @@ function locale_translate_batch_import($file, $options, &$context) {
         $context['finished'] = 1;
 
         // Store the file data for processing by the next batch operation.
-        $file->timestamp = filemtime($file->uri);
-        $context['results']['files'][$file->uri] = $file;
-        $context['results']['languages'][$file->uri] = $file->langcode;
+        $file->timestamp->value = filemtime($file->uri->value);
+        $context['results']['files'][$file->uri->value] = $file;
+        $context['results']['languages'][$file->uri->value] = $file->langcode->value;
       }
 
       // Add the reported values to the statistics for this file.
       // Each import iteration reports statistics in an array. The results of
       // each iteration are added and merged here and stored per file.
-      if (!isset($context['results']['stats']) || !isset($context['results']['stats'][$file->uri])) {
-        $context['results']['stats'][$file->uri] = array();
+      if (!isset($context['results']['stats']) || !isset($context['results']['stats'][$file->uri->value])) {
+        $context['results']['stats'][$file->uri->value] = array();
       }
       foreach ($report as $key => $value) {
         if (is_numeric($report[$key])) {
-          if (!isset($context['results']['stats'][$file->uri][$key])) {
-            $context['results']['stats'][$file->uri][$key] = 0;
+          if (!isset($context['results']['stats'][$file->uri->value][$key])) {
+            $context['results']['stats'][$file->uri->value][$key] = 0;
           }
-          $context['results']['stats'][$file->uri][$key] += $report[$key];
+          $context['results']['stats'][$file->uri->value][$key] += $report[$key];
         }
         elseif (is_array($value)) {
-          $context['results']['stats'][$file->uri] += array($key => array());
-          $context['results']['stats'][$file->uri][$key] = array_merge($context['results']['stats'][$file->uri][$key], $value);
+          $context['results']['stats'][$file->uri->value] += array($key => array());
+          $context['results']['stats'][$file->uri->value][$key] = array_merge($context['results']['stats'][$file->uri->value][$key], $value);
         }
       }
     }
     catch (Exception $exception) {
       // Import failed. Store the data of the failing file.
       $context['results']['failed_files'][] = $file;
-      watchdog('locale', 'Unable to import translations file: @file', array('@file' => $file->uri));
+      watchdog('locale', 'Unable to import translations file: @file', array('@file' => $file->uri->value));
     }
   }
 }
@@ -700,7 +700,7 @@ function locale_translate_file_attach_properties($file, $options = array()) {
     ([^\./]+)               # language code (group 5)
     \.                      # .
     po                      # po extension
-    $!x', $file->filename, $matches);
+    $!x', $file->filename->value, $matches);
   if (isset($matches[5])) {
     $file->project = $matches[2] . $matches[3];
     $file->version = $matches[4];
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 aa2a237..9bba4f9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityCrudHookTest.php
@@ -240,7 +240,7 @@ public function testFileHooks() {
     ));
 
     $_SESSION['entity_crud_hook_test'] = array();
-    $file = file_load($file->fid);
+    $file = file_load($file->id());
 
     $this->assertHookMessageOrder(array(
       'entity_crud_hook_test_entity_load called for type file',
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
index 77a2ff0..5bbebc1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php
@@ -35,13 +35,13 @@ function setUp() {
    *   File object to compare.
    */
   function assertFileUnchanged($before, $after) {
-    $this->assertEqual($before->fid, $after->fid, t('File id is the same: %file1 == %file2.', array('%file1' => $before->fid, '%file2' => $after->fid)), 'File unchanged');
-    $this->assertEqual($before->uid, $after->uid, t('File owner is the same: %file1 == %file2.', array('%file1' => $before->uid, '%file2' => $after->uid)), 'File unchanged');
-    $this->assertEqual($before->filename, $after->filename, t('File name is the same: %file1 == %file2.', array('%file1' => $before->filename, '%file2' => $after->filename)), 'File unchanged');
-    $this->assertEqual($before->uri, $after->uri, t('File path is the same: %file1 == %file2.', array('%file1' => $before->uri, '%file2' => $after->uri)), 'File unchanged');
-    $this->assertEqual($before->filemime, $after->filemime, t('File MIME type is the same: %file1 == %file2.', array('%file1' => $before->filemime, '%file2' => $after->filemime)), 'File unchanged');
-    $this->assertEqual($before->filesize, $after->filesize, t('File size is the same: %file1 == %file2.', array('%file1' => $before->filesize, '%file2' => $after->filesize)), 'File unchanged');
-    $this->assertEqual($before->status, $after->status, t('File status is the same: %file1 == %file2.', array('%file1' => $before->status, '%file2' => $after->status)), 'File unchanged');
+    $this->assertEqual($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', array('%file1' => $before->id(), '%file2' => $after->id())), 'File unchanged');
+    $this->assertEqual($before->uid->value, $after->uid->value, t('File owner is the same: %file1 == %file2.', array('%file1' => $before->uid->value, '%file2' => $after->uid->value)), 'File unchanged');
+    $this->assertEqual($before->filename->value, $after->filename->value, t('File name is the same: %file1 == %file2.', array('%file1' => $before->filename->value, '%file2' => $after->filename->value)), 'File unchanged');
+    $this->assertEqual($before->uri->value, $after->uri->value, t('File path is the same: %file1 == %file2.', array('%file1' => $before->uri->value, '%file2' => $after->uri->value)), 'File unchanged');
+    $this->assertEqual($before->filemime->value, $after->filemime->value, t('File MIME type is the same: %file1 == %file2.', array('%file1' => $before->filemime->value, '%file2' => $after->filemime->value)), 'File unchanged');
+    $this->assertEqual($before->filesize->value, $after->filesize->value, t('File size is the same: %file1 == %file2.', array('%file1' => $before->filesize->value, '%file2' => $after->filesize->value)), 'File unchanged');
+    $this->assertEqual($before->status->value, $after->status->value, t('File status is the same: %file1 == %file2.', array('%file1' => $before->status->value, '%file2' => $after->status->value)), 'File unchanged');
   }
 
   /**
@@ -53,8 +53,8 @@ function assertFileUnchanged($before, $after) {
    *   File object to compare.
    */
   function assertDifferentFile($file1, $file2) {
-    $this->assertNotEqual($file1->fid, $file2->fid, t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->fid, '%file2' => $file2->fid)), 'Different file');
-    $this->assertNotEqual($file1->uri, $file2->uri, t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->uri, '%file2' => $file2->uri)), 'Different file');
+    $this->assertNotEqual($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->id(), '%file2' => $file2->id())), 'Different file');
+    $this->assertNotEqual($file1->uri->value, $file2->uri->value, t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->uri->value, '%file2' => $file2->uri->value)), 'Different file');
   }
 
   /**
@@ -66,8 +66,8 @@ function assertDifferentFile($file1, $file2) {
    *   File object to compare.
    */
   function assertSameFile($file1, $file2) {
-    $this->assertEqual($file1->fid, $file2->fid, t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->fid, '%file2-fid' => $file2->fid)), 'Same file');
-    $this->assertEqual($file1->uri, $file2->uri, t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->uri, '%file2' => $file2->uri)), 'Same file');
+    $this->assertEqual($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->id(), '%file2-fid' => $file2->id())), 'Same file');
+    $this->assertEqual($file1->uri->value, $file2->uri->value, t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->uri->value, '%file2' => $file2->uri->value)), 'Same file');
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php b/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php
index f23dde7..3e39359 100644
--- a/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/TypedData/TypedDataTest.php
@@ -215,17 +215,17 @@ public function testGetAndSet() {
     $this->assertEqual($typed_data->validate()->count(), 1, 'Validation detected invalid value.');
 
     // Binary type.
-    $typed_data = $this->createTypedData(array('type' => 'binary'), $files[0]->uri);
+    $typed_data = $this->createTypedData(array('type' => 'binary'), $files[0]->uri->value);
     $this->assertTrue(is_resource($typed_data->getValue()), 'Binary value was fetched.');
     $this->assertEqual($typed_data->validate()->count(), 0);
     // Try setting by URI.
-    $typed_data->setValue($files[1]->uri);
-    $this->assertEqual(is_resource($typed_data->getValue()), fopen($files[1]->uri, 'r'), 'Binary value was changed.');
+    $typed_data->setValue($files[1]->uri->value);
+    $this->assertEqual(is_resource($typed_data->getValue()), fopen($files[1]->uri->value, 'r'), 'Binary value was changed.');
     $this->assertTrue(is_string($typed_data->getString()), 'Binary value was converted to string');
     $this->assertEqual($typed_data->validate()->count(), 0);
     // Try setting by resource.
-    $typed_data->setValue(fopen($files[2]->uri, 'r'));
-    $this->assertEqual(is_resource($typed_data->getValue()), fopen($files[2]->uri, 'r'), 'Binary value was changed.');
+    $typed_data->setValue(fopen($files[2]->uri->value, 'r'));
+    $this->assertEqual(is_resource($typed_data->getValue()), fopen($files[2]->uri->value, 'r'), 'Binary value was changed.');
     $this->assertTrue(is_string($typed_data->getString()), 'Binary value was converted to string');
     $this->assertEqual($typed_data->validate()->count(), 0);
     $typed_data->setValue(NULL);
diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc
index 241ed54..0ce9e75 100644
--- a/core/modules/system/system.tokens.inc
+++ b/core/modules/system/system.tokens.inc
@@ -221,37 +221,37 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
       switch ($name) {
         // Basic keys and values.
         case 'fid':
-          $replacements[$original] = $file->fid;
+          $replacements[$original] = $file->id();
           break;
 
         // Essential file data
         case 'name':
-          $replacements[$original] = $sanitize ? check_plain($file->filename) : $file->filename;
+          $replacements[$original] = $sanitize ? check_plain($file->filename->value) : $file->filename->value;
           break;
 
         case 'path':
-          $replacements[$original] = $sanitize ? check_plain($file->uri) : $file->uri;
+          $replacements[$original] = $sanitize ? check_plain($file->uri->value) : $file->uri->value;
           break;
 
         case 'mime':
-          $replacements[$original] = $sanitize ? check_plain($file->filemime) : $file->filemime;
+          $replacements[$original] = $sanitize ? check_plain($file->filemime->value) : $file->filemime->value;
           break;
 
         case 'size':
-          $replacements[$original] = format_size($file->filesize);
+          $replacements[$original] = format_size($file->filesize->value);
           break;
 
         case 'url':
-          $replacements[$original] = $sanitize ? check_plain(file_create_url($file->uri)) : file_create_url($file->uri);
+          $replacements[$original] = $sanitize ? check_plain(file_create_url($file->uri->value)) : file_create_url($file->uri->value);
           break;
 
         // These tokens are default variations on the chained tokens handled below.
         case 'timestamp':
-          $replacements[$original] = format_date($file->timestamp, 'medium', '', NULL, $langcode);
+          $replacements[$original] = format_date($file->timestamp->value, 'medium', '', NULL, $langcode);
           break;
 
         case 'owner':
-          $account = user_load($file->uid);
+          $account = $file->uid->entity;
           $name = user_format_name($account);
           $replacements[$original] = $sanitize ? check_plain($name) : $name;
           break;
@@ -259,11 +259,11 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
     }
 
     if ($date_tokens = $token_service->findWithPrefix($tokens, 'timestamp')) {
-      $replacements += $token_service->generate('date', $date_tokens, array('date' => $file->timestamp), $options);
+      $replacements += $token_service->generate('date', $date_tokens, array('date' => $file->timestamp->value), $options);
     }
 
-    if (($owner_tokens = $token_service->findWithPrefix($tokens, 'owner')) && $account = user_load($file->uid)) {
-      $replacements += $token_service->generate('user', $owner_tokens, array('user' => $account), $options);
+    if (($owner_tokens = $token_service->findWithPrefix($tokens, 'owner')) && $file->uid->entity) {
+      $replacements += $token_service->generate('user', $owner_tokens, array('user' => $file->uid->entity), $options);
     }
   }
 
diff --git a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
index 1cd12bc..54c99ac 100644
--- a/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
+++ b/core/modules/user/lib/Drupal/user/Tests/UserPictureTest.php
@@ -73,12 +73,12 @@ function testCreateDeletePicture() {
       ->fields(array(
         'timestamp' => REQUEST_TIME - (DRUPAL_MAXIMUM_TEMP_FILE_AGE + 1),
       ))
-      ->condition('fid', $file->fid)
+      ->condition('fid', $file->id())
       ->execute();
     drupal_cron_run();
 
     // Verify that the image has been deleted.
-    $this->assertFalse(file_load($file->fid, TRUE), 'File was removed from the database.');
+    $this->assertFalse(file_load($file->id(), TRUE), 'File was removed from the database.');
     // Clear out PHP's file stat cache so we see the current value.
     clearstatcache(TRUE, $file->uri);
     $this->assertFalse(is_file($file->uri), 'File was removed from the file system.');
