From b0e53fc8de1bcbc70ba8c3035f5ec8af2266c930 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 12 Dec 2016 17:00:30 +0100 Subject: [PATCH] 8153229: JavacFiler.checkFileReopening drowns in exceptions after Modular Runtime Images change Using Path.equals instead of Files.isSameFile to speed up Filer checks Reviewed-by: jjg --- .../classes/com/sun/tools/javac/file/PathFileObject.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java index f30896c2cbc..94e69161b8f 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/PathFileObject.java @@ -499,11 +499,10 @@ public abstract class PathFileObject implements JavaFileObject { } 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