From 1df8d23b472b431f66dddbbeafa729ad425cda7d Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 24 Oct 2011 09:27:02 +0000 Subject: Pushed NPE defense in NoSourceFile.file out ano... Pushed NPE defense in NoSourceFile.file out another level. --- src/compiler/scala/tools/nsc/util/SourceFile.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala index 42489c5aaf..22820806be 100644 --- a/src/compiler/scala/tools/nsc/util/SourceFile.scala +++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala @@ -55,7 +55,7 @@ abstract class SourceFile { */ object NoSourceFile extends SourceFile { def content = Array() - def file = null // TODO: push NPE-defense out another level or two + def file = NoFile def isLineBreak(idx: Int) = false def isSelfContained = true def length = -1 @@ -64,6 +64,8 @@ object NoSourceFile extends SourceFile { override def toString = "NoSourceFile" } +object NoFile extends VirtualFile("", "") + object ScriptSourceFile { /** Length of the script header from the given content, if there is one. * The header begins with "#!" or "::#!" and ends with a line starting -- cgit v1.2.3