changeset 3811:4d4cd7cd731c jdk-9+149

8153229: JavacFiler.checkFileReopening drowns in exceptions after Modular Runtime Images change Summary: Using Path.equals instead of Files.isSameFile to speed up Filer checks Reviewed-by: jjg
author jlahoda
date Mon, 12 Dec 2016 17:00:30 +0100
parents e5e4064d037d
children e90f9448c7a3 44b6ae94e1d5
files src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java	Mon Dec 12 13:27:39 2016 +0100
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java	Mon Dec 12 17:00:30 2016 +0100
@@ -499,11 +499,10 @@
     }
 
     boolean isSameFile(PathFileObject other) {
-        try {
-            return Files.isSameFile(path, other.path);
-        } catch (IOException e) {
-            return false;
-        }
+        // By construction, the "path" field should be canonical in all likely, supported scenarios.
+        // (Any exceptions would involve the use of symlinks within a package hierarchy.)
+        // Therefore, it is sufficient to check that the paths are .equals.
+        return path.equals(other.path);
     }
 
     @Override