We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 28fd23b + 9bff673 commit fef7d1dCopy full SHA for fef7d1d
compiler/src/dotty/tools/dotc/util/SourceFile.scala
@@ -275,12 +275,11 @@ object SourceFile {
275
276
def apply(file: AbstractFile | Null, codec: Codec): SourceFile =
277
// Files.exists is slow on Java 8 (https://rules.sonarsource.com/java/tag/performance/RSPEC-3725),
278
- // so cope with failure; also deal with path prefix "Not a directory".
+ // so cope with failure.
279
val chars =
280
try new String(file.toByteArray, codec.charSet).toCharArray
281
catch
282
- case _: NoSuchFileException => Array.empty[Char]
283
- case fse: FileSystemException if fse.getMessage.endsWith("Not a directory") => Array.empty[Char]
+ case _: FileSystemException => Array.empty[Char]
284
285
if isScript(file, chars) then
286
ScriptSourceFile(file, chars)
0 commit comments