summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-11-13 14:59:18 +0000
committermihaylov <mihaylov@epfl.ch>2006-11-13 14:59:18 +0000
commitf3047df95f007d48d0049ff78448d27045b20445 (patch)
tree47e848f238fad00e117a4244ec69c229945301df /src
parentac255eaf858397ee14b8ffafd8066b100d5e6be4 (diff)
downloadscala-f3047df95f007d48d0049ff78448d27045b20445.tar.gz
scala-f3047df95f007d48d0049ff78448d27045b20445.tar.bz2
scala-f3047df95f007d48d0049ff78448d27045b20445.zip
Replaced == null()eq null(ne null)
Diffstat (limited to 'src')
-rw-r--r--src/actors/scala/actors/Actor.scala8
-rw-r--r--src/actors/scala/actors/Channel.scala6
-rw-r--r--src/actors/scala/actors/Scheduler.scala6
-rw-r--r--src/compiler/scala/tools/ant/FastScalac.scala2
-rw-r--r--src/compiler/scala/tools/ant/Scalac.scala2
-rw-r--r--src/compiler/scala/tools/ant/Scaladoc.scala2
-rw-r--r--src/compiler/scala/tools/nsc/CompileClient.scala2
-rw-r--r--src/compiler/scala/tools/nsc/CompileServer.scala4
-rw-r--r--src/compiler/scala/tools/nsc/CompileSocket.scala2
-rw-r--r--src/compiler/scala/tools/nsc/EvalLoop.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala4
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala6
-rw-r--r--src/compiler/scala/tools/nsc/InterpreterLoop.scala8
-rw-r--r--src/compiler/scala/tools/nsc/MainGenericRunner.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Phase.scala6
-rw-r--r--src/compiler/scala/tools/nsc/ScriptRunner.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala12
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala6
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala10
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeInfo.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreePrinters.scala10
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala14
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala3
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala8
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocGenerator.scala20
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocUtil.scala4
-rw-r--r--src/compiler/scala/tools/nsc/io/AbstractFile.scala2
-rw-r--r--src/compiler/scala/tools/nsc/io/PlainFile.scala4
-rw-r--r--src/compiler/scala/tools/nsc/io/VirtualFile.scala2
-rw-r--r--src/compiler/scala/tools/nsc/io/ZipArchive.scala10
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternMatchers.scala68
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternNodes.scala8
-rw-r--r--src/compiler/scala/tools/nsc/matching/TransMatcher.scala2
-rw-r--r--src/compiler/scala/tools/nsc/models/Models.scala14
-rw-r--r--src/compiler/scala/tools/nsc/models/SemanticTokens.scala26
-rw-r--r--src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala2
-rw-r--r--src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala10
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Names.scala12
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Scopes.scala32
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala20
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolTable.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala24
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala36
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala20
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala10
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/OverridingPairs.scala14
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala12
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala14
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala14
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala64
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala52
-rw-r--r--src/compiler/scala/tools/nsc/util/HashSet.scala8
-rw-r--r--src/compiler/scala/tools/nsc/util/NameTransformer.scala20
-rw-r--r--src/compiler/scala/tools/nsc/util/Position.scala4
-rw-r--r--src/compiler/scala/tools/nsc/util/Set.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/TreeSet.scala12
-rw-r--r--src/library/scala/Application.scala2
-rw-r--r--src/library/scala/BigInt.scala2
-rw-r--r--src/library/scala/Console.scala4
-rw-r--r--src/library/scala/Enumeration.scala4
-rw-r--r--src/library/scala/MatchError.scala2
-rw-r--r--src/library/scala/collection/mutable/DoubleLinkedList.scala10
-rw-r--r--src/library/scala/collection/mutable/ListBuffer.scala2
-rw-r--r--src/library/scala/collection/mutable/MutableList.scala4
-rw-r--r--src/library/scala/collection/mutable/Queue.scala24
-rw-r--r--src/library/scala/collection/mutable/SingleLinkedList.scala12
-rw-r--r--src/library/scala/collection/mutable/Stack.scala6
-rw-r--r--src/library/scala/concurrent/Actor.scala2
-rw-r--r--src/library/scala/concurrent/Channel.scala2
-rw-r--r--src/library/scala/concurrent/MailBox.scala12
-rw-r--r--src/library/scala/mobile/Code.scala4
-rw-r--r--src/library/scala/mobile/Location.scala2
-rw-r--r--src/library/scala/runtime/BoxedAnyArray.scala20
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala4
-rw-r--r--src/library/scala/xml/Elem.scala2
-rw-r--r--src/library/scala/xml/NamespaceBinding.scala2
-rw-r--r--src/library/scala/xml/Node.scala2
-rw-r--r--src/library/scala/xml/PrefixedAttribute.scala4
-rw-r--r--src/library/scala/xml/UnprefixedAttribute.scala8
-rw-r--r--src/library/scala/xml/Utility.scala8
-rw-r--r--src/library/scala/xml/XML.scala2
-rw-r--r--src/library/scala/xml/dtd/ElementValidator.scala2
-rw-r--r--src/library/scala/xml/dtd/ExternalID.scala4
-rw-r--r--src/library/scala/xml/parsing/ExternalSources.scala2
-rw-r--r--src/library/scala/xml/parsing/FactoryAdapter.scala6
-rw-r--r--src/library/scala/xml/parsing/MarkupParser.scala4
-rw-r--r--src/library/scala/xml/pull/XMLEventReader.scala2
103 files changed, 443 insertions, 444 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala
index af2b477ccf..419f7f30fb 100644
--- a/src/actors/scala/actors/Actor.scala
+++ b/src/actors/scala/actors/Actor.scala
@@ -36,7 +36,7 @@ object Actor {
def self: Actor = synchronized {
val t = currentThread
var a = selfs.get(t).asInstanceOf[Actor]
- if (a == null) {
+ if (a eq null) {
a = new ActorProxy(t)
selfs.put(t, a)
}
@@ -303,7 +303,7 @@ trait Actor extends OutputChannel[Any] {
private var rc: Channel[Any] = null
private[actors] def reply: Channel[Any] = {
- if (rc == null) {
+ if (rc eq null) {
rc = new Channel[Any]
rc.receiver = this
}
@@ -350,12 +350,12 @@ trait Actor extends OutputChannel[Any] {
private[actors] var timeoutPending = false
private[actors] def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) =
- if (f == null && continuation == null) {
+ if ((f eq null) && (continuation eq null)) {
// do nothing (timeout is handled instead)
}
else {
val task = new ActorTask(this,
- if (f == null) continuation else f,
+ if (f eq null) continuation else f,
msg)
Scheduler.execute(task)
}
diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala
index 20e1cd0f49..85949db53a 100644
--- a/src/actors/scala/actors/Channel.scala
+++ b/src/actors/scala/actors/Channel.scala
@@ -50,7 +50,7 @@ class Channel[Msg] extends InputChannel[Msg] with OutputChannel[Msg] {
private def send(msg: Msg, sender: Actor) = receiver.synchronized {
receiver.tick()
- if (waitingFor(msg) && ((waitingForSender == null) ||
+ if (waitingFor(msg) && ((waitingForSender eq null) ||
(waitingForSender == sender))) {
received = msg
receiver.pushSender(sender)
@@ -215,7 +215,7 @@ class Channel[Msg] extends InputChannel[Msg] with OutputChannel[Msg] {
else synchronized {
isSuspended = true
receiver.suspendActorFor(msec)
- if (received == null)
+ if (received eq null)
if (f.isDefinedAt(TIMEOUT)) {
isSuspended = false
val result = f(TIMEOUT)
@@ -240,7 +240,7 @@ class Channel[Msg] extends InputChannel[Msg] with OutputChannel[Msg] {
received = null
receiver.suspendActorFor(msec)
Debug.info("received: "+received)
- if (received == null) {
+ if (received eq null) {
Debug.info("no message received after "+msec+" millis")
if (f.isDefinedAt(TIMEOUT)) {
Debug.info("executing TIMEOUT action")
diff --git a/src/actors/scala/actors/Scheduler.scala b/src/actors/scala/actors/Scheduler.scala
index 50d7a2db39..314f1e2311 100644
--- a/src/actors/scala/actors/Scheduler.scala
+++ b/src/actors/scala/actors/Scheduler.scala
@@ -372,7 +372,7 @@ class QuitException extends Throwable {
* <p>
* A worker thread enters the idle queue of the scheduler when
* <code>getTask</code> returns <code>null</code>. Then it will also stay
- * in the while-loop W (<code>while (task == null)</code>) until
+ * in the while-loop W (<code>while (task eq null)</code>) until
* <code>task</code> becomes non-null. The only way this can happen is
* through a call of <code>execute</code> by the scheduler. Before every
* call of <code>execute</code> the worker thread is removed from the idle
@@ -401,7 +401,7 @@ class WorkerThread(sched: IScheduler) extends Thread {
override def run(): Unit =
try {
while (running) {
- if (task != null) {
+ if (task ne null) {
try {
task.run()
} catch {
@@ -412,7 +412,7 @@ class WorkerThread(sched: IScheduler) extends Thread {
this.synchronized {
task = sched.getTask(this)
- while (task == null) {
+ while (task eq null) {
try {
wait()
} catch {
diff --git a/src/compiler/scala/tools/ant/FastScalac.scala b/src/compiler/scala/tools/ant/FastScalac.scala
index 68c7acc48f..8b64cb2be9 100644
--- a/src/compiler/scala/tools/ant/FastScalac.scala
+++ b/src/compiler/scala/tools/ant/FastScalac.scala
@@ -98,7 +98,7 @@ package scala.tools.ant {
try {
nsc.CompileClient.main0(args)
} catch {
- case exception: Throwable if (exception.getMessage != null) =>
+ case exception: Throwable if (exception.getMessage ne null) =>
exception.printStackTrace()
error("Compile failed because of an internal compiler error (" +
exception.getMessage + "); see the error output for details.")
diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala
index efb19021e5..4957eb088a 100644
--- a/src/compiler/scala/tools/ant/Scalac.scala
+++ b/src/compiler/scala/tools/ant/Scalac.scala
@@ -591,7 +591,7 @@ package scala.tools.ant {
try {
(new compiler.Run).compile(sourceFiles.map (.toString()))
} catch {
- case exception: Throwable if (exception.getMessage != null) =>
+ case exception: Throwable if (exception.getMessage ne null) =>
exception.printStackTrace()
error("Compile failed because of an internal compiler error (" +
exception.getMessage + "); see the error output for details.")
diff --git a/src/compiler/scala/tools/ant/Scaladoc.scala b/src/compiler/scala/tools/ant/Scaladoc.scala
index 9d58b84f4c..08c75c1adb 100644
--- a/src/compiler/scala/tools/ant/Scaladoc.scala
+++ b/src/compiler/scala/tools/ant/Scaladoc.scala
@@ -465,7 +465,7 @@ package scala.tools.ant {
"; see the documenter output for details.")
reporter.printSummary()
} catch {
- case exception: Throwable if (exception.getMessage != null) =>
+ case exception: Throwable if (exception.getMessage ne null) =>
exception.printStackTrace()
error("Document failed because of an internal documenter error (" +
exception.getMessage + "); see the error output for details.")
diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala
index facfca7768..970becc5f5 100644
--- a/src/compiler/scala/tools/nsc/CompileClient.scala
+++ b/src/compiler/scala/tools/nsc/CompileClient.scala
@@ -98,7 +98,7 @@ object CompileClient {
out.println(args.mkString("", "\0", ""))
var sawerror = false
var fromServer = in.readLine()
- while (fromServer != null) {
+ while (fromServer ne null) {
if (CompileSocket.errorPattern.matcher(fromServer).matches)
sawerror = true
Console.println(fromServer)
diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala
index d407dd111a..48f30041a7 100644
--- a/src/compiler/scala/tools/nsc/CompileServer.scala
+++ b/src/compiler/scala/tools/nsc/CompileServer.scala
@@ -79,7 +79,7 @@ object CompileServer extends SocketServer {
val password = CompileSocket.getPassword(port)
val guessedPassword = in.readLine()
val input = in.readLine()
- if (input != null && password == guessedPassword) {
+ if ((input ne null) && password == guessedPassword) {
try {
inSession = true
progress = true
@@ -121,7 +121,7 @@ object CompileServer extends SocketServer {
reporter.info(null, command.usageMsg, true)
else {
try {
- if (compiler != null && settingsAreCompatible(command.settings, compiler.settings)) {
+ if ((compiler ne null) && settingsAreCompatible(command.settings, compiler.settings)) {
compiler.settings = command.settings
compiler.reporter = reporter
} else {
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index d326aa433f..f52777ed63 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -62,7 +62,7 @@ object CompileSocket {
def expand(trial: Pair[String, List[String]]): Option[File] = {
val Pair(topdirProp, extensions) = trial
val topdir = System.getProperty(topdirProp)
- if (topdir == null)
+ if (topdir eq null)
return None
val fulldir =
diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala
index 24b5ef9bb2..25f34e4e8d 100644
--- a/src/compiler/scala/tools/nsc/EvalLoop.scala
+++ b/src/compiler/scala/tools/nsc/EvalLoop.scala
@@ -13,7 +13,7 @@ trait EvalLoop {
def loop(action: (String) => Unit): Unit = {
Console.print(prompt)
val line = Console.readLine
- if (line != null && line.length() > 0) {
+ if ((line ne null) && line.length() > 0) {
action(line)
loop(action)
}
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 082f5cc910..7e88d0dd13 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -175,7 +175,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
def getSourceFile(name: String): SourceFile = {
val f = AbstractFile.getFile(name)
- if (f == null) throw new FileNotFoundException(
+ if (f eq null) throw new FileNotFoundException(
"source file '" + name + "' could not be found")
getSourceFile(f)
}
@@ -509,7 +509,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
}
def compileLate(file: AbstractFile): unit =
- if (fileset == null) {
+ if (fileset eq null) {
val msg = "No class file for " + file +
" was found\n(This file cannot be loaded as a source file)"
inform(msg)
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 836512bae0..bdfcae0042 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -107,7 +107,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter)
definitions.
*/
private val classLoader =
- if (parentClassLoader == null)
+ if (parentClassLoader eq null)
new URLClassLoader(Array(classfilePath.toURL))
else
new URLClassLoader(Array(classfilePath.toURL), parentClassLoader)
@@ -277,7 +277,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter)
// figure out what kind of request
val req = buildRequest(trees, line, lineName)
- if (req == null) return false // a disallowed statement type
+ if (req eq null) return false // a disallowed statement type
if (!req.compile)
return false // an error happened during compilation, e.g. a type error
@@ -571,7 +571,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter)
} catch {
case e => {
def caus(e: Throwable): Throwable =
- if (e.getCause == null) e else caus(e.getCause)
+ if (e.getCause eq null) e else caus(e.getCause)
val orig = caus(e)
Pair(stringFrom(str => orig.printStackTrace(str)),
false)
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
index be37fd9735..9416aee401 100644
--- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala
+++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
@@ -42,7 +42,7 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
/** Close the interpreter, if there is one, and set
* interpreter to null. */
def closeInterpreter =
- if (interpreter != null) {
+ if (interpreter ne null) {
interpreter.close
interpreter = null
}
@@ -83,7 +83,7 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
out.print("\nscala> ")
out.flush
var line = in.readLine()
- if (line == null)
+ if (line eq null)
return () // assumes null means EOF
val Pair(keepGoing, shouldReplay) = command(line)
@@ -103,11 +103,11 @@ class InterpreterLoop(in: BufferedReader, out: PrintWriter) {
out.println("Error opening file: " + filename)
null
}
- if (fileIn == null) return ()
+ if (fileIn eq null) return ()
val in = new BufferedReader(fileIn)
while (true) {
val line = in.readLine
- if (line == null) {
+ if (line eq null) {
fileIn.close
return ()
}
diff --git a/src/compiler/scala/tools/nsc/MainGenericRunner.scala b/src/compiler/scala/tools/nsc/MainGenericRunner.scala
index 1a8a3e02b9..ef70977a86 100644
--- a/src/compiler/scala/tools/nsc/MainGenericRunner.scala
+++ b/src/compiler/scala/tools/nsc/MainGenericRunner.scala
@@ -23,7 +23,7 @@ object MainGenericRunner {
*/
def addClasspathExtras(classpath: String): String = {
val scalaHome = getProperty("scala.home")
- if (scalaHome == null)
+ if (scalaHome eq null)
return classpath
val libdir = new File(new File(scalaHome), "lib")
diff --git a/src/compiler/scala/tools/nsc/Phase.scala b/src/compiler/scala/tools/nsc/Phase.scala
index a27c71f961..a66cdecfde 100644
--- a/src/compiler/scala/tools/nsc/Phase.scala
+++ b/src/compiler/scala/tools/nsc/Phase.scala
@@ -12,15 +12,15 @@ abstract class Phase(val prev: Phase) {
type Id = int
- val id: Id = if (prev == null) 0 else prev.id + 1
+ val id: Id = if (prev eq null) 0 else prev.id + 1
def newFlags: long = 0l
private var fmask: long =
- if (prev == null) Flags.InitialFlags else prev.flagMask | newFlags
+ if (prev eq null) Flags.InitialFlags else prev.flagMask | newFlags
def flagMask: long = fmask
private var nx: Phase = this
- if (prev != null) prev.nx = this
+ if (prev ne null) prev.nx = this
def next: Phase = nx
diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala
index c0b92195f3..5e509959c2 100644
--- a/src/compiler/scala/tools/nsc/ScriptRunner.scala
+++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala
@@ -199,7 +199,7 @@ object ScriptRunner {
var compok = true
var fromServer = in.readLine()
- while (fromServer != null) {
+ while (fromServer ne null) {
Console.println(fromServer)
if (CompileSocket.errorPattern.matcher(fromServer).matches)
compok = false
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index c67dfeb272..b4b9f02efc 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -19,7 +19,7 @@ class Settings(error: String => unit) {
else null
private val classpathDefault =
- if (System.getProperty("env.classpath") != null)
+ if (System.getProperty("env.classpath") ne null)
alternatePath(
getProperty("env.classpath"),
".")
@@ -40,16 +40,16 @@ class Settings(error: String => unit) {
"")
private def alternatePath(p1: String, p2: => String) =
- if (p1 != null) p1 else p2
+ if (p1 ne null) p1 else p2
private def concatPath(p1: String, p2: String) =
- if (p1 != null && p2 != null) p1 + File.pathSeparator + p2
- else if (p1 != null) p1
+ if ((p1 ne null) && (p2 ne null)) p1 + File.pathSeparator + p2
+ else if (p1 ne null) p1
else p2
private def guessedScalaBootClassPath = {
val scalaHome = System.getProperty("scala.home")
- if (scalaHome != null) {
+ if (scalaHome ne null) {
val guessJar = new File(new File(new File(scalaHome), "lib"), "scala-library.jar")
if (guessJar.exists()) guessJar.getPath()
else {
@@ -61,7 +61,7 @@ class Settings(error: String => unit) {
private def guessedScalaExtDirs = {
val scalaHome = System.getProperty("scala.home")
- if (scalaHome != null) {
+ if (scalaHome ne null) {
val guess = new File(new File(scalaHome), "lib")
if (guess.exists()) guess.getPath else null
} else null
diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
index cf3d9f8809..e645bf1ff1 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
@@ -229,7 +229,7 @@ abstract class TreeBrowsers {
TreeInfo.symbolTypeDoc(t).format(getWidth() / getColumnWidth(), buf)
str.append(buf.toString())
str.append("\nSymbol tpe: ")
- if (t.symbol != null) {
+ if (t.symbol ne null) {
str.append(t.symbol.tpe).append("\n");
buf = new StringWriter();
TypePrinter.toDocument(t.symbol.tpe).format(getWidth() / getColumnWidth(), buf)
@@ -534,7 +534,7 @@ abstract class TreeBrowsers {
/** Return t's symbol type */
def symbolTypeDoc(t: Tree): Document = {
val s = t.symbol
- if (s != null)
+ if (s ne null)
TypePrinter.toDocument(s.info)
else
DocNil
@@ -546,7 +546,7 @@ abstract class TreeBrowsers {
val s = t.symbol
var att = ""
- if (s != null) {
+ if (s ne null) {
var str = flagsToString(s.flags)
if (s.hasFlag(STATIC) || s.hasFlag(STATICMEMBER))
str = str + " isStatic ";
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 96110f8dc1..8be11e40b4 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -73,8 +73,8 @@ abstract class TreeGen {
if (tree.symbol.isStable) tree.setType(singleType(tree.symbol.owner.thisType, tree.symbol))
else tree
case Select(qual, _) =>
- assert(tree.symbol != null)
- assert(qual.tpe != null)
+ assert(tree.symbol ne null)
+ assert(qual.tpe ne null)
if (tree.symbol.isStable && qual.tpe.isStable)
tree.setType(singleType(qual.tpe, tree.symbol))
else tree
@@ -109,14 +109,14 @@ abstract class TreeGen {
}
def mkAttributedSelect(qual: Tree, sym: Symbol): Tree =
- if (qual.symbol != null &&
+ if ((qual.symbol ne null) &&
(qual.symbol.name.toTermName == nme.ROOT ||
qual.symbol.name.toTermName == nme.EMPTY_PACKAGE_NAME)) {
mkAttributedIdent(sym)
} else {
assert(sym.isTerm)
val result = Select(qual, sym.name) setSymbol sym
- if (qual.tpe != null) result setType qual.tpe.memberType(sym)
+ if (qual.tpe ne null) result setType qual.tpe.memberType(sym)
result
}
@@ -190,7 +190,7 @@ abstract class TreeGen {
ValDef(mvar, if (mvar.owner.isClass) EmptyTree else Literal(Constant(null)))
}
- // def m: T = { if (m$ == null) m$ = new m$class; m$ }
+ // def m: T = { if (m$ eq null) m$ = new m$class; m$ }
def mkModuleAccessDef(accessor: Symbol, mvar: Symbol) =
DefDef(accessor, vparamss =>
mkCached(mvar,
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
index 4ac7646e4a..5b4622a984 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
@@ -206,7 +206,7 @@ abstract class TreeInfo {
*/
def isSequencePattern(tree: Tree): boolean = tree match {
case Apply(fn, _) =>
- fn.symbol != null &&
+ (fn.symbol ne null) &&
!fn.symbol.hasFlag(CASE) &&
fn.symbol.isNonBottomSubClass(definitions.SeqClass)
case Bind(name, body) =>
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
index 237dbf8b46..3ac528844e 100644
--- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
@@ -296,9 +296,9 @@ abstract class TreePrinters {
case TypeTree() =>
print(
- if (tree.tpe == null)
+ if (tree.tpe eq null)
"<type ?>"
- else if (tree.tpe.symbol != null && tree.tpe.symbol.isAnonymousClass)
+ else if ((tree.tpe.symbol ne null) && tree.tpe.symbol.isAnonymousClass)
tree.tpe.symbol.toString()
else
tree.tpe.toString()
@@ -318,10 +318,10 @@ abstract class TreePrinters {
case WildcardTypeTree(lo, hi) =>
print("_ "); printOpt(" >: ", lo); printOpt(" <: ", hi)
- case tree if (tree != null) => print(tree.toString())
+ case tree if (tree ne null) => print(tree.toString())
}
if (global.settings.printtypes.value && tree.isTerm && !tree.isEmpty) {
- print("{"); print(if (tree.tpe == null) "<null>" else tree.tpe.toString()); print("}")
+ print("{"); print(if (tree.tpe eq null) "<null>" else tree.tpe.toString()); print("}")
}
}
@@ -343,7 +343,7 @@ abstract class TreePrinters {
def print(unit: CompilationUnit): unit = {
print("// Scala source: " + unit.source + LINE_SEPARATOR)
- if (unit.body != null) {
+ if (unit.body ne null) {
print(unit.body); println
} else {
print("<null>")
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 1958099e31..7e58592361 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -76,7 +76,7 @@ trait Trees requires Global {
def isType = false
def isEmpty = false
- def isErroneous = tpe != null && tpe.isErroneous
+ def isErroneous = (tpe ne null) && tpe.isErroneous
override def toString(): String = {
val buffer = new StringWriter()
@@ -93,7 +93,7 @@ trait Trees requires Global {
}
def equalsStructure(that: Tree): Boolean = if (this == that) true else (this:Any) match {
- case thiz : Product if (that != null && thiz.getClass == that.getClass) =>
+ case thiz : Product if ((that ne null) && thiz.getClass == that.getClass) =>
val that0 = that.asInstanceOf[Product]
val result: Iterator[Boolean] =
for (val i <- 0.until(thiz.arity)) yield thiz.element(i) match {
@@ -103,7 +103,7 @@ trait Trees requires Global {
case list: List[_] if (that0.element(i).isInstanceOf[List[Any]]) =>
val listThat = that0.element(i).asInstanceOf[List[Any]]
if (list.length == listThat.length) (for (val x <- list.zip(listThat)) yield {
- if (x._1 != null && x._1.isInstanceOf[Tree] && x._2.isInstanceOf[Tree]) {
+ if ((null != x._1) && x._1.isInstanceOf[Tree] && x._2.isInstanceOf[Tree]) {
val b = x._1.asInstanceOf[Tree] equalsStructure x._2.asInstanceOf[Tree]
b
} else x._1 == x._2
@@ -610,7 +610,7 @@ trait Trees requires Global {
/** Literal */
case class Literal(value: Constant)
extends TermTree {
- assert(value != null)
+ assert(value ne null)
}
def Literal(value: Any): Literal =
@@ -624,7 +624,7 @@ trait Trees requires Global {
original = tree
setPos(tree.pos)
}
- override def isEmpty = tpe == null || tpe == NoType
+ override def isEmpty = (tpe eq null) || tpe == NoType
}
def TypeTree(tp: Type): TypeTree = TypeTree() setType tp
@@ -1328,7 +1328,7 @@ trait Trees requires Global {
class TreeTypeSubstituter(from: List[Symbol], to: List[Type]) extends Traverser {
val typeSubst = new SubstTypeMap(from, to)
override def traverse(tree: Tree): unit = {
- if (tree.tpe != null) tree.tpe = typeSubst(tree.tpe)
+ if (tree.tpe ne null) tree.tpe = typeSubst(tree.tpe)
super.traverse(tree)
}
override def apply[T <: Tree](tree: T): T = super.apply(tree.duplicate)
@@ -1342,7 +1342,7 @@ trait Trees requires Global {
if (tree.symbol == from.head) tree setSymbol to.head
else subst(from.tail, to.tail)
}
- if (tree.tpe != null) tree.tpe = symSubst(tree.tpe)
+ if (tree.tpe ne null) tree.tpe = symSubst(tree.tpe)
if (tree.hasSymbol) subst(from, to)
super.traverse(tree)
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 926ec36bf8..7a175d7c8c 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -196,7 +196,7 @@ trait Parsers requires SyntaxAnalyzer {
*/
def joinComment(trees: => List[Tree]): List[Tree] = {
val buf = in.docBuffer
- if (buf != null) {
+ if (buf ne null) {
in.docBuffer = null
trees map (t => DocDef(buf.toString(), t) setPos t.pos)
} else trees
@@ -1440,7 +1440,7 @@ trait Parsers requires SyntaxAnalyzer {
}
val pname = ident()
val param = atPos(in.currentPos) { typeBounds(mods, pname) }
- if (in.token == VIEWBOUND && (implicitViews != null))
+ if (in.token == VIEWBOUND && (implicitViews ne null))
implicitViews += atPos(in.skipToken()) {
makeFunctionTypeTree(List(Ident(pname.toTypeName)), typ())
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 35f4c7b404..8004976cf5 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -81,7 +81,7 @@ trait Scanners requires SyntaxAnalyzer {
/** add the given character to the documentation buffer
*/
protected def putDocChar(c: char): unit =
- if (docBuffer != null) docBuffer.append(c)
+ if (docBuffer ne null) docBuffer.append(c)
/** we need one token lookahead
*/
@@ -883,7 +883,7 @@ trait Scanners requires SyntaxAnalyzer {
for (val i <- 0 to maxKey)
key(i) = IDENTIFIER
for (val j <- 0 until tokenCount)
- if (tokenName(j) != null)
+ if (tokenName(j) ne null)
key(tokenName(j).start) = j.asInstanceOf[byte]
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index b3bdcce65f..00a1cc4c95 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -324,8 +324,7 @@ trait BasicBlocks requires ICodes {
* in different code 'chunks' than the rest of the method.
*/
def predecessors: List[BasicBlock] = {
-// if (preds == null)
- preds = code.blocks.elements.filter (p => (p.successors contains this)).toList;
+ preds = code.blocks.elements.filter (.successors.contains(this)).toList;
preds
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index b1e2912e33..4ecd9c7012 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -1254,7 +1254,7 @@ abstract class GenICode extends SubComponent {
case Pair(expr, Literal(Constant(null))) => expr
case _ => null
}
- if (expr != null) {
+ if (expr ne null) {
val ctx1 = genLoad(expr, ctx, ANY_REF_CLASS)
if (code == scalaPrimitives.ID)
ctx1.bb.emit(CZJUMP(thenCtx.bb, elseCtx.bb, EQ, ANY_REF_CLASS))
@@ -1344,7 +1344,7 @@ abstract class GenICode extends SubComponent {
/**
* Generate the "==" code for object references. It is equivalent of
- * if (l == null) then r == null else l.equals(r);
+ * if (l eq null) then r eq null else l.equals(r);
*
* @param l ...
* @param r ...
@@ -1361,7 +1361,7 @@ abstract class GenICode extends SubComponent {
case Pair(expr, Literal(Constant(null))) => expr
case _ => null
}
- if (expr != null) {
+ if (expr ne null) {
val ctx1 = genLoad(expr, ctx, ANY_REF_CLASS)
ctx1.bb.emit(CZJUMP(thenCtx.bb, elseCtx.bb, EQ, ANY_REF_CLASS))
ctx1.bb.close
@@ -1799,7 +1799,7 @@ abstract class GenICode extends SubComponent {
}
def setParams(p: List[Symbol]): Label = {
- assert(params == null, "Cannot set label parameters twice!")
+ assert(params eq null, "Cannot set label parameters twice!")
params = p
this
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
index 3374696765..e06fd5e2e4 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala
@@ -211,7 +211,7 @@ trait TypeKinds requires ICodes {
/** A class type. */
case class REFERENCE(cls: Symbol) extends TypeKind {
- assert(cls != null,
+ assert(cls ne null,
"REFERENCE to null class symbol.")
assert(cls != definitions.ArrayClass,
"REFERENCE to Array is not allowed, should be ARRAY[..] instead")
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 946a4a550e..979ed831c9 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -125,7 +125,7 @@ abstract class GenJVM extends SubComponent {
jclass.writeTo(outfile)
val file = scala.tools.nsc.io.AbstractFile.getFile(outfile)
informProgress("wrote " + outfile + " " +
- (if (file != null) "" + file.file + " " + file.file.exists()
+ (if (file ne null) "" + file.file + " " + file.file.exists()
else "no file"))
}
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
index 72dab71d7f..8b1bcb17b1 100644
--- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
@@ -40,7 +40,7 @@ abstract class DocGenerator extends Models {
abstract class Frame extends UrlContext {
def path: String // relative to outdir
def relative: String = {
- assert(path != null)
+ assert(path ne null)
var idx = 0
var ct = new StringBuilder
while (idx != -1) {
@@ -76,7 +76,7 @@ abstract class DocGenerator extends Models {
val sym = tree.symbol
if (sym == NoSymbol)
Text(tree.asInstanceOf[ValOrDefDef].name.toString())
- else if (sym.sourceFile == null)
+ else if (sym.sourceFile eq null)
Text(sym.fullNameString('.'))
else
aref(urlFor(sym), target, sym.nameString)
@@ -92,11 +92,11 @@ abstract class DocGenerator extends Models {
* @return ...
*/
def urlFor(tpe: Type, target: String): NodeSeq = try {
- if (tpe.symbol.hasFlag(Flags.JAVA) || tpe.symbol.sourceFile == null)
+ if (tpe.symbol.hasFlag(Flags.JAVA) || (tpe.symbol.sourceFile eq null))
<a class={tpe.toString().replace('.', '_')} href=""
target={target}>{tpe.toString()}</a>
/*
- else if (tpe.symbol.sourceFile == null)
+ else if (tpe.symbol.sourceFile eq null)
Text(tpe.toString())
*/
else {
@@ -405,7 +405,7 @@ abstract class DocGenerator extends Models {
else {
def aref1(sym: Symbol): NodeSeq = {
val isJava = sym hasFlag Flags.JAVA
- if (isJava || sym.sourceFile == null) {
+ if (isJava || (sym.sourceFile eq null)) {
val name = sym.nameString
val args =
if (isJava) "()" // todo: arguments
@@ -1059,7 +1059,7 @@ abstract class DocGenerator extends Models {
def organize0(mmbr: HasTree, map0: ListMap[Kind, TreeSet[HasTree]]) = {
var map = map0
- assert(mmbr.kind != null)
+ assert(mmbr.kind ne null)
if (!map.contains(mmbr.kind))
map = map.update(mmbr.kind, new TreeSet[HasTree])
val sz = map(mmbr.kind).size
@@ -1083,7 +1083,7 @@ abstract class DocGenerator extends Models {
import org.xml.sax.InputSource;
val isrc1 = new InputSource(new StringReader(str));
val parsedxml1 = XML.load(isrc1);
- if (parsedxml1 == null) Text("BAD_COMMENT???");
+ if (parsedxml1 eq null) Text("BAD_COMMENT???");
else parsedxml1;
*/
}
@@ -1116,7 +1116,7 @@ abstract class DocGenerator extends Models {
private def comment(comment: String, isShort: Boolean): NodeSeq = {
var ret: List[Node] = Nil
- assert(comment != null)
+ assert(comment ne null)
// strip out any stars.
var comment0 = comment.trim()
assert(comment0 startsWith JDOC_START)
@@ -1139,7 +1139,7 @@ abstract class DocGenerator extends Models {
if (mat2.matches) {
attr = Triple(mat2.group(1), mat2.group(2), new StringBuilder(mat2.group(3)))
attributes += attr
- } else if (attr != null)
+ } else if (attr ne null)
attr._3.append(s + LINE_SEPARATOR)
else
buf.append(s + LINE_SEPARATOR)
@@ -1163,7 +1163,7 @@ abstract class DocGenerator extends Models {
{tag(attr._1)}
</dt>
<dd> {
- if (attr._2 == null) NodeSeq.Empty
+ if (attr._2 eq null) NodeSeq.Empty
else if (attr._1.equals("throws"))
<code>{ exceptions.get(attr._2) match {
case Some(p) =>
diff --git a/src/compiler/scala/tools/nsc/doc/DocUtil.scala b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
index a2ec4c274b..92373c37fd 100644
--- a/src/compiler/scala/tools/nsc/doc/DocUtil.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocUtil.scala
@@ -39,10 +39,10 @@ object DocUtil {
def aref(href0: String, target: String, text: String): NodeSeq = {
val href = Utility.escape(href0)
- if (target != null && target.indexOf('<') != -1) throw new Error(target)
+ if ((target ne null) && target.indexOf('<') != -1) throw new Error(target)
val t0 = Text(text)
- if (target != null)
+ if ((target ne null))
<a href={(relative + href)} target={(target)}>{t0}</a>;
else
<a href={(relative + href)}>{t0}</a>;
diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
index 9fe5ccfbd7..0ef0a18216 100644
--- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala
+++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala
@@ -154,7 +154,7 @@ abstract class AbstractFile extends AnyRef with Iterable[AbstractFile] {
assert(index < 0 || start < index)
val name = path.substring(start, if (index < 0) length else index)
file = file.lookupName(name, if (index < 0) directory else true)
- if (file == null || index < 0) return file
+ if ((file eq null) || index < 0) return file
start = index + 1
}
file
diff --git a/src/compiler/scala/tools/nsc/io/PlainFile.scala b/src/compiler/scala/tools/nsc/io/PlainFile.scala
index 1cf3241b80..c863a30e68 100644
--- a/src/compiler/scala/tools/nsc/io/PlainFile.scala
+++ b/src/compiler/scala/tools/nsc/io/PlainFile.scala
@@ -27,7 +27,7 @@ object PlainFile {
*/
class PlainFile(val file: File) extends AbstractFile {
- assert(file != null)
+ assert(file ne null)
assert(file.exists(), "non-existent file: " + file)
//########################################################################
@@ -67,7 +67,7 @@ class PlainFile(val file: File) extends AbstractFile {
def elements: Iterator[AbstractFile] = {
assert(isDirectory, "not a directory '" + this + "'")
val names: Array[String] = file.list()
- if (names == null || names.length == 0) Iterator.empty
+ if ((names eq null) || names.length == 0) Iterator.empty
else Iterator.fromArray(names).map { name: String => new File(file, name) }
.filter(.exists()).map(file => new PlainFile(file))
}
diff --git a/src/compiler/scala/tools/nsc/io/VirtualFile.scala b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
index 63e8674125..05c4dc8aec 100644
--- a/src/compiler/scala/tools/nsc/io/VirtualFile.scala
+++ b/src/compiler/scala/tools/nsc/io/VirtualFile.scala
@@ -17,7 +17,7 @@ import java.io.{File,InputStream}
*/
class VirtualFile(val name: String, _path: String) extends AbstractFile {
- assert(name != null && path != null, name + " - " + path)
+ assert((name ne null) && (path ne null), name + " - " + path)
//########################################################################
// Public Constructors
diff --git a/src/compiler/scala/tools/nsc/io/ZipArchive.scala b/src/compiler/scala/tools/nsc/io/ZipArchive.scala
index 177a13922c..4f2482c112 100644
--- a/src/compiler/scala/tools/nsc/io/ZipArchive.scala
+++ b/src/compiler/scala/tools/nsc/io/ZipArchive.scala
@@ -58,7 +58,7 @@ object ZipArchive {
*/
final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file) {
- assert(archive != null)
+ assert(archive ne null)
//########################################################################
// Private Fields
@@ -73,7 +73,7 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
/** Returns all abstract subfiles of this abstract directory. */
override def elements: Iterator[AbstractFile] = {
- if (root == null) load()
+ if (root eq null) load()
root.elements
}
@@ -84,7 +84,7 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
* or a regular file.
*/
override def lookupName(name: String, directory: Boolean): AbstractFile = {
- if (root == null) load()
+ if (root eq null) load()
root.lookupName(name, directory)
}
@@ -105,7 +105,7 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
this.toString() + " - " + path);
if (entry.isDirectory()) {
val dir: DirEntry = getDir(dirs, path)
- assert(dir.entry == null, this.toString() + " - " + path)
+ assert(dir.entry eq null, this.toString() + " - " + path)
dir.entry = entry
} else {
val index = path.lastIndexOf('/')
@@ -165,7 +165,7 @@ final class ZipArchive(file: File, val archive: ZipFile) extends PlainFile(file)
override def read = throw new Error("cannot read directories");
override def lastModified: Long =
- if (entry != null) entry.getTime() else super.lastModified
+ if (entry ne null) entry.getTime() else super.lastModified
override def elements: Iterator[AbstractFile] = entries.values
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
index 77f68e7153..da942995cb 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
@@ -391,13 +391,13 @@ trait PatternMatchers requires (transform.ExplicitOuter with PatternNodes) {
case Bind(name, Ident(nme.WILDCARD)) => // x @ _
val node = pDefaultPat(tree.pos, header.getTpe())
- if ((env != null) && (tree.symbol != defs.PatternWildcard))
+ if ((env ne null) && (tree.symbol != defs.PatternWildcard))
env.newBoundVar( tree.symbol, tree.tpe, header.selector);
node
case Bind(name, pat) => // x @ p
val node = patternNode(pat, header, env)
- if ((env != null) && (tree.symbol != defs.PatternWildcard)) {
+ if ((env ne null) && (tree.symbol != defs.PatternWildcard)) {
val theValue = node.symbol match {
case NoSymbol => header.selector
case x => Ident(x) setType x.tpe
@@ -426,7 +426,7 @@ trait PatternMatchers requires (transform.ExplicitOuter with PatternNodes) {
//Console.println(av.toString()+" IS N O T RIGHTIGNORING");
pSequencePat(tree.pos, tree.tpe, ts.length);
}
- } else if ((fn.symbol != null) &&
+ } else if ((fn.symbol ne null) &&
fn.symbol.isStable &&
!(fn.symbol.isModule &&
((fn.symbol.flags & Flags.CASE) != 0))) {
@@ -527,7 +527,7 @@ trait PatternMatchers requires (transform.ExplicitOuter with PatternNodes) {
*/
case _ =>
Predef.error("unit = " + cunit + "; tree = " +
- (if (tree == null) "null" else tree))
+ (if (tree eq null) "null" else tree))
}
//Console.print(t);
t
@@ -609,7 +609,7 @@ print()
var curHeader: Header = target.and match {
case null => null
case h: Header => h // advance one step in intermediate representation
- case b: Body if b.or != null => b.or.asInstanceOf[Header]
+ case b: Body if (b.or ne null) => b.or.asInstanceOf[Header]
case b: Body =>
if (b.guard(b.guard.length - 1) == EmptyTree) {
cunit.error(pat.pos, "unreachable code")
@@ -620,7 +620,7 @@ print()
null
}
}
- if (curHeader == null) { // check if we have to add a new header
+ if (curHeader eq null) { // check if we have to add a new header
//Console.println(" -- adding new header")
//assert index >= 0 : casted;
if (index < 0) { Predef.error("error entering:" + casted); return null }
@@ -630,7 +630,7 @@ print()
curHeader = newHeader(pat.pos, casted, index)
target.and = curHeader; // (*)
- if (bodycond != null) target.and = bodycond(target.and) // restores body with the guards
+ if (bodycond ne null) target.and = bodycond(target.and) // restores body with the guards
curHeader.or = patternNode(pat, curHeader, env)
enter(patArgs, curHeader.or, casted, env)
@@ -638,7 +638,7 @@ print()
} else {
//Console.println(" enter: using old header for casted = "+casted) // DBG
// find most recent header
- while (curHeader.next != null)
+ while (curHeader.next ne null)
curHeader = curHeader.next
// create node
var patNode = patternNode(pat, curHeader, env)
@@ -655,7 +655,7 @@ print()
}
return enter(patArgs, next, casted, env);
} else if (next.isDefaultPat() || // default case reached, or
- ((next.or == null) && // no more alternatives and
+ ((next.or eq null) && // no more alternatives and
(patNode.isDefaultPat() || next.subsumes(patNode)))) {
// new node is default or subsumed
var header = pHeader(patNode.pos,
@@ -668,7 +668,7 @@ print()
casted,
env);
}
- else if (next.or == null) {
+ else if (next.or eq null) {
//Console.println(" -- add new branch!")
return enter(patArgs, {next.or = patNode; patNode}, casted, env); // add new branch
} else
@@ -757,9 +757,9 @@ print()
protected def isSimpleSwitch(): Boolean = {
print();
var patNode = root.and;
- while (patNode != null) {
+ while (patNode ne null) {
var node = patNode;
- while (({node = node.or; node}) != null) {
+ while (({node = node.or; node}) ne null) {
node match {
case VariablePat(tree) =>
//Konsole.println(((tree.symbol.flags & Flags.CASE) != 0));
@@ -770,7 +770,7 @@ print()
//outer: while (true) {
inner match {
case _h:Header =>
- if (_h.next != null)
+ if (_h.next ne null)
throw Break(false);
funct(inner.or)
@@ -810,9 +810,9 @@ print()
protected def isSimpleIntSwitch(): Boolean =
if (isSameType(selector.tpe.widen, defs.IntClass.tpe)) {
var patNode = root.and
- while (patNode != null) {
+ while (patNode ne null) {
var node = patNode;
- while (({node = node.or; node}) != null) {
+ while (({node = node.or; node}) ne null) {
node match {
case ConstantPat(_) => ;
case DefaultPat() => // experimental: enable simple int switch with default
@@ -847,7 +847,7 @@ print()
protected def numCases(patNode1: PatternNode): Int = {
var patNode = patNode1
var n = 0
- while (({patNode = patNode.or; patNode}) != null)
+ while (({patNode = patNode.or; patNode}) ne null)
patNode match {
case DefaultPat() => ;
case _ => n = n + 1
@@ -857,9 +857,9 @@ print()
protected def defaultBody(patNode1: PatternNode, otherwise: Tree ): Tree = {
var patNode = patNode1;
- while (patNode != null) {
+ while (patNode ne null) {
var node = patNode
- while (({node = node.or; node}) != null)
+ while (({node = node.or; node}) ne null)
node match {
case DefaultPat() =>
return node.and.bodyToTree();
@@ -875,7 +875,7 @@ print()
*/
def intSwitchToTree(): Tree = {
def insert1(tag: Int, body: Tree, current: TagBodyPair): TagBodyPair = {
- if (current == null)
+ if (current eq null)
new TagBodyPair(tag, body, null)
else if (tag > current.tag)
new TagBodyPair(current.tag, current.body, insert1(tag, body, current.next))
@@ -911,9 +911,9 @@ print()
var mappings: TagBodyPair = null
var defaultBody1: Tree = matchError
var patNode = root.and
- while (patNode != null) {
+ while (patNode ne null) {
var node = patNode.or
- while (node != null) {
+ while (node ne null) {
node match {
case DefaultPat() =>
//experimental: allow default body
@@ -935,7 +935,7 @@ print()
var n = mappings.length()
var nCases: List[CaseDef] = Nil
- while (mappings != null) {
+ while (mappings ne null) {
nCases = CaseDef(Literal(mappings.tag),
mappings.body) :: nCases;
mappings = mappings.next;
@@ -944,7 +944,7 @@ print()
val tags = new Array[Int](n);
val bodies = new Array[Tree](n);
n = 0;
- while (mappings != null) {
+ while (mappings ne null) {
tags(n) = mappings.tag;
bodies(n) = mappings.body;
n = n + 1;
@@ -977,7 +977,7 @@ print()
if (!optimize || !isSubType(selType, defs.ScalaObjectClass.tpe))
return false;
var cases = 0;
- while (alts != null) {
+ while (alts ne null) {
alts match {
case ConstrPat(_) =>
if (alts.getTpe().symbol.hasFlag(Flags.CASE))
@@ -998,7 +998,7 @@ print()
var node = node1;
var res: Tree = typed(Literal(Constant(false))); //.setInfo(defs.BooleanClass);
- while (node != null)
+ while (node ne null)
node match {
case _h:Header =>
@@ -1039,7 +1039,7 @@ print()
res = Or(squeezedBlock(ts.toList, res0), res);
i = i - 1
}
- if (_b.or != null)
+ if (_b.or ne null)
res = Or(res, toTree(_b.or))
return res;
case _ =>
@@ -1059,7 +1059,7 @@ print()
protected def toOptTree(node1: PatternNode, selector: Tree): Tree = {
def insert2(tag: Int, node: PatternNode, current: TagNodePair): TagNodePair = {
- if (current == null)
+ if (current eq null)
return new TagNodePair(tag, node, null);
else if (tag > current.tag)
return new TagNodePair(current.tag, current.node, insert2(tag, node, current.next));
@@ -1080,7 +1080,7 @@ print()
//System.err.println("pm.toOptTree called"+node);
var cases: TagNodePair = null
var defaultCase: PatternNode = null
- while (node != null)
+ while (node ne null)
node match {
case ConstrPat(casted) =>
cases = insertNode(node.getTpe().symbol.tag, node, cases)
@@ -1115,18 +1115,18 @@ print()
List()),
tags,
bodies,
- { if (defaultCase == null) Literal(false) else toTree(defaultCase.and) },
+ { if (defaultCase eq null) Literal(false) else toTree(defaultCase.and) },
defs.boolean_TYPE());
*/
var nCases: List[CaseDef] = Nil
- while (cases != null) {
+ while (cases ne null) {
nCases = CaseDef(Literal(Constant(cases.tag)),
toTree(cases.node, selector)) :: nCases;
cases = cases.next
}
val defBody =
- if (defaultCase == null) Literal(Constant(false))
+ if (defaultCase eq null) Literal(Constant(false))
else toTree(defaultCase.and)
nCases = CaseDef(Ident(nme.WILDCARD), defBody) :: nCases;
@@ -1149,9 +1149,9 @@ print()
protected def toTree(node: PatternNode, selector:Tree): Tree = {
//Konsole.println("pm.toTree("+node+","+selector+") selector.tpe = "+selector.tpe+")")
- if (selector.tpe == null)
+ if (selector.tpe eq null)
scala.Predef.error("cannot go on")
- if (node == null)
+ if (node eq null)
return Literal(Constant(false));
else
node match {
@@ -1248,7 +1248,7 @@ print()
else And(tpetest, seqLongerThan(treeAsSeq, ntpe, minlen))
var bindings =
- if(castedRest != null)
+ if(castedRest ne null)
List(ValDef(castedRest, seqDrop(treeAsSeq.duplicate, minlen)))
else
List()
diff --git a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
index eda7336711..b6806c18d5 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
@@ -138,7 +138,7 @@ trait PatternNodes requires transform.ExplicitOuter {
case VariablePat(tree) =>
q match {
case VariablePat(other) =>
- (tree.symbol != null) &&
+ (tree.symbol ne null) &&
(tree.symbol != NoSymbol) &&
(!tree.symbol.isError) &&
(tree.symbol == other.symbol)
@@ -175,7 +175,7 @@ trait PatternNodes requires transform.ExplicitOuter {
def print(indent: String, sb: StringBuilder): StringBuilder = {
val patNode = this
- def cont = if (patNode.or != null) patNode.or.print(indent, sb) else sb
+ def cont = if (patNode.or ne null) patNode.or.print(indent, sb) else sb
def newIndent(s: String) = {
val removeBar: Boolean = (null == patNode.or)
@@ -190,7 +190,7 @@ trait PatternNodes requires transform.ExplicitOuter {
sb.toString()
}
- if (patNode == null)
+ if (patNode eq null)
sb.append(indent).append("NULL")
else
patNode match {
@@ -202,7 +202,7 @@ trait PatternNodes requires transform.ExplicitOuter {
sb.append(indent + "HEADER(" + patNode.getTpe() +
", " + selector + ")").append('\n')
patNode.or.print(indent + "|", sb)
- if (next != null)
+ if (next ne null)
next.print(indent, sb)
else
sb
diff --git a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
index 1ab16f0203..cdd4c5fee2 100644
--- a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
+++ b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
@@ -47,7 +47,7 @@ with PatternMatchers */ {
(treeInfo.isVariableName(name)) && (name != nme.USCOREkw)
def isVariableSymbol(sym: Symbol): Boolean =
- (sym != null) && (!sym.isPrimaryConstructor)
+ (sym ne null) && (!sym.isPrimaryConstructor)
def traverse(tree: Tree): Unit = {
tree match {
diff --git a/src/compiler/scala/tools/nsc/models/Models.scala b/src/compiler/scala/tools/nsc/models/Models.scala
index 07286a0153..db000efd1e 100644
--- a/src/compiler/scala/tools/nsc/models/Models.scala
+++ b/src/compiler/scala/tools/nsc/models/Models.scala
@@ -126,8 +126,8 @@ abstract class Models {
}
ret = ret + " : " + textFor(vdef.tpt)
case atd: AbsTypeDef =>
- ret = ret + ((if(atd.hi != null) " <: " + textFor(atd.hi) else "") +
- (if(atd.lo != null) " >: " + textFor(atd.lo) else ""));
+ ret = ret + ((if(atd.hi ne null) " <: " + textFor(atd.hi) else "") +
+ (if(atd.lo ne null) " >: " + textFor(atd.lo) else ""));
case _ =>
ret = ret + tree.toString()
}
@@ -210,7 +210,7 @@ abstract class Models {
Console.err.println("PACKAGE: " + mmbr1.symbol + " " + members1.length)
} else if (isMember(mmbr1)) {
val mmbr2 = member(mmbr1, members1)
- if (mmbr2 != null) {
+ if (mmbr2 ne null) {
var found = false
for (val mmbr <- members) if (!found && mmbr.replacedBy(mmbr2)) {
//Console.err.println("REPLACE: " + mmbr + " with " + mmbr2)
@@ -252,7 +252,7 @@ abstract class Models {
} else false
override def update(tree0: Tree): Boolean = {
- val updated = tree == null || (treex.mods != tree0.asInstanceOf[MemberDef].mods)
+ val updated = (tree eq null) || (treex.mods != tree0.asInstanceOf[MemberDef].mods)
super.update(tree0) || updated;
}
}
@@ -271,7 +271,7 @@ abstract class Models {
override def update(tree0: Tree): Boolean = {
val tree1 = tree0.asInstanceOf[ValOrDefDef]
- val updated = tree == null || treex.tpe != tree1.tpe
+ val updated = (tree eq null) || treex.tpe != tree1.tpe
update0(flatten(tree1.rhs, (tree2: Tree) => isMember(tree2)))
super.update(tree0) || updated
}
@@ -313,7 +313,7 @@ abstract class Models {
val tree0 = if (tree.isInstanceOf[DefDef]) {
val ddef = tree.asInstanceOf[DefDef]
ddef.mods
- if (ddef.mods.isAccessor && ddef.symbol != null) {
+ if (ddef.mods.isAccessor && (ddef.symbol ne null)) {
val sym0 = ddef.symbol;
if (sym0.isSetter) return null;
assert(sym0.isGetter);
@@ -336,7 +336,7 @@ abstract class Models {
} else super.member(tree, members)
def sym = tree0.symbol
- if (tree0 == null || tree0.pos == NoPos) null
+ if ((tree0 eq null) || tree0.pos == NoPos) null
else if (!acceptPrivate &&
tree0.isInstanceOf[ValOrDefDef] &&
tree.asInstanceOf[ValOrDefDef].mods.isPrivate) null
diff --git a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
index 6404a4fa28..3d4b199304 100644
--- a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
+++ b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
@@ -131,10 +131,10 @@ class SemanticTokens(val compiler: Global) {
def source = unit.source
def dbg(tree : Tree) = {
- def treePos : Int = if (tree != null) tree.pos else -1;
+ def treePos : Int = if (tree ne null) tree.pos else -1;
(
"TREE=" + tree +
- (if (tree != null) (" CLASS=" + tree.getClass()) else "") +
+ (if (tree ne null) (" CLASS=" + tree.getClass()) else "") +
" SYM=" + tree.symbol +
" POS=" +
(new Position(source, treePos)).dbgString
@@ -188,7 +188,7 @@ class SemanticTokens(val compiler: Global) {
class Use(symbol0: Symbol, tpe0: Type) extends Semantic(symbol0) {
info.uses += this
- override def tpe : Type = if (tpe0 != null) tpe0 else super.tpe;
+ override def tpe : Type = if (tpe0 ne null) tpe0 else super.tpe;
override def toString() = "use-" + name + "-" + symbol.getClass();
}
val list = new TokenList
@@ -244,7 +244,7 @@ class SemanticTokens(val compiler: Global) {
}
try {
//TPT=scala.Iterator[DocGenerator.this.compiler0.CompilationUnit] 260 class scala.tools.nsc.ast.Trees$TypeTree scala.Iterator[DocGenerator.this.compiler0.CompilationUnit] class scala.tools.nsc.symtab.Types$$anon$5
- if (tree.tpt == null || tree.tpt.tpe == null) {
+ if ((tree.tpt eq null) || (tree.tpt.tpe eq null)) {
//Console.err.println("BAD: " + tree.tpt + " in " + tree);
} else {
//Console.err.println("TPT=" + tree.tpt + " " + tree.tpt.pos + " " + tree.tpt.getClass() + " " + tree.tpt.tpe + " " + tree.tpt.tpe.getClass() + " " + tree.tpt.tpe.getClass().getSuperclass());
@@ -283,14 +283,14 @@ class SemanticTokens(val compiler: Global) {
build(tree.body)
case tree : TypeTree =>
val treex = tree
- val tree1 = if (tree.original != null) tree.original else tree
+ val tree1 = if (tree.original ne null) tree.original else tree
def classes(clazz: java.lang.Class): List[java.lang.Class] =
- if (clazz == null) Nil
+ if (clazz eq null) Nil
else clazz :: classes(clazz.getSuperclass())
- if (tree.original == null) {
+ if (tree.original eq null) {
if (false) Console.err.println("NO_ORIGINAL: " + tree + " " + tree.tpe + " " + classes(tree.tpe.getClass()));
}
- if (tree.tpe != null) buildT(tree1, tree.tpe);
+ if (tree.tpe ne null) buildT(tree1, tree.tpe);
def buildT( tree : Tree, tpe : Type) : Unit = if (tree.pos != NoPos) tpe match {
case tpe0 : TypeRef => tree match {
case apt : AppliedTypeTree =>
@@ -315,10 +315,10 @@ class SemanticTokens(val compiler: Global) {
throw e;
}
case tpt : TypeTree =>
- if (tpt.symbol != null) {
+ if (tpt.symbol ne null) {
Console.err.println("SYM0 " + tpt.symbol + " " + unit.source.dbg(tpt.pos));
buildUse(tpt.symbol, tpt.pos, tpe0);
- } else if (tpe0.symbol != null) {
+ } else if (tpe0.symbol ne null) {
//Console.err.println("TYPE_SYM1 " + tpe0.symbol + " " + unit.source.dbg(tpt.pos));
buildUse(tpe0.symbol, tpt.pos, tpe0);
} else {
@@ -334,7 +334,7 @@ class SemanticTokens(val compiler: Global) {
}
case tpe0 : MethodType => tree match {
case tpt: TypeTree =>
- if (tpt.original != null) buildT(tpt.original, tpe);
+ if (tpt.original ne null) buildT(tpt.original, tpe);
else {
Console.err.println("UNKNOWN TPT3: " + tree + " vs. " + tpe0 + " " + unit.source.content(tree.pos));
}
@@ -389,7 +389,7 @@ class SemanticTokens(val compiler: Global) {
} else if (trees.isEmpty != types.isEmpty) {
if (false && doLog) {
Console.println("" + treex + " vs. " + treex.original);
- if (treex.original != null)
+ if (treex.original ne null)
Console.println("" + treex.tpe + " vs. " + treex.original.tpe);
logError("Tree vs. Type mismatch: " + trees + " " + types + " " + unit.source.dbg(tree.pos), null);
doLog = false;
@@ -468,7 +468,7 @@ class SemanticTokens(val compiler: Global) {
case tree : Alternative => build(tree.trees);
case tree : This =>
//Console.err.println("THIS: " + tree.symbol + " " + tree.qual + " " + unit.source.dbg(tree.pos) + " " + tree.tpe);
- if (tree.symbol != null) buildUse(tree.symbol, tree.pos, tree.tpe);
+ if (tree.symbol ne null) buildUse(tree.symbol, tree.pos, tree.tpe);
//Thread.dumpStack();
case tree : AliasTypeDef =>
//Console.err.println("ALIAS: " + tree);
diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
index c2953e0a5c..b899c04999 100644
--- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala
@@ -44,7 +44,7 @@ abstract class AbstractReporter extends Reporter {
/** Logs a position and returns true if it was already logged. */
private def testAndLog(pos : Position) : Boolean = {
- if (pos == null) return false;
+ if (pos eq null) return false;
if (pos.column == 0) return false;
if (positions.contains(pos)) return true;
positions += (pos);
diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala
index 8c59c21f19..f020e0c6af 100644
--- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala
+++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala
@@ -34,7 +34,7 @@ class ConsoleReporter(reader : BufferedReader, writer : PrintWriter) extends Abs
}
def clabel(severity : Severity) = {
val label0 = label(severity)
- if (label0 == null) "" else label0 + ": "
+ if (label0 eq null) "" else label0 + ": "
}
@@ -69,7 +69,7 @@ class ConsoleReporter(reader : BufferedReader, writer : PrintWriter) extends Abs
/** Prints the message with the given position indication. */
def printMessage(posIn : Position, msg : String) : Unit = {
- if (posIn != null) {
+ if (posIn ne null) {
val pos = posIn.inUltimateSource
val buf = new StringBuilder(msg)
buf.insert(0, " ")
@@ -89,12 +89,12 @@ class ConsoleReporter(reader : BufferedReader, writer : PrintWriter) extends Abs
def print(pos : Position, msg : String, severity : Severity) = printMessage(pos, clabel(severity) + msg)
- def printSourceLine(pos : Position) = if (pos != null && pos.offset != Position.NOPOS) {
+ def printSourceLine(pos : Position) = if ((pos ne null) && pos.offset != Position.NOPOS) {
printMessage(pos.lineContent.stripLineEnd)
printColumnMarker(pos)
}
/** Prints the column marker of the given position. */
- def printColumnMarker(pos : Position) = if (pos != null) {
+ def printColumnMarker(pos : Position) = if (pos ne null) {
val buffer = new StringBuilder(pos.column)
var i = 1
while (i < pos.column) {
@@ -123,7 +123,7 @@ class ConsoleReporter(reader : BufferedReader, writer : PrintWriter) extends Abs
writer.print("r)esume, a)bort: ")
writer.flush()
var line = reader.readLine()
- if (line != null) {
+ if (line ne null) {
line = line.toLowerCase()
if ("abort".startsWith(line))
throw new Error("user abort")
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 7aa716dde3..59bf1e71a0 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -397,7 +397,7 @@ trait Definitions requires SymbolTable {
newMethod(BooleanClass, nme.XOR, boolparam, booltype)
def initValueClass(clazz: Symbol, isCardinal: Boolean): Unit = {
- assert (clazz != null)
+ assert (clazz ne null)
def addBinops(params: List[Type], restype: Type, isCardinal: Boolean) = {
newMethod(clazz, nme.EQ, params, booltype)
@@ -535,7 +535,7 @@ trait Definitions requires SymbolTable {
JavaLangPackage = getModule("java.lang")
ScalaPackage = getModule("scala")
- assert(ScalaPackage != null, "Scala package is null")
+ assert(ScalaPackage ne null, "Scala package is null")
ScalaPackageClass = ScalaPackage.tpe.symbol
AnyClass = newClass(ScalaPackageClass, nme.Any, List()).setFlag(ABSTRACT)
diff --git a/src/compiler/scala/tools/nsc/symtab/Names.scala b/src/compiler/scala/tools/nsc/symtab/Names.scala
index dc73601a48..a27a2e5197 100644
--- a/src/compiler/scala/tools/nsc/symtab/Names.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Names.scala
@@ -90,9 +90,9 @@ class Names {
def newTermName(cs: Array[char], offset: int, len: int): Name = {
val h = hashValue(cs, offset, len) & HASH_MASK;
var n = termHashtable(h);
- while ((n != null) && (n.length != len || !equals(n.start, cs, offset, len)))
+ while ((n ne null) && (n.length != len || !equals(n.start, cs, offset, len)))
n = n.next;
- if (n == null) {
+ if (n eq null) {
n = new TermName(nc, len, h)
enterChars(cs, offset, len)
}
@@ -370,9 +370,9 @@ class Names {
def toTypeName = {
val h = hashValue(chrs, index, len) & HASH_MASK
var n = typeHashtable(h)
- while (n != null && n.start != index)
+ while ((n ne null) && n.start != index)
n = n.next;
- if (n == null)
+ if (n eq null)
n = new TypeName(index, len, h);
n
}
@@ -388,9 +388,9 @@ class Names {
def toTermName: Name = {
val h = hashValue(chrs, index, len) & HASH_MASK
var n = termHashtable(h)
- while (n != null && n.start != index)
+ while ((n ne null) && n.start != index)
n = n.next;
- if (n == null)
+ if (n eq null)
n = new TermName(index, len, h);
n
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Scopes.scala b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
index 3c2a1e8724..cfaccf44f1 100644
--- a/src/compiler/scala/tools/nsc/symtab/Scopes.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Scopes.scala
@@ -92,7 +92,7 @@ trait Scopes requires SymbolTable {
def this(base: Scope) = {
this(base.elems)
/*
- if (base.hashtable != null) {
+ if (base.hashtable ne null) {
this.hashtable = new Array[ScopeEntry](HASHSIZE)
System.arraycopy(base.hashtable, 0, this.hashtable, 0, HASHSIZE)
}
@@ -113,13 +113,13 @@ trait Scopes requires SymbolTable {
}
/** is the scope empty? */
- def isEmpty: boolean = elems == null
+ def isEmpty: boolean = elems eq null
/** the number of entries in this scope */
def size: int = {
var s = 0
var e = elems
- while (e != null) {
+ while (e ne null) {
s = s + 1
e = e.next
}
@@ -132,7 +132,7 @@ trait Scopes requires SymbolTable {
*/
def enter(e: ScopeEntry): unit = {
elemsCache = null
- if (hashtable != null) {
+ if (hashtable ne null) {
val i = e.sym.name.start & HASHMASK
elems.tail = hashtable(i)
hashtable(i) = elems
@@ -162,7 +162,7 @@ trait Scopes requires SymbolTable {
}
private def enterInHash(e: ScopeEntry): unit =
- if (e != null) {
+ if (e ne null) {
enterInHash(e.next)
val i = e.sym.name.start & HASHMASK
e.tail = hashtable(i)
@@ -181,7 +181,7 @@ trait Scopes requires SymbolTable {
while (e1.next != e) e1 = e1.next;
e1.next = e.next
}
- if (hashtable != null) {
+ if (hashtable ne null) {
var e1 = hashtable(e.sym.name.start & HASHMASK)
if (e1 == e) {
hashtable(e.sym.name.start & HASHMASK) = e.tail
@@ -196,7 +196,7 @@ trait Scopes requires SymbolTable {
/** remove symbol */
def unlink(sym: Symbol): unit = {
var e = lookupEntry(sym.name)
- while (e != null) {
+ while (e ne null) {
if (e.sym == sym) unlink(e);
e = lookupNextEntry(e)
}
@@ -209,7 +209,7 @@ trait Scopes requires SymbolTable {
*/
def lookup(name: Name): Symbol = {
val e = lookupEntry(name)
- if (e == null) NoSymbol else e.sym
+ if (e eq null) NoSymbol else e.sym
}
/** lookup a symbol entry matching given name.
@@ -219,12 +219,12 @@ trait Scopes requires SymbolTable {
*/
def lookupEntry(name: Name): ScopeEntry = {
var e: ScopeEntry = null
- if (false & hashtable != null) {
+ if (false & (hashtable ne null)) {
e = hashtable(name.start & HASHMASK)
- while (e != null && e.sym.name != name) e = e.tail;
+ while ((e ne null) && e.sym.name != name) e = e.tail;
} else {
e = elems
- while (e != null && e.sym.name != name) {
+ while ((e ne null) && e.sym.name != name) {
e = e.next;
}
}
@@ -234,20 +234,20 @@ trait Scopes requires SymbolTable {
/** lookup next entry with same name as this one */
def lookupNextEntry(entry: ScopeEntry): ScopeEntry = {
var e = entry
- if (hashtable != null) //debug
- do { e = e.tail } while (e != null && e.sym.name != entry.sym.name)
+ if (hashtable ne null) //debug
+ do { e = e.tail } while ((e ne null) && e.sym.name != entry.sym.name)
else
- do { e = e.next } while (e != null && e.sym.name != entry.sym.name);
+ do { e = e.next } while ((e ne null) && e.sym.name != entry.sym.name);
e
}
/** Return all symbols as a list in the order they were entered in this scope.
*/
def toList: List[Symbol] = {
- if (elemsCache == null) {
+ if (elemsCache eq null) {
elemsCache = Nil
var e = elems
- while (e != null && e.owner == this) {
+ while ((e ne null) && e.owner == this) {
elemsCache = e.sym :: elemsCache
e = e.next
}
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index be4c397d7d..3df8884e50 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -42,8 +42,8 @@ abstract class SymbolLoaders {
private var ok = false
/*
private def setSource(sym: Symbol, sourceFile0: AbstractFile): unit = sym match {
- case clazz: ClassSymbol => if (sourceFile0 != null) clazz.sourceFile = sourceFile0;
- case _ => if (sourceFile0 != null) if (false) System.err.println("YYY: " + sym + " " + sourceFile0);
+ case clazz: ClassSymbol => if (sourceFile0 ne null) clazz.sourceFile = sourceFile0;
+ case _ => if (sourceFile0 ne null) if (false) System.err.println("YYY: " + sym + " " + sourceFile0);
}
*/
def sourceFile : AbstractFile = null
@@ -66,7 +66,7 @@ abstract class SymbolLoaders {
if (settings.debug.value) ex.printStackTrace();
val msg = ex.getMessage()
error(
- if (msg == null) "i/o error while loading " + root.name
+ if (msg eq null) "i/o error while loading " + root.name
else "error while loading " + root.name + ", " + msg);
}
initRoot(root)
@@ -120,7 +120,7 @@ abstract class SymbolLoaders {
owner.info.decls.enter(clazz)
owner.info.decls.enter(module)
/*
- if (completer.sourceFile != null) {
+ if (completer.sourceFile ne null) {
clazz.sourceFile = completer.sourceFile;
module.moduleClass.sourceFile = completer.sourceFile
}
@@ -131,7 +131,7 @@ abstract class SymbolLoaders {
val classes = new HashMap[String, global.classPath0.Context]
val packages = new HashMap[String, global.classPath0.Context]
- for (val dir <- directory.entries) if (dir.location != null) {
+ for (val dir <- directory.entries) if (dir.location ne null) {
for (val file <- dir.location) {
if (file.isDirectory && directory.validPackage(file.name) && !packages.isDefinedAt(file.name))
packages(file.name) = directory.find(file.name, true);
@@ -139,12 +139,12 @@ abstract class SymbolLoaders {
val name = file.name.substring(0, file.name.length() - (".class").length());
if (isValid(name) && !classes.isDefinedAt(name)) {
val clazz = directory.find(name, false)
- if (clazz != null) classes(name) = clazz
+ if (clazz ne null) classes(name) = clazz
}
}
}
}
- for (val dir <- directory.entries) if (dir.source != null) {
+ for (val dir <- directory.entries) if (dir.source ne null) {
for (val file <- dir.source.location) {
if (file.isDirectory && directory.validPackage(file.name) && !packages.isDefinedAt(file.name))
packages(file.name) = directory.find(file.name, true);
@@ -152,7 +152,7 @@ abstract class SymbolLoaders {
val name = file.name.substring(0, file.name.length() - (".scala").length());
if (isValid(name) && !classes.isDefinedAt(name)) {
val source = directory.find(name, false)
- if (source != null) classes(name) = source
+ if (source ne null) classes(name) = source
}
}
}
@@ -165,7 +165,7 @@ abstract class SymbolLoaders {
val loader = if (!file.isSourceFile) {
new ClassfileLoader(file.classFile, file.sourceFile, file.sourcePath);
} else {
- assert(file.sourceFile != null)
+ assert(file.sourceFile ne null)
new SourcefileLoader(file.sourceFile)
}
enterClassAndModule(name, loader)
@@ -189,7 +189,7 @@ abstract class SymbolLoaders {
}
protected def doComplete(root: Symbol): unit = {
classfileParser.parse(classFile, root)
- if (sourceFile != null) root match {
+ if (sourceFile ne null) root match {
case clazz : ClassSymbol => clazz.sourceFile = sourceFile
case _ =>
}
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala b/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala
index ccc33587dd..b1f7a817fd 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolTable.scala
@@ -41,7 +41,7 @@ abstract class SymbolTable extends Names
def phase_=(p: Phase): unit = {
//System.out.println("setting phase to " + p)
- assert(p != null && p != NoPhase)
+ assert((p ne null) && p != NoPhase)
ph = p
per = (currentRunId << 8) + p.id
}
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index cd8d3c2ea2..952ba7e582 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -378,8 +378,8 @@ trait Symbols requires SymbolTable {
while (runId(validTo) != currentRunId) {
//if (settings.debug.value) System.out.println("completing " + this);//DEBUG
var ifs = infos
- assert(ifs != null, this.name)
- while (ifs.prev != null) {
+ assert(ifs ne null, this.name)
+ while (ifs.prev ne null) {
ifs = ifs.prev
}
val tp = ifs.info
@@ -408,7 +408,7 @@ trait Symbols requires SymbolTable {
/** Set initial info. */
def setInfo(info: Type): this.type = {
- assert(info != null)
+ assert(info ne null)
var period = currentPeriod
if (phaseId(period) == 0) {
// can happen when we initialize NoSymbol before running the compiler
@@ -458,11 +458,11 @@ trait Symbols requires SymbolTable {
phase = current
validTo = currentPeriod
}
- assert(infos != null, name)
+ assert(infos ne null, name)
infos.info
} else {
var infos = this.infos
- while (phase.id < infos.start && infos.prev != null) infos = infos.prev
+ while (phase.id < infos.start && (infos.prev ne null)) infos = infos.prev
infos.info
}
}
@@ -476,8 +476,8 @@ trait Symbols requires SymbolTable {
/** Was symbol's type updated during given phase? */
final def isUpdatedAt(pid: Phase#Id): boolean = {
var infos = this.infos
- while (infos != null && infos.start != pid + 1) infos = infos.prev
- infos != null
+ while ((infos ne null) && infos.start != pid + 1) infos = infos.prev
+ (infos ne null)
}
/** The type constructor of a symbol is:
@@ -1082,16 +1082,16 @@ trait Symbols requires SymbolTable {
tpeCache = typeRef(if (isTypeParameterOrSkolem) NoPrefix else owner.thisType, this, targs)
}
}
- assert(tpeCache != null/*, "" + this + " " + phase*/)//debug
+ assert(tpeCache ne null/*, "" + this + " " + phase*/)//debug
tpeCache
}
override def typeConstructor: Type = {
- if (tyconCache == null || tyconRunId != currentRunId) {
+ if ((tyconCache eq null) || tyconRunId != currentRunId) {
tyconCache = typeRef(if (isTypeParameter) NoPrefix else owner.thisType, this, List())
tyconRunId = currentRunId
}
- assert(tyconCache != null)
+ assert(tyconCache ne null)
tyconCache
}
@@ -1148,7 +1148,7 @@ trait Symbols requires SymbolTable {
source = f
}
override def isFromClassFile = {
- if (classFile != null) true
+ if (classFile ne null) true
else if (owner.isPackageClass) false
else super.isFromClassFile
}
@@ -1264,7 +1264,7 @@ trait Symbols requires SymbolTable {
/** A class for type histories */
private case class TypeHistory(start: Phase#Id, info: Type, prev: TypeHistory) {
- assert(prev == null || start > prev.start, this)
+ assert((prev eq null) || start > prev.start, this)
assert(start != 0)
override def toString() =
"TypeHistory(" + phaseWithId(start) + "," + info + "," + prev + ")"
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 091d7117ef..6ecf89ad04 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -386,7 +386,7 @@ trait Types requires SymbolTable {
var alts: List[Symbol] = List()
var sym: Symbol = NoSymbol
var e: ScopeEntry = decls.lookupEntry(name)
- while (e != null) {
+ while (e ne null) {
if (!e.sym.hasFlag(excludedFlags)) {
if (sym == NoSymbol) sym = e.sym
else {
@@ -428,7 +428,7 @@ trait Types requires SymbolTable {
bcs = if (name == nme.CONSTRUCTOR) Nil else bcs.tail
var entry =
if (name == nme.ANYNAME) decls.elems else decls lookupEntry name
- while (entry != null) {
+ while (entry ne null) {
val sym = entry.sym
if (sym.getFlag(requiredFlags) == requiredFlags) {
val excl = sym.getFlag(excluded)
@@ -440,28 +440,28 @@ trait Types requires SymbolTable {
return sym
} else if (member == NoSymbol) {
member = sym
- } else if (members == null) {
+ } else if (members eq null) {
if (member.name != sym.name ||
!(member == sym ||
member.owner != sym.owner &&
!sym.hasFlag(PRIVATE) && {
- if (self == null) self = this.narrow;
+ if (self eq null) self = this.narrow;
(self.memberType(member) matches self.memberType(sym))
})) {
members = newScope(List(member, sym))
}
} else {
var prevEntry = members lookupEntry sym.name
- while (prevEntry != null &&
+ while ((prevEntry ne null) &&
!(prevEntry.sym == sym ||
prevEntry.sym.owner != sym.owner &&
!sym.hasFlag(PRIVATE) && {
- if (self == null) self = this.narrow;
+ if (self eq null) self = this.narrow;
(self.memberType(prevEntry.sym) matches self.memberType(sym))
})) {
prevEntry = members lookupNextEntry prevEntry
}
- if (prevEntry == null) {
+ if (prevEntry eq null) {
members enter sym
}
}
@@ -470,7 +470,7 @@ trait Types requires SymbolTable {
}
}
entry = if (name == nme.ANYNAME) entry.next else decls lookupNextEntry entry
- } // while (entry != null)
+ } // while (entry ne null)
// excluded = excluded | LOCAL
} // while (!bcs.isEmpty)
excluded = excludedFlags
@@ -478,7 +478,7 @@ trait Types requires SymbolTable {
checkMalformedSwitch = savedCheckMalformedSwitch
if (util.Statistics.enabled)
findMemberMillis = findMemberMillis + currentTime - startTime
- if (members == null) {
+ if (members eq null) {
if (util.Statistics.enabled) if (member == NoSymbol) noMemberCount = noMemberCount + 1;
member
} else {
@@ -679,7 +679,7 @@ trait Types requires SymbolTable {
val index = new Array[int](nparents)
var i = 0
for (val p <- parents) {
- pclosure(i) = if (p.closure == null) AnyClass.info.closure // cyclic reference
+ pclosure(i) = if (p.closure eq null) AnyClass.info.closure // cyclic reference
else p.closure
index(i) = 0
i = i + 1
@@ -747,7 +747,7 @@ trait Types requires SymbolTable {
}
//Console.println("closure(" + symbol + ") = " + List.fromArray(closureCache));//DEBUG
}
- if (closureCache == null)
+ if (closureCache eq null)
throw new TypeError("illegal cyclic reference involving " + symbol)
closureCache
}
@@ -787,7 +787,7 @@ trait Types requires SymbolTable {
baseClassesCache = computeBaseClasses
}
}
- if (baseClassesCache == null)
+ if (baseClassesCache eq null)
throw new TypeError("illegal cyclic reference involving " + symbol)
baseClassesCache
}
@@ -806,7 +806,7 @@ trait Types requires SymbolTable {
override def toString(): String = (
parents.mkString("", " with ", "") +
- (if (settings.debug.value || parents.isEmpty || decls.elems != null)
+ (if (settings.debug.value || parents.isEmpty || (decls.elems ne null))
decls.mkString("{", "; ", "}") else "")
);
}
@@ -848,8 +848,8 @@ trait Types requires SymbolTable {
override def deconst: Type = value.tpe
override def toString(): String =
value.tpe.toString() + "(" + value.escapedStringValue + ")"
- // override def isNullable: boolean = value.value == null
- // override def isNonNull: boolean = value.value != null
+ // override def isNullable: boolean = value.value eq null
+ // override def isNonNull: boolean = value.value ne null
}
/** A class for named types of the form
@@ -1060,7 +1060,7 @@ trait Types requires SymbolTable {
case class TypeVar(origin: Type, constr: TypeConstraint) extends Type {
override def symbol = origin.symbol
override def toString(): String =
- if (constr.inst == null) "<null " + origin + ">"
+ if (constr.inst eq null) "<null " + origin + ">"
else if (constr.inst eq NoType) "?" + origin
else constr.inst.toString();
}
@@ -1286,7 +1286,7 @@ trait Types requires SymbolTable {
uniqueRunId = currentRunId
}
val tp1 = uniques.findEntry(tp)
- if (tp1 == null) {
+ if (tp1 eq null) {
uniques.addEntry(tp); tp
} else {
tp1.asInstanceOf[T]
@@ -1626,7 +1626,7 @@ trait Types requires SymbolTable {
var result: Symbol = _
def init = { result = NoSymbol }
def apply(tp: Type): Type = {
- assert(tp != null)
+ assert(tp ne null)
tp match {
case ThisType(sym) =>
register(sym)
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index f005b53921..3640cbbb5e 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -143,7 +143,7 @@ abstract class ClassfileParser {
def getName(index: int): Name = {
if (index <= 0 || len <= index) errorBadIndex(index)
var name = values(index).asInstanceOf[Name]
- if (name == null) {
+ if (name eq null) {
val start = starts(index)
if (in.buf(start) != CONSTANT_UTF8) errorBadTag(start)
name = newTermName(in.buf, start + 3, in.getChar(start + 1))
@@ -154,7 +154,7 @@ abstract class ClassfileParser {
def getExternalName(index: int): Name = {
if (index <= 0 || len <= index) errorBadIndex(index)
- if (internalized(index) == null) {
+ if (internalized(index) eq null) {
internalized(index) = getName(index).replace('/', '.')
}
internalized(index)
@@ -163,7 +163,7 @@ abstract class ClassfileParser {
def getClassSymbol(index: int): Symbol = {
if (index <= 0 || len <= index) errorBadIndex(index)
var c = values(index).asInstanceOf[Symbol]
- if (c == null) {
+ if (c eq null) {
val start = starts(index)
if (in.buf(start) != CONSTANT_CLASS) errorBadTag(start)
val name = getExternalName(in.getChar(start + 1))
@@ -185,7 +185,7 @@ abstract class ClassfileParser {
def getMemberSymbol(index: Int, static: Boolean): Symbol = {
if (index <= 0 || len <= index) errorBadIndex(index)
var f = values(index).asInstanceOf[Symbol]
- if (f == null) {
+ if (f eq null) {
val start = starts(index)
if (in.buf(start) != CONSTANT_FIELDREF &&
in.buf(start) != CONSTANT_METHODREF &&
@@ -215,7 +215,7 @@ abstract class ClassfileParser {
def getNameAndType(index: Int, ownerClass: Symbol): Pair[Name, Type] = {
if (index <= 0 || len <= index) errorBadIndex(index)
var p = values(index).asInstanceOf[Pair[Name, Type]]
- if (p == null) {
+ if (p eq null) {
val start = starts(index)
if (in.buf(start) != CONSTANT_NAMEANDTYPE) errorBadTag(start)
val name = getName(in.getChar(start + 1))
@@ -239,7 +239,7 @@ abstract class ClassfileParser {
if (index <= 0 || len <= index) errorBadIndex(index)
val value = values(index)
var c: Type = null
- if (value == null) {
+ if (value eq null) {
val start = starts(index)
if (in.buf(start) != CONSTANT_CLASS) errorBadTag(start)
val name = getExternalName(in.getChar(start + 1))
@@ -264,7 +264,7 @@ abstract class ClassfileParser {
def getConstant(index: int): Constant = {
if (index <= 0 || len <= index) errorBadIndex(index)
var value = values(index)
- if (value == null) {
+ if (value eq null) {
val start = starts(index)
value = in.buf(start) match {
case CONSTANT_STRING =>
@@ -610,7 +610,7 @@ abstract class ClassfileParser {
case nme.ConstantValueATTR =>
val c = pool.getConstant(in.nextChar)
val c1 = convertTo(c, symtype)
- if (c1 != null) sym.setInfo(ConstantType(c1))
+ if (c1 ne null) sym.setInfo(ConstantType(c1))
else Console.println("failure to convert " + c + " to " + symtype); //debug
case nme.InnerClassesATTR =>
if (!isScala) parseInnerClasses() else in.skip(attrLen)
@@ -625,9 +625,9 @@ abstract class ClassfileParser {
case nme.SourceFileATTR =>
assert(attrLen == 2)
val source = pool.getName(in.nextChar)
- if (sourcePath != null) {
+ if (sourcePath ne null) {
val sourceFile0 = sourcePath.lookupPath(source.toString(), false)
- if (sourceFile0 != null && clazz.sourceFile == null) {
+ if ((sourceFile0 ne null) && (clazz.sourceFile eq null)) {
clazz.sourceFile = sourceFile0
}
staticModule.moduleClass.sourceFile = clazz.sourceFile
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala
index b5fc245c62..83b5147ef9 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/MetaParser.scala
@@ -128,7 +128,7 @@ abstract class MetaParser{
protected def parseMethod(): unit = {
val globals = locals
- locals = if (locals == null) newScope else newScope(locals);
+ locals = if (locals eq null) newScope else newScope(locals);
def parse(): Type = {
nextToken();
if (token == "[") PolyType(parseTypeParams(), parse())
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala
index a9af8bb794..99d64a3018 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/SymblfileParser.scala
@@ -25,7 +25,7 @@ abstract class SymblfileParser {
}
def parse(file: AbstractFile, root: Symbol): unit = {
- assert(current == null, current)
+ assert(current eq null, current)
current = file
val bytes = new AbstractFileReader(file).buf
if (root.isModule)
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
index 27f355007b..ed09bc2433 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -99,11 +99,11 @@ abstract class UnPickler {
* readIndex at start of i'th entry. Restore readIndex afterwards. */
private def at[T <: AnyRef](i: int, op: () => T): T = {
var r = entries(i)
- if (r == null) {
+ if (r eq null) {
val savedIndex = readIndex
readIndex = index(i)
r = op()
- assert(entries(i) == null, entries(i))
+ assert(entries(i) eq null, entries(i))
entries(i) = r
readIndex = savedIndex
}
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index b58d47ef05..37138d2638 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -77,7 +77,7 @@ abstract class AddInterfaces extends InfoTransform {
atPhase(phase.next) {
val decls = iface.owner.info.decls
val e = decls.lookupEntry(impl.name)
- if (e == null) {
+ if (e eq null) {
decls enter impl
} else {
decls.unlink(e)
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index d0d77808ce..e7a8023c5f 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -47,7 +47,7 @@ abstract class Constructors extends Transform {
case _ =>
}
}
- assert(constr != null && constrBody != null, impl)
+ assert((constr ne null) && (constrBody ne null), impl)
val paramAccessors = clazz.constrParamAccessors
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index f8a1335084..8bffb80b2b 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -536,10 +536,10 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
val decls = root.info.decls
var e = decls.elems
- while (e != null) {
+ while (e ne null) {
if (e.sym.isTerm && !e.sym.isConstructor) {
var e1 = decls.lookupNextEntry(e)
- while (e1 != null) {
+ while (e1 ne null) {
if (atPhase(phase.next)(e1.sym.info =:= e.sym.info)) doubleDefError(e.sym, e1.sym)
e1 = decls.lookupNextEntry(e1)
}
@@ -626,9 +626,9 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
!(other.tpe =:= member.tpe) &&
!(deconstMap(other.tpe) =:= deconstMap(member.tpe)) &&
{ var e = bridgesScope.lookupEntry(member.name)
- while (e != null && !((e.sym.tpe =:= otpe) && (bridgeTarget(e.sym) == member)))
+ while ((e ne null) && !((e.sym.tpe =:= otpe) && (bridgeTarget(e.sym) == member)))
e = bridgesScope.lookupNextEntry(e);
- e == null
+ (e eq null)
}
);
if (bridgeNeeded) {
@@ -742,7 +742,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
if (fn.symbol == Any_asInstanceOf || fn.symbol == Any_asInstanceOfErased)
fn match {
case TypeApply(Select(qual, _), List(targ)) =>
- assert(qual.tpe != null, tree)
+ assert(qual.tpe ne null, tree)
if (qual.tpe <:< targ.tpe) atPos(tree.pos) { Typed(qual, TypeTree(qual.tpe)) }
else tree
}
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 091c4e4655..d38c7e144a 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -49,8 +49,8 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter
if (firstTry != NoSymbol && firstTry.outerSource == clazz) firstTry
else {
var e = clazz.info.decls.elems
- while (e != null && e.sym.outerSource != clazz) e = e.next
- if (e != null) e.sym else NoSymbol
+ while ((e ne null) && e.sym.outerSource != clazz) e = e.next
+ if (e ne null) e.sym else NoSymbol
}
}
@@ -309,7 +309,7 @@ abstract class ExplicitOuter extends InfoTransform with TransMatcher with Patter
/** The main transformation method */
override def transform(tree: Tree): Tree = {
val sym = tree.symbol
- if (sym != null && sym.isType) {//(9)
+ if ((sym ne null) && sym.isType) {//(9)
if (sym hasFlag PRIVATE) sym setFlag notPRIVATE
if (sym hasFlag PROTECTED) sym setFlag notPROTECTED
}
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index c8d00acd59..e134c6b72c 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -561,7 +561,7 @@ abstract class Mixin extends InfoTransform {
// change every node type that refers to an implementation class to its
// corresponding interface, unless the node's symbol is an implementation class.
if (tree.tpe.symbol.isImplClass &&
- (tree.symbol == null || !tree.symbol.isImplClass))
+ ((tree.symbol eq null) || !tree.symbol.isImplClass))
tree.tpe = toInterface(tree.tpe);
tree match {
diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
index 444077f838..f170c132e7 100644
--- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
+++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala
@@ -56,7 +56,7 @@ abstract class OverridingPairs {
if (!bcs.isEmpty) {
fillDecls(bcs.tail, deferredflag)
var e = bcs.head.info.decls.elems;
- while (e != null) {
+ while (e ne null) {
if (e.sym.getFlag(DEFERRED) == deferredflag && !exclude(e.sym))
decls enter e.sym;
e = e.next
@@ -102,29 +102,29 @@ abstract class OverridingPairs {
var overriding: Symbol = _
var overridden: Symbol = _
- def hasNext: boolean = curEntry != null
+ def hasNext: boolean = curEntry ne null
def next: unit =
- if (curEntry != null) {
+ if (curEntry ne null) {
overriding = curEntry.sym
- if (nextEntry != null) {
+ if (nextEntry ne null) {
do {
nextEntry = decls.lookupNextEntry(nextEntry);
- } while (nextEntry != null &&
+ } while ((nextEntry ne null) &&
((nextEntry.sym hasFlag PRIVATE) ||
(overriding.owner == nextEntry.sym.owner) ||
(!matches(overriding, nextEntry.sym)) ||
(hasCommonParent(overriding, nextEntry.sym)) ||
(overriding hasFlag LOCAL)))
}
- if (nextEntry != null) {
+ if (nextEntry ne null) {
overridden = nextEntry.sym;
//Console.println("yield: " + overriding + overriding.locationString + " / " + overridden + overridden.locationString);//DEBUG
visited addEntry nextEntry
} else {
do {
curEntry = curEntry.next
- } while (curEntry != null && (visited contains curEntry));
+ } while ((curEntry ne null) && (visited contains curEntry));
nextEntry = curEntry
next
}
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index be832a0a49..668730f36e 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -370,7 +370,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
}
case Apply(fn, args) =>
if (settings.noassertions.value &&
- fn.symbol != null &&
+ (fn.symbol ne null) &&
(fn.symbol.name == nme.assert_ || fn.symbol.name == nme.assume_) &&
fn.symbol.owner == PredefModule.moduleClass) {
Literal(()).setPos(tree.pos).setType(UnitClass.tpe)
diff --git a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
index adb314cf1e..21f8afe7ac 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
@@ -41,7 +41,7 @@ abstract class ConstantFolder {
private def fold(tree: Tree, compX: => Constant): Tree =
try {
val x = compX
- if (x != null && x.tag != UnitTag) tree setType ConstantType(x)
+ if ((x ne null) && x.tag != UnitTag) tree setType ConstantType(x)
else tree
} catch {
case _: ArithmeticException => tree // the code will crash at runtime,
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index b33caf6d2a..7d13a8f347 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -38,7 +38,7 @@ trait Contexts requires Analyzer {
import definitions._
var sc = startContext
def addImport(pkg: Symbol): unit = {
- assert(pkg != null)
+ assert(pkg ne null)
val qual = gen.mkAttributedStableRef(pkg)
sc = sc.makeNewImport(
Import(qual, List(Pair(nme.WILDCARD, null)))
@@ -49,7 +49,7 @@ trait Contexts requires Analyzer {
if (!settings.noimports.value) {
assert(isDefinitionsInitialized)
addImport(JavaLangPackage)
- assert(ScalaPackage != null, "Scala package is null")
+ assert(ScalaPackage ne null, "Scala package is null")
addImport(ScalaPackage)
if (!settings.nopredefs.value/* || unit.source.file.name != "Predef.scala"*/)
addImport(PredefModule)
@@ -101,7 +101,7 @@ trait Contexts requires Analyzer {
case that if (super.equals(that)) => true
case NoContext => false
case that : Context =>
- val a0 = if (tree == null) tree == that.tree else tree equalsStructure that.tree;
+ val a0 = if (tree eq null) tree == that.tree else tree equalsStructure that.tree;
val a1 = owner == that.owner;
val a2 = scope == that.scope;
val a3 = outer == that.outer;
@@ -326,8 +326,8 @@ trait Contexts requires Analyzer {
def accessWithin(owner: Symbol): boolean = {
var c = this
while (c != NoContext && c.owner != owner) {
- if (c.outer == null) assert(false, "accessWithin(" + owner + ") " + c);//debug
- if (c.outer.enclClass == null) assert(false, "accessWithin(" + owner + ") " + c);//debug
+ if (c.outer eq null) assert(false, "accessWithin(" + owner + ") " + c);//debug
+ if (c.outer.enclClass eq null) assert(false, "accessWithin(" + owner + ") " + c);//debug
c = c.outer.enclClass
}
c != NoContext
@@ -462,7 +462,7 @@ trait Contexts requires Analyzer {
class ImplicitInfo(val name: Name, val pre: Type, val sym: Symbol) {
private var tpeCache: Type = null
def tpe: Type = {
- if (tpeCache == null) tpeCache = pre.memberType(sym)
+ if (tpeCache eq null) tpeCache = pre.memberType(sym)
tpeCache
}
override def toString = "ImplicitInfo(" + name + "," + pre + "," + sym + ")"
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index a758f8abe6..93be3da36c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -137,7 +137,7 @@ trait Infer requires Analyzer {
((bound contains tparam2) ||
up && (tparam2.info.bounds.lo =:= tparam.tpe) ||
!up && (tparam2.info.bounds.hi =:= tparam.tpe))) {
- if (tvar2.constr.inst == null) cyclic = true
+ if (tvar2.constr.inst eq null) cyclic = true
solveOne(tvar2, tparam2, variance2)
}
}
@@ -221,7 +221,7 @@ trait Infer requires Analyzer {
(if (name.isTypeName) "type " else "value ") + name.decode
def treeSymTypeMsg(tree: Tree): String =
- if (tree.symbol == null)
+ if (tree.symbol eq null)
"expression of type " + tree.tpe
else if (tree.symbol.hasFlag(OVERLOADED))
"overloaded method " + tree.symbol + " with alternatives " + tree.tpe
@@ -326,7 +326,7 @@ trait Infer requires Analyzer {
sym.toplevelClass match {
case clazz : ClassSymbol =>
// System.err.println("TOP: " + clazz + " " + clazz.sourceFile)
- if (clazz.sourceFile != null)
+ if (clazz.sourceFile ne null)
global.currentRun.currentUnit.depends += clazz.sourceFile
case _ =>
@@ -524,7 +524,7 @@ trait Infer requires Analyzer {
val uninstantiated = new ListBuffer[Symbol]
val targs = methTypeArgs(undetparams, formals, restpe, argtpes, pt, uninstantiated)
val result = (
- exprTypeArgs(uninstantiated.toList, restpe.subst(undetparams, targs), pt) != null &&
+ (exprTypeArgs(uninstantiated.toList, restpe.subst(undetparams, targs), pt) ne null) &&
isWithinBounds(undetparams, targs)
)
result
@@ -602,7 +602,7 @@ trait Infer requires Analyzer {
def inferArgumentInstance(tree: Tree, undetparams: List[Symbol],
strictPt: Type, lenientPt: Type): unit = {
var targs = exprTypeArgs(undetparams, tree.tpe, strictPt)
- if (targs == null) targs = exprTypeArgs(undetparams, tree.tpe, lenientPt)
+ if (targs eq null) targs = exprTypeArgs(undetparams, tree.tpe, lenientPt)
substExpr(tree, undetparams, targs, lenientPt)
}
@@ -626,7 +626,7 @@ trait Infer requires Analyzer {
*/
private def substExpr(tree: Tree, undetparams: List[Symbol],
targs: List[Type], pt: Type): unit =
- if (targs == null) {
+ if (targs eq null) {
if (!tree.tpe.isErroneous && !pt.isErroneous)
error(tree.pos, "polymorphic expression cannot be instantiated to expected type" +
foundReqMsg(PolyType(undetparams, skipImplicit(tree.tpe)), pt))
@@ -793,7 +793,7 @@ trait Infer requires Analyzer {
sym.isAbstractType &&
(sym.name == nme.WILDCARD.toTypeName || {
val e = context.scope.lookupEntry(sym.name)
- e != null && e.sym == sym && e.owner == context.scope
+ (e ne null) && e.sym == sym && e.owner == context.scope
})
tp match {
case SingleType(pre, _) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index b01227da01..c527bb981b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -83,7 +83,7 @@ trait Namers requires Analyzer {
def namerOf(sym: Symbol): Namer = {
def innerNamer: Namer = {
- if (innerNamerCache == null)
+ if (innerNamerCache eq null)
innerNamerCache =
if (!isTemplateContext(context)) this
else new Namer(context.make(context.tree, context.owner, newScope))
@@ -114,7 +114,7 @@ trait Namers requires Analyzer {
// allow for overloaded methods
if (!(sym.isSourceMethod && sym.owner.isClass && !sym.owner.isPackageClass)) {
val prev = context.scope.lookupEntry(sym.name);
- if (prev != null && prev.owner == context.scope &&
+ if ((prev ne null) && prev.owner == context.scope &&
(!prev.sym.isSourceMethod ||
nme.isSetterName(sym.name) ||
sym.owner.isPackageClass)) {
@@ -154,11 +154,11 @@ trait Namers requires Analyzer {
if (c.owner.isPackageClass) {
val file = context.unit.source.getFile()
val clazz = c.asInstanceOf[ClassSymbol]
- if (settings.debug.value && clazz.sourceFile != null && !clazz.sourceFile.equals(file)) {
+ if (settings.debug.value && (clazz.sourceFile ne null) && !clazz.sourceFile.equals(file)) {
Console.err.println("SOURCE MISMATCH: " + clazz.sourceFile + " vs. " + file + " SYM=" + c);
}
clazz.sourceFile = file
- if (clazz.sourceFile != null) {
+ if (clazz.sourceFile ne null) {
assert(!currentRun.compiles(clazz) || clazz.sourceFile == currentRun.symSource(c));
currentRun.symSource(c) = clazz.sourceFile
}
@@ -596,14 +596,14 @@ trait Namers requires Analyzer {
typer.checkStable(expr1)
def checkNotRedundant(pos: PositionType, from: Name, to: Name): boolean = {
if (!tree.symbol.hasFlag(SYNTHETIC) &&
- !(expr1.symbol != null && expr1.symbol.isInterpreterWrapper) &&
+ !((expr1.symbol ne null) && expr1.symbol.isInterpreterWrapper) &&
base.member(from) != NoSymbol) {
val e = context.scope.lookupEntry(to)
def warnRedundant(sym: Symbol) =
context.unit.warning(pos, "imported `"+to+
"' is permanently hidden by definition of "+sym+
sym.locationString)
- if (e != null && e.owner == context.scope) {
+ if ((e ne null) && e.owner == context.scope) {
warnRedundant(e.sym); return false
} else if (context eq context.enclClass) {
val defSym = context.prefix.member(to) filter (
@@ -623,7 +623,7 @@ trait Namers requires Analyzer {
}
if (from != nme.WILDCARD && (rest.exists (sel => sel._1 == from)))
context.error(tree.pos, from.decode + " is renamed twice");
- if (to != null && to != nme.WILDCARD && (rest exists (sel => sel._2 == to)))
+ if ((to ne null) && to != nme.WILDCARD && (rest exists (sel => sel._2 == to)))
context.error(tree.pos, to.decode + " appears twice as a target of a renaming");
checkSelectors(rest)
case Nil =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 728cca7453..e2c04090da 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -278,7 +278,7 @@ abstract class RefChecks extends InfoTransform {
if (baseClass.isClass) {
val index = clazz.info.closurePos(baseClass)
if (index >= 0) {
- if (seenTypes(index) != null && !(seenTypes(index) <:< tp))
+ if ((seenTypes(index) ne null) && !(seenTypes(index) <:< tp))
unit.error(clazz.pos, "illegal inheritance;\n " + clazz +
" inherits different type instances of " + baseClass +
":\n" + tp + " and " + seenTypes(index));
@@ -382,7 +382,7 @@ abstract class RefChecks extends InfoTransform {
// Forward reference checking ---------------------------------------------------
class LevelInfo(val outer: LevelInfo) {
- val scope: Scope = if (outer == null) newScope else newScope(outer.scope)
+ val scope: Scope = if (outer eq null) newScope else newScope(outer.scope)
var maxindex: int = MIN_INT
var refpos: int = _
var refsym: Symbol = _
@@ -416,7 +416,7 @@ abstract class RefChecks extends InfoTransform {
private def enterReference(pos: int, sym: Symbol): unit =
if (sym.isLocal) {
val e = currentLevel.scope.lookupEntry(sym.name)
- if (e != null && sym == e.sym) {
+ if ((e ne null) && sym == e.sym) {
var l = currentLevel
while (l.scope != e.owner) l = l.outer;
val symindex = symIndex(sym)
diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
index dd24c7b32e..d2d0d64805 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala
@@ -95,7 +95,7 @@ abstract class TreeCheckers extends Analyzer {
}
if (tree.pos == NoPos && tree != EmptyTree) {
error(tree.pos, "tree without position: " + tree)
- } else if (tree.tpe == null && phase.id >= currentRun.typerPhase.id) {
+ } else if ((tree.tpe eq null) && phase.id >= currentRun.typerPhase.id) {
error(tree.pos, "tree without type: " + tree)
} else if (tree.isDef && tree.symbol.owner != currentOwner) {
var owner = currentOwner
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 35a728dbbb..1b1b1823a3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -176,7 +176,7 @@ trait Typers requires Analyzer {
private var namerCache: Namer = null
def namer = {
- if (namerCache == null || namerCache.context != context)
+ if ((namerCache eq null) || namerCache.context != context)
namerCache = new Namer(context)
namerCache
}
@@ -196,9 +196,9 @@ trait Typers requires Analyzer {
case CyclicReference(sym, info: TypeCompleter) =>
val msg =
info.tree match {
- case ValDef(_, _, tpt, _) if (tpt.tpe == null) =>
+ case ValDef(_, _, tpt, _) if (tpt.tpe eq null) =>
"recursive "+sym+" needs type"
- case DefDef(_, _, _, _, tpt, _) if (tpt.tpe == null) =>
+ case DefDef(_, _, _, _, tpt, _) if (tpt.tpe eq null) =>
(if (sym.owner.isClass && sym.owner.info.member(sym.name).hasFlag(OVERLOADED)) "overloaded "
else "recursive ")+sym+" needs result type"
case _ =>
@@ -321,7 +321,7 @@ trait Typers requires Analyzer {
this.owner = owner
this.scope = scope
badSymbol = NoSymbol
- assert(tree.tpe != null, tree)//debug
+ assert(tree.tpe ne null, tree)//debug
apply(tree.tpe)
if (badSymbol == NoSymbol) tree
else if (badSymbol.isErroneous) setError(tree)
@@ -368,7 +368,7 @@ trait Typers requires Analyzer {
if (o == sym.owner) badSymbol = sym
} else if (sym.owner.isTerm && !sym.isTypeParameterOrSkolem) {
var e = scope.lookupEntry(sym.name)
- while (e != null && e.owner == scope && badSymbol == NoSymbol) {
+ while ((e ne null) && e.owner == scope && badSymbol == NoSymbol) {
if (e.sym == sym) badSymbol = e.sym
e = scope.lookupNextEntry(e)
}
@@ -620,7 +620,7 @@ trait Typers requires Analyzer {
} else if (tree.tpe <:< pt) {
tree
} else if ((mode & PATTERNmode) != 0) {
- if (tree.symbol != null && tree.symbol.isModule) inferModulePattern(tree, pt)
+ if ((tree.symbol ne null) && tree.symbol.isModule) inferModulePattern(tree, pt)
tree
} else {
val tree1 = constfold(tree, pt) // (10) (11)
@@ -678,7 +678,7 @@ trait Typers requires Analyzer {
*/
def adaptToMember(qual: Tree, name: Name, tp: Type): Tree = {
val qtpe = qual.tpe.widen
- if (qual.isTerm && (qual.symbol == null || !qual.symbol.isTerm || qual.symbol.isValue) &&
+ if (qual.isTerm && ((qual.symbol eq null) || !qual.symbol.isTerm || qual.symbol.isValue) &&
phase.id <= currentRun.typerPhase.id && !qtpe.isError && !tp.isError &&
qtpe.symbol != AllRefClass && qtpe.symbol != AllClass && qtpe != WildcardType) {
val coercion = inferView(qual.pos, qtpe, name, tp, true)
@@ -708,7 +708,7 @@ trait Typers requires Analyzer {
var supertpt = typedTypeConstructor(templ.parents.head)
var mixins = templ.parents.tail map typedType
// If first parent is a trait, make it first mixin and add its superclass as first parent
- while (supertpt.tpe.symbol != null && supertpt.tpe.symbol.initialize.isTrait) {
+ while ((supertpt.tpe.symbol ne null) && supertpt.tpe.symbol.initialize.isTrait) {
val supertpt1 = typedType(supertpt)
if (!supertpt1.tpe.isError) {
mixins = supertpt1 :: mixins
@@ -952,7 +952,7 @@ trait Typers requires Analyzer {
Pair(call, List())
}
val Pair(superConstr, superArgs) = decompose(rhs)
- assert(superConstr.symbol != null)//debug
+ assert(superConstr.symbol ne null)//debug
if (superConstr.symbol.isPrimaryConstructor) {
val superClazz = superConstr.symbol.owner
if (!superClazz.hasFlag(JAVA)) {
@@ -1247,7 +1247,7 @@ trait Typers requires Analyzer {
stat match {
case imp @ Import(_, _) =>
val imp0 = typedImport(imp)
- if (imp0 != null) {
+ if (imp0 ne null) {
context = context.makeNewImport(imp0)
imp0.symbol.initialize
}
@@ -1261,10 +1261,10 @@ trait Typers requires Analyzer {
def checkNoDoubleDefs(stats: List[Tree]) = {
val scope = if (inBlock) context.scope else context.owner.info.decls;
var e = scope.elems;
- while (e != null && e.owner == scope) {
+ while ((e ne null) && e.owner == scope) {
if (!e.sym.hasFlag(LOCAL)) {
var e1 = scope.lookupNextEntry(e);
- while (e1 != null && e1.owner == scope) {
+ while ((e1 ne null) && e1.owner == scope) {
if (!e1.sym.hasFlag(LOCAL) &&
(e.sym.isType || inBlock || (e.sym.tpe matches e1.sym.tpe)))
if (!e.sym.isErroneous && !e1.sym.isErroneous)
@@ -1572,7 +1572,7 @@ trait Typers requires Analyzer {
val Select(qual, name) = fun
val args1 = tryTypedArgs(args)
val qual1 =
- if (args1 != null && !pt.isError) {
+ if ((args1 ne null) && !pt.isError) {
def templateArgType(arg: Tree) =
new BoundedWildcardType(TypeBounds(arg.tpe, AnyClass.tpe))
adaptToMember(qual, name, MethodType(args1 map templateArgType, pt))
@@ -1605,7 +1605,7 @@ trait Typers requires Analyzer {
context.reportGeneralErrors = reportGeneralErrors
def templateArgType(arg: Tree) =
new BoundedWildcardType(TypeBounds(arg.tpe, AnyClass.tpe))
- val qual1 = if (args1 == null || pt.isError) qual
+ val qual1 = if ((args1 eq null) || pt.isError) qual
else adaptToMember(qual, name, MethodType(args1 map templateArgType, pt))
val tree1 = Apply(Select(qual1, name) setPos fun.pos, args map (arg => UnTyper.apply(arg))) setPos tree.pos
typed1(tree1, mode | SNDTRYmode, pt)
@@ -1650,10 +1650,10 @@ trait Typers requires Analyzer {
if (!sym.exists) {
if (settings.debug.value) Console.err.println("qual = "+qual+":"+qual.tpe+"\nSymbol="+qual.tpe.symbol+"\nsymbol-info = "+qual.tpe.symbol.info+"\nscope-id = "+qual.tpe.symbol.info.decls.hashCode()+"\nmembers = "+qual.tpe.members+"\nname = "+name+"\nfound = "+sym+"\nowner = "+context.enclClass.owner)
if (!qual.tpe.widen.isErroneous) {
- if (false && context.unit == null) assert(false, "("+qual+":"+qual.tpe+")."+name)
+ if (false && (context.unit eq null)) assert(false, "("+qual+":"+qual.tpe+")."+name)
error(tree.pos,
decode(name)+" is not a member of "+qual.tpe.widen +
- (if (context.unit != null && Position.line(context.unit.source, qual.pos) <
+ (if ((context.unit ne null) && Position.line(context.unit.source, qual.pos) <
Position.line(context.unit.source, tree.pos))
"\npossible cause: maybe a semicolon is missing before `"+name+"'?"
else ""))
@@ -1680,7 +1680,7 @@ trait Typers requires Analyzer {
while (cx != NoContext) {
val pre = cx.enclClass.prefix
val defEntry = cx.scope.lookupEntry(name)
- if (defEntry != null && defEntry.sym.exists) return true
+ if ((defEntry ne null) && defEntry.sym.exists) return true
cx = cx.enclClass
if ((pre.member(name) filter (
sym => sym.exists && context.isAccessible(sym, pre, false))) != NoSymbol) return true
@@ -1716,7 +1716,7 @@ trait Typers requires Analyzer {
while (defSym == NoSymbol && cx != NoContext) {
pre = cx.enclClass.prefix
defEntry = cx.scope.lookupEntry(name)
- if (defEntry != null && defEntry.sym.exists) {
+ if ((defEntry ne null) && defEntry.sym.exists) {
defSym = defEntry.sym
} else {
cx = cx.enclClass
@@ -1726,7 +1726,7 @@ trait Typers requires Analyzer {
}
}
- val symDepth = if (defEntry == null) cx.depth
+ val symDepth = if (defEntry eq null) cx.depth
else cx.depth - (cx.scope.nestingLevel - defEntry.owner.nestingLevel)
var impSym: Symbol = NoSymbol; // the imported symbol
var imports = context.imports; // impSym != NoSymbol => it is imported from imports.head
@@ -1745,7 +1745,7 @@ trait Typers requires Analyzer {
if (defSym.exists && impSym.exists &&
defSym.owner.isPackageClass &&
(!currentRun.compiles(defSym) ||
- context.unit != null && defSym.sourceFile != context.unit.source.file))
+ (context.unit ne null) && defSym.sourceFile != context.unit.source.file))
defSym = NoSymbol
/*<unapply>*/
@@ -1825,7 +1825,7 @@ trait Typers requires Analyzer {
// begin typed1
val sym: Symbol = tree.symbol
- if (sym != null) sym.initialize
+ if (sym ne null) sym.initialize
//if (settings.debug.value && tree.isDef) log("typing definition of "+sym);//DEBUG
tree match {
case PackageDef(name, stats) =>
@@ -1862,7 +1862,7 @@ trait Typers requires Analyzer {
case DocDef(comment, defn) => {
val ret = typed(defn, mode, pt)
- if (comments != null) comments(defn . symbol) = comment;
+ if (comments ne null) comments(defn . symbol) = comment;
ret
}
case tree @ Block(_, _) =>
@@ -1938,7 +1938,7 @@ trait Typers requires Analyzer {
}
val lhs1 = typed(lhs, EXPRmode | LHSmode, WildcardType)
val varsym = lhs1.symbol
- if (varsym != null && mayBeVarGetter(varsym)) {
+ if ((varsym ne null) && mayBeVarGetter(varsym)) {
lhs1 match {
case Select(qual, name) =>
typed(
@@ -1946,7 +1946,7 @@ trait Typers requires Analyzer {
Select(qual, nme.getterToSetter(name)) setPos lhs.pos,
List(rhs)) setPos tree.pos, mode, pt)
}
- } else if (varsym != null && (varsym.isVariable || varsym.isValue && phase.erasedTypes)) {
+ } else if ((varsym ne null) && (varsym.isVariable || varsym.isValue && phase.erasedTypes)) {
val rhs1 = typed(rhs, lhs1.tpe)
copy.Assign(tree, lhs1, rhs1) setType UnitClass.tpe
} else {
@@ -1976,7 +1976,7 @@ trait Typers requires Analyzer {
errorTree(tree, "return outside method definition")
} else {
val DefDef(_, _, _, _, restpt, _) = enclMethod.tree
- if (restpt.tpe == null) {
+ if (restpt.tpe eq null) {
errorTree(tree, "method " + enclMethod.owner +
" has return statement; needs result type")
} else {
@@ -2049,7 +2049,7 @@ trait Typers requires Analyzer {
typed1(atPos(tree.pos)(Block(stats, Apply(expr, args))), mode, pt)
case Apply(fun, args) =>
- val stableApplication = fun.symbol != null && fun.symbol.isMethod && fun.symbol.isStable
+ val stableApplication = (fun.symbol ne null) && fun.symbol.isMethod && fun.symbol.isStable
if (stableApplication && (mode & PATTERNmode) != 0) {
// treat stable function applications f() as expressions.
typed1(tree, mode & ~PATTERNmode | EXPRmode, pt)
@@ -2063,7 +2063,7 @@ trait Typers requires Analyzer {
if (phase.id <= currentRun.typerPhase.id &&
fun1.isInstanceOf[Select] &&
!fun1.tpe.isInstanceOf[ImplicitMethodType] &&
- (fun1.symbol == null || !fun1.symbol.isConstructor) &&
+ ((fun1.symbol eq null) || !fun1.symbol.isConstructor) &&
(mode & (EXPRmode | SNDTRYmode)) == EXPRmode) tryTypedApply(fun1, args)
else {
typedApply(tree, fun1, args, mode, pt)
@@ -2203,14 +2203,14 @@ trait Typers requires Analyzer {
def typed(tree: Tree, mode: int, pt: Type): Tree =
try {
if (settings.debug.value)
- assert(pt != null, tree)//debug
+ assert(pt ne null, tree)//debug
if (context.retyping &&
- tree.tpe != null && (tree.tpe.isErroneous || !(tree.tpe <:< pt))) {
+ (tree.tpe ne null) && (tree.tpe.isErroneous || !(tree.tpe <:< pt))) {
tree.tpe = null
if (tree.hasSymbol) tree.symbol = NoSymbol
}
//Console.println("typing "+tree+", "+context.undetparams);//DEBUG
- val tree1 = if (tree.tpe != null) tree else typed1(tree, mode, pt)
+ val tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, pt)
//Console.println("typed "+tree1+":"+tree1.tpe+", "+context.undetparams);//DEBUG
val result = if (tree1.isEmpty) tree1 else adapt(tree1, mode, pt)
//Console.println("adapted "+tree1+":"+tree1.tpe+" to "+pt+", "+context.undetparams);//DEBUG
@@ -2224,8 +2224,8 @@ trait Typers requires Analyzer {
case ex: Throwable =>
if (settings.debug.value)
Console.println("exception when typing "+tree+", pt = "+pt)
- if (context != null && context.unit != null &&
- context.unit.source != null && tree != null)
+ if ((context ne null) && (context.unit ne null) &&
+ (context.unit.source ne null) && (tree ne null))
logError("AT: " + context.unit.source.dbg(tree.pos), ex);
throw(ex)
}
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index a2ec9d945b..e01c577a65 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -43,13 +43,13 @@ class ClassPath(onlyPresentation: Boolean) {
}
class Output(location0: AbstractFile, val sourceFile: AbstractFile) extends Entry(location0) {
- def source = if (sourceFile != null) new Source(sourceFile, true) else null
+ def source = if (sourceFile ne null) new Source(sourceFile, true) else null
}
class Library(location0: AbstractFile) extends Entry(location0) {
def doc: AbstractFile = null
def sourceFile: AbstractFile = null
- def source = if (sourceFile == null) null else new Source(sourceFile, false)
+ def source = if (sourceFile eq null) null else new Source(sourceFile, false)
}
class Context(val entries: List[Entry]) {
@@ -60,24 +60,24 @@ class ClassPath(onlyPresentation: Boolean) {
val ret = find0(entries.tail)
val head = entries.head
val name0 = name + (if (!isDir) ".class" else "")
- val clazz = if (head.location == null) null
+ val clazz = if (head.location eq null) null
else head.location.lookupPath(name0, isDir)
val source0 =
- if (head.source == null) null
- else if (clazz == null || isDir) {
+ if (head.source eq null) null
+ else if ((clazz eq null) || isDir) {
val source1 = head.source.location.lookupPath(
name + (if (isDir) "" else ".scala"), isDir)
- if (source1 == null && !isDir && clazz != null) head.source.location
+ if ((source1 eq null) && !isDir && (clazz ne null)) head.source.location
else source1
}
else head.source.location
- if (clazz == null && source0 == null) ret
+ if ((clazz eq null) && (source0 eq null)) ret
else {
val entry = new Entry(clazz) {
override def source =
- if (source0 == null) null
+ if (source0 eq null) null
else new Source(source0, head.source.compile)
}
try {
@@ -100,14 +100,14 @@ class ClassPath(onlyPresentation: Boolean) {
def isPackage: Boolean =
if (entries.isEmpty) false
- else if (entries.head.location != null) entries.head.location.isDirectory
+ else if (entries.head.location ne null) entries.head.location.isDirectory
else entries.head.source.location.isDirectory
def name =
if (entries.isEmpty) "<none>"
else {
val head = entries.head
- val name = if (head.location != null) head.location.name
+ val name = if (head.location ne null) head.location.name
else head.source.location.name
if (isPackage) name
else name.substring(0, name.length() - (".class").length())
@@ -116,9 +116,9 @@ class ClassPath(onlyPresentation: Boolean) {
override def toString(): String = toString(entries)
def toString(entry: Entry): String =
- ((if (entry.location == null) "<none>"
+ ((if (entry.location eq null) "<none>"
else entry.location.toString()) +
- (if (entry.source == null) ""
+ (if (entry.source eq null) ""
else " with_source=" + entry.source.location.toString()))
def toString(entries0: List[Entry]): String =
@@ -128,27 +128,27 @@ class ClassPath(onlyPresentation: Boolean) {
def isSourceFile = {
def head = entries.head
def clazz = head.location
- def source = if (head.source == null) null else head.source.location
+ def source = if (head.source eq null) null else head.source.location
def isPredef = source.name.equals("Predef.scala") ||
source.path.startsWith("scala/runtime")
- if (entries.isEmpty || entries.isEmpty || source == null) false
+ if (entries.isEmpty || entries.isEmpty || (source eq null)) false
else if (!onlyPresentation && !head.source.compile) false
else if (source.isDirectory) false
- else if (clazz == null) true
+ else if (clazz eq null) true
else if (onlyPresentation && !isPredef) true
else if (source.lastModified > clazz.lastModified) true
else false
}
- def sourceFile = if (entries.head.source != null && !entries.head.source.location.isDirectory)
+ def sourceFile = if ((entries.head.source ne null) && !entries.head.source.location.isDirectory)
entries.head.source.location else null
def classFile = if (!isSourceFile) entries.head.location else null
{
val sourcePath0 = sourcePath
- if (sourcePath0 != null) {
+ if (sourcePath0 ne null) {
if (!sourcePath0.isDirectory) {
Console.err.println(""+sourcePath0 + " cannot be a directory")
assert(false)
@@ -157,7 +157,7 @@ class ClassPath(onlyPresentation: Boolean) {
}
def sourcePath =
- if (!isSourceFile && !entries.isEmpty && entries.head.source != null) {
+ if (!isSourceFile && !entries.isEmpty && (entries.head.source ne null)) {
val ret = entries.head.source.location
ret
}
@@ -183,7 +183,7 @@ class ClassPath(onlyPresentation: Boolean) {
addFilesInPath(boot)
addArchivesInExtDirPath(extdirs)
val clazzes = AbstractFile.getDirectory(output)
- if (clazzes == null) {
+ if (clazzes eq null) {
Console.err.println("Output location \"" + output + "\" not found")
exit(1)
}
@@ -207,9 +207,9 @@ class ClassPath(onlyPresentation: Boolean) {
*/
def lookupPath(path: String, isDir: Boolean) = {
val ctx = root.find(path, isDir)
- if (ctx == null) null
+ if (ctx eq null) null
else if (ctx.entries.isEmpty) null
- else if (ctx.entries.head == null) null
+ else if (ctx.entries.head eq null) null
else ctx.entries.head.location
}
@@ -218,10 +218,10 @@ class ClassPath(onlyPresentation: Boolean) {
* @param sources ...
*/
def library(classes: String, sources: String) = {
- assert(classes != null)
+ assert(classes ne null)
val location = AbstractFile.getDirectory(classes)
val sourceFile0 =
- if (sources != null) AbstractFile.getDirectory(sources)
+ if (sources ne null) AbstractFile.getDirectory(sources)
else null
class Library0 extends Library(location) {
override def sourceFile = sourceFile0
@@ -233,7 +233,7 @@ class ClassPath(onlyPresentation: Boolean) {
val strtok = new StringTokenizer(path, File.pathSeparator)
while (strtok.hasMoreTokens()) {
val file = AbstractFile.getDirectory(strtok.nextToken())
- if (file != null) entries += (new Library(file))
+ if (file ne null) entries += (new Library(file))
}
}
@@ -241,12 +241,12 @@ class ClassPath(onlyPresentation: Boolean) {
val strtok = new StringTokenizer(path, File.pathSeparator)
while (strtok.hasMoreTokens()) {
val file = AbstractFile.getDirectory(strtok.nextToken())
- if (file != null) {
+ if (file ne null) {
for (val file0 <- file) {
val name = file0.name
if (name.endsWith(".jar") || name.endsWith(".zip") || file0.isDirectory) {
val archive = AbstractFile.getDirectory(new File(file.file, name))
- if (archive != null) entries += (new Library(archive))
+ if (archive ne null) entries += (new Library(archive))
}
}
}
diff --git a/src/compiler/scala/tools/nsc/util/HashSet.scala b/src/compiler/scala/tools/nsc/util/HashSet.scala
index 2b2b8bdc53..fea6e8886e 100644
--- a/src/compiler/scala/tools/nsc/util/HashSet.scala
+++ b/src/compiler/scala/tools/nsc/util/HashSet.scala
@@ -19,7 +19,7 @@ class HashSet[T >: Null <: AnyRef](initialCapacity: int) extends Set[T] {
def findEntry(x: T): T = {
var h = x.hashCode() % capacity
var entry = table(h)
- while (entry != null && entry != x) {
+ while ((entry ne null) && entry != x) {
h = (h + 1) % capacity
entry = table(h)
}
@@ -29,7 +29,7 @@ class HashSet[T >: Null <: AnyRef](initialCapacity: int) extends Set[T] {
def addEntry(x: T): unit = {
var h = x.hashCode() % capacity
var entry = table(h)
- while (entry != null) {
+ while (entry ne null) {
if (entry == x) return
h = (h + 1) % capacity
entry = table(h)
@@ -42,7 +42,7 @@ class HashSet[T >: Null <: AnyRef](initialCapacity: int) extends Set[T] {
def elements = new Iterator[T] {
private var i = 0
def hasNext: boolean = {
- while (i < capacity && table(i) == null) i = i + 1;
+ while (i < capacity && (table(i) eq null)) i = i + 1;
i < capacity
}
def next: T =
@@ -57,7 +57,7 @@ class HashSet[T >: Null <: AnyRef](initialCapacity: int) extends Set[T] {
var i = 0
while (i < oldtable.length) {
val entry = oldtable(i)
- if (entry != null) addEntry(entry.asInstanceOf[T])
+ if (entry ne null) addEntry(entry.asInstanceOf[T])
i = i + 1
}
}
diff --git a/src/compiler/scala/tools/nsc/util/NameTransformer.scala b/src/compiler/scala/tools/nsc/util/NameTransformer.scala
index 54c444f118..23ed83eb54 100644
--- a/src/compiler/scala/tools/nsc/util/NameTransformer.scala
+++ b/src/compiler/scala/tools/nsc/util/NameTransformer.scala
@@ -53,18 +53,18 @@ object NameTransformer {
var i = 0
while (i < len) {
val c = name charAt i
- if (c < nops && op2code(c) != null) {
- if (buf == null) {
+ if (c < nops && (op2code(c) ne null)) {
+ if (buf eq null) {
buf = new StringBuilder()
buf.append(name.substring(0, i))
}
buf.append(op2code(c))
- } else if (buf != null) {
+ } else if (buf ne null) {
buf.append(c)
}
i = i + 1
}
- if (buf == null) name else buf.toString()
+ if (buf eq null) name else buf.toString()
}
/** Replace <code>$op_name</code> by corresponding operator symbol.
@@ -88,9 +88,9 @@ object NameTransformer {
val ch2 = name.charAt(i+2)
if ('a' <= ch2 && ch2 <= 'z') {
ops = code2op((ch1 - 'a') * 26 + ch2 - 'a')
- while (ops != null && !name.startsWith(ops.code, i)) ops = ops.next;
- if (ops != null) {
- if (buf == null) {
+ while ((ops ne null) && !name.startsWith(ops.code, i)) ops = ops.next;
+ if (ops ne null) {
+ if (buf eq null) {
buf = new StringBuilder()
buf.append(name.substring(0, i))
}
@@ -100,12 +100,12 @@ object NameTransformer {
}
}
}
- if (ops == null) {
- if (buf != null) buf.append(c)
+ if (ops eq null) {
+ if (buf ne null) buf.append(c)
i = i + 1
}
}
//System.out.println("= " + (if (buf == null) name else buf.toString()));//DEBUG
- if (buf == null) name else buf.toString()
+ if (buf eq null) name else buf.toString()
}
}
diff --git a/src/compiler/scala/tools/nsc/util/Position.scala b/src/compiler/scala/tools/nsc/util/Position.scala
index a7bd8f211e..70988b771c 100644
--- a/src/compiler/scala/tools/nsc/util/Position.scala
+++ b/src/compiler/scala/tools/nsc/util/Position.scala
@@ -80,7 +80,7 @@ class Position( val source : SourceFile, val offset: Int) {
def inUltimateSource = source.positionInUltimateSource(this)
def dbgString = {
- "source: " + (if (source == null) source else source . path) + " " +
+ "source: " + (if (source eq null) source else source . path) + " " +
(if (isLine) "line-" + line
else if (!hasOffset) "NOP"
else if (offset >= source.content.length) "out-of-bounds-" + offset else {
@@ -102,7 +102,7 @@ class Position( val source : SourceFile, val offset: Int) {
return inUltimateSource.toString
val sb = new StringBuilder()
- if (source != null) {
+ if (source ne null) {
sb.append(source.file.path)
if (hasOffset) {
sb.append(line)
diff --git a/src/compiler/scala/tools/nsc/util/Set.scala b/src/compiler/scala/tools/nsc/util/Set.scala
index 26305972d3..9101841e3f 100644
--- a/src/compiler/scala/tools/nsc/util/Set.scala
+++ b/src/compiler/scala/tools/nsc/util/Set.scala
@@ -17,7 +17,7 @@ abstract class Set[T <: AnyRef] {
def elements: Iterator[T]
def contains(x: T): boolean =
- findEntry(x) != null
+ findEntry(x) ne null
def toList = elements.toList
diff --git a/src/compiler/scala/tools/nsc/util/TreeSet.scala b/src/compiler/scala/tools/nsc/util/TreeSet.scala
index 5939d914c1..e4dc8f4fd6 100644
--- a/src/compiler/scala/tools/nsc/util/TreeSet.scala
+++ b/src/compiler/scala/tools/nsc/util/TreeSet.scala
@@ -22,7 +22,7 @@ class TreeSet[T >: Null <: AnyRef](less: (T, T) => boolean) extends Set[T] {
def findEntry(x: T): T = {
def find(t: Tree): T = {
- if (t == null) null
+ if (t eq null) null
else if (less(x, t.elem)) find(t.l)
else if (less(t.elem, x)) find(t.r)
else t.elem
@@ -32,7 +32,7 @@ class TreeSet[T >: Null <: AnyRef](less: (T, T) => boolean) extends Set[T] {
def addEntry(x: T): unit = {
def add(t: Tree): Tree = {
- if (t == null) new Tree(x)
+ if (t eq null) new Tree(x)
else if (less(x, t.elem)) { t.l = add(t.l); t }
else if (less(t.elem, x)) { t.r = add(t.r); t }
else t
@@ -43,14 +43,14 @@ class TreeSet[T >: Null <: AnyRef](less: (T, T) => boolean) extends Set[T] {
def elements = {
def elems(t: Tree): Iterator[T] = {
var it = Iterator.single(t.elem)
- if (t.l != null) it = elems(t.l) append it
- if (t.r != null) it = it append elems(t.r)
+ if (t.l ne null) it = elems(t.l) append it
+ if (t.r ne null) it = it append elems(t.r)
it
}
- if (tree == null) Iterator.empty else elems(tree)
+ if (tree eq null) Iterator.empty else elems(tree)
}
override def toString(): String = {
- if (tree == null) "<empty>" else "(..." + tree.elem + "...)"
+ if (tree eq null) "<empty>" else "(..." + tree.elem + "...)"
}
}
diff --git a/src/library/scala/Application.scala b/src/library/scala/Application.scala
index 9b268abeae..672969e91c 100644
--- a/src/library/scala/Application.scala
+++ b/src/library/scala/Application.scala
@@ -50,7 +50,7 @@ trait Application {
* @param args the arguments passed to the main method
*/
def main(args: Array[String]) = {
- if (getProperty("scala.time") != null) {
+ if (getProperty("scala.time") ne null) {
val total = currentTime - executionStart
Console.println("[total " + total + "ms]")
}
diff --git a/src/library/scala/BigInt.scala b/src/library/scala/BigInt.scala
index 8efad433b1..9be8a45dbd 100644
--- a/src/library/scala/BigInt.scala
+++ b/src/library/scala/BigInt.scala
@@ -32,7 +32,7 @@ object BigInt {
def apply(i: Int): BigInt =
if (minCached <= i && i <= maxCached) {
var n = cache(i)
- if (n == null) { n = new BigInt(BigInteger.valueOf(i)); cache(i) = n }
+ if (n eq null) { n = new BigInt(BigInteger.valueOf(i)); cache(i) = n }
n
} else new BigInt(BigInteger.valueOf(i))
diff --git a/src/library/scala/Console.scala b/src/library/scala/Console.scala
index 8fa4285ab6..7cc8e9d4e9 100644
--- a/src/library/scala/Console.scala
+++ b/src/library/scala/Console.scala
@@ -142,7 +142,7 @@ object Console {
* @param obj the object to print.
*/
def print(obj: Any): Unit =
- out.print(if (obj == null) "null" else obj.toString())
+ out.print(if (null == obj) "null" else obj.toString())
/** Flush the output stream. This function is required when partial
* output (i.e. output not terminated by a new line character) has
@@ -173,7 +173,7 @@ object Console {
// todo: Uncurry
def printf(text: String)(args: Any*): Unit =
out.print(
- if (text == null) "null"
+ if (text eq null) "null"
else MessageFormat.format(text, textParams(args))
)
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index b92ad6ca4e..cff1c41238 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -66,7 +66,7 @@ abstract class Enumeration(initial: Int, names: String*) {
private var vcache: List[Value] = null
private def updateCache: List[Value] =
- if (vcache == null) {
+ if (vcache eq null) {
vcache = values.values.toList.sort((p1, p2) => p1.id < p2.id);
vcache
} else
@@ -132,7 +132,7 @@ abstract class Enumeration(initial: Int, names: String*) {
topId = nextId
def id = i
override def toString() =
- if (name == null) Enumeration.this.name + "(" + i + ")"
+ if (name eq null) Enumeration.this.name + "(" + i + ")"
else name
}
}
diff --git a/src/library/scala/MatchError.scala b/src/library/scala/MatchError.scala
index 6ef969b97c..57ada9efbd 100644
--- a/src/library/scala/MatchError.scala
+++ b/src/library/scala/MatchError.scala
@@ -24,7 +24,7 @@ import Predef._
object MatchError {
def string(obj: Any) =
- if(obj != null) obj.toString() else "null"
+ if (null != obj) obj.toString() else "null"
// todo: change pattern matcher so that dummy type parameter T can be removed.
def fail[T](source: String, line: Int): Nothing =
diff --git a/src/library/scala/collection/mutable/DoubleLinkedList.scala b/src/library/scala/collection/mutable/DoubleLinkedList.scala
index f2916d39e9..5ed7a5dbb8 100644
--- a/src/library/scala/collection/mutable/DoubleLinkedList.scala
+++ b/src/library/scala/collection/mutable/DoubleLinkedList.scala
@@ -28,24 +28,24 @@ abstract class DoubleLinkedList[A, This >: Null <: DoubleLinkedList[A, This]]
var prev: This
override def append(that: This): Unit =
- if (that == null)
+ if (that eq null)
()
- else if (next == null) {
+ else if (next eq null) {
next = that
that.prev = this
} else
next.append(that)
- override def insert(that: This): Unit = if (that != null) {
+ override def insert(that: This): Unit = if (that ne null) {
that.append(next)
next = that
that.prev = this
}
def remove: Unit = {
- if (next != null)
+ if (next ne null)
next.prev = prev
- if (prev != null)
+ if (prev ne null)
prev.next = next
prev = null
next = null
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala
index 5ec6e6eb7c..1c248835e9 100644
--- a/src/library/scala/collection/mutable/ListBuffer.scala
+++ b/src/library/scala/collection/mutable/ListBuffer.scala
@@ -248,7 +248,7 @@ final class ListBuffer[A] extends Buffer[A] {
if (!hasNext) {
throw new NoSuchElementException("next on empty Iterator")
} else {
- if (cursor == null) cursor = start else cursor = cursor.tail
+ if (cursor eq null) cursor = start else cursor = cursor.tail
cursor.head
}
}
diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala
index 6e57074641..8983949aaa 100644
--- a/src/library/scala/collection/mutable/MutableList.scala
+++ b/src/library/scala/collection/mutable/MutableList.scala
@@ -69,12 +69,12 @@ trait MutableList[A] extends Seq[A] with PartialFunction[Int, A] {
/** Returns an iterator over all elements of this list.
*/
def elements: Iterator[A] =
- if (first == null) Nil.elements else first.elements
+ if (first eq null) Nil.elements else first.elements
/** Returns an instance of <code>scala.List</code> containing the same
* sequence of elements.
*/
- override def toList: List[A] = if (first == null) Nil else first.toList
+ override def toList: List[A] = if (first eq null) Nil else first.toList
override protected def stringPrefix: String = "MutableList"
}
diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala
index 7d31b2b66e..271c8d680d 100644
--- a/src/library/scala/collection/mutable/Queue.scala
+++ b/src/library/scala/collection/mutable/Queue.scala
@@ -27,7 +27,7 @@ class Queue[A] extends MutableList[A] {
*
* @return true, iff there is no element in the queue.
*/
- override def isEmpty: Boolean = (first == null)
+ override def isEmpty: Boolean = (first eq null)
/** Inserts a single element at the end of the queue.
*
@@ -64,12 +64,12 @@ class Queue[A] extends MutableList[A] {
* @return the first element of the queue.
*/
def dequeue: A =
- if (first == null)
+ if (first eq null)
throw new NoSuchElementException("queue empty")
else {
val res = first.elem
first = first.next
- if (first == null) last = null
+ if (first eq null) last = null
len = len - 1
res
}
@@ -81,15 +81,15 @@ class Queue[A] extends MutableList[A] {
* @return the first element of the queue for which p yields true
*/
def dequeueFirst(p: A => Boolean): Option[A] =
- if (first == null)
+ if (first eq null)
None
else if (p(first.elem)) {
val res: Option[A] = Some(first.elem)
first = first.next
len = len - 1
- if (first == null) {
+ if (first eq null) {
last = null
- } else if (first.next == null) {
+ } else if (first.next eq null) {
last = first
}
res
@@ -108,16 +108,16 @@ class Queue[A] extends MutableList[A] {
*/
def dequeueAll(p: A => Boolean): Seq[A] = {
val res = new ArrayBuffer[A]
- if (first == null)
+ if (first eq null)
res
else {
while (p(first.elem)) {
res += first.elem
first = first.next
len = len - 1
- if (first == null) {
+ if (first eq null) {
last = null
- } else if (first.next == null) {
+ } else if (first.next eq null) {
last = first
}
}
@@ -132,15 +132,15 @@ class Queue[A] extends MutableList[A] {
private def extractFirst(start: LinkedList[A], p: A => Boolean): Option[LinkedList[A]] = {
var cell = start
- while ((cell.next != null) && !p(cell.next.elem)) {
+ while ((cell.next ne null) && !p(cell.next.elem)) {
cell = cell.next
}
- if (cell.next == null)
+ if (cell.next eq null)
None
else {
val res: Option[LinkedList[A]] = Some(cell.next)
cell.next = cell.next.next
- if (cell.next == null)
+ if (cell.next eq null)
last = cell
len = len - 1
res
diff --git a/src/library/scala/collection/mutable/SingleLinkedList.scala b/src/library/scala/collection/mutable/SingleLinkedList.scala
index 6a889fc49e..2fc51ad9a2 100644
--- a/src/library/scala/collection/mutable/SingleLinkedList.scala
+++ b/src/library/scala/collection/mutable/SingleLinkedList.scala
@@ -28,29 +28,29 @@ abstract class SingleLinkedList[A, This >: Null <: SingleLinkedList[A, This]]
var next: This
- def length: Int = 1 + (if (next == null) 0 else next.length)
+ def length: Int = 1 + (if (next eq null) 0 else next.length)
def append(that: This): Unit =
- if (next == null) next = that else next.append(that)
+ if (next eq null) next = that else next.append(that)
- def insert(that: This): Unit = if (that != null) {
+ def insert(that: This): Unit = if (that ne null) {
that.append(next)
next = that
}
def apply(n: Int): A =
if (n == 0) elem
- else if (next == null) throw new IndexOutOfBoundsException("unknown element")
+ else if (next eq null) throw new IndexOutOfBoundsException("unknown element")
else next.apply(n - 1)
def get(n: Int): Option[A] =
if (n == 0) Some(elem)
- else if (next == null) None
+ else if (next eq null) None
else next.get(n - 1)
def elements: Iterator[A] = new Iterator[A] {
var elems = SingleLinkedList.this
- def hasNext = (elems != null)
+ def hasNext = (elems ne null)
def next = {
val res = elems.elem
elems = elems.next
diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala
index 825e87c629..e3aa316c21 100644
--- a/src/library/scala/collection/mutable/Stack.scala
+++ b/src/library/scala/collection/mutable/Stack.scala
@@ -25,7 +25,7 @@ class Stack[A] extends MutableList[A] {
*
* @return true, iff there is no element on the stack
*/
- override def isEmpty: Boolean = (first == null)
+ override def isEmpty: Boolean = (first eq null)
/** Pushes a single element on top of the stack.
*
@@ -63,7 +63,7 @@ class Stack[A] extends MutableList[A] {
* @throws Predef.NoSuchElementException
* @return the top element
*/
- def top: A = if (first == null) throw new NoSuchElementException("stack empty") else first.elem
+ def top: A = if (first eq null) throw new NoSuchElementException("stack empty") else first.elem
/** Removes the top element from the stack.
*
@@ -71,7 +71,7 @@ class Stack[A] extends MutableList[A] {
* @return the top element
*/
def pop: A =
- if (first != null) {
+ if (first ne null) {
val res = first.elem
first = first.next
len = len - 1;
diff --git a/src/library/scala/concurrent/Actor.scala b/src/library/scala/concurrent/Actor.scala
index 8f2534bb95..15b77bf3fd 100644
--- a/src/library/scala/concurrent/Actor.scala
+++ b/src/library/scala/concurrent/Actor.scala
@@ -37,7 +37,7 @@ abstract class Actor extends Thread {
private var pid: Pid = null
def self = {
- if (pid == null) pid = new Pid(this)
+ if (pid eq null) pid = new Pid(this)
pid
}
diff --git a/src/library/scala/concurrent/Channel.scala b/src/library/scala/concurrent/Channel.scala
index f7a156271f..bab6345ab9 100644
--- a/src/library/scala/concurrent/Channel.scala
+++ b/src/library/scala/concurrent/Channel.scala
@@ -36,7 +36,7 @@ class Channel[a] {
}
def read: a = synchronized {
- if (written.next == null) {
+ if (null == written.next) {
nreaders = nreaders + 1; wait(); nreaders = nreaders - 1
}
val x = written.elem
diff --git a/src/library/scala/concurrent/MailBox.scala b/src/library/scala/concurrent/MailBox.scala
index 7a8b4eac20..e1399e9e58 100644
--- a/src/library/scala/concurrent/MailBox.scala
+++ b/src/library/scala/concurrent/MailBox.scala
@@ -31,13 +31,13 @@ class MailBox extends AnyRef with ListQueueCreator {
def isDefinedAt(msg: Message) = receiver.isDefinedAt(msg)
def receive(): a = synchronized {
- while (msg == null) wait()
+ while (msg eq null) wait()
receiver(msg)
}
def receiveWithin(msec: long): a = synchronized {
- if (msg == null) wait(msec)
- receiver(if (msg != null) msg else TIMEOUT)
+ if (msg eq null) wait(msec)
+ receiver(if (msg ne null) msg else TIMEOUT)
}
}
@@ -157,13 +157,13 @@ trait LinkedListQueueCreator {
def extractFirst(l: t, p: a => boolean): Option[Pair[a, t]] = {
var xs = l._1
var xs1 = xs.next
- while (xs1 != null && !p(xs1.elem)) {
+ while ((xs1 ne null) && !p(xs1.elem)) {
xs = xs1
xs1 = xs1.next
}
- if (xs1 != null) {
+ if (xs1 ne null) {
xs.next = xs1.next
- if (xs.next == null)
+ if (xs.next eq null)
Some(Pair(xs1.elem, Pair(l._1, xs)))
else
Some(Pair(xs1.elem, l))
diff --git a/src/library/scala/mobile/Code.scala b/src/library/scala/mobile/Code.scala
index e7166bfc1a..33ddc8f6fa 100644
--- a/src/library/scala/mobile/Code.scala
+++ b/src/library/scala/mobile/Code.scala
@@ -185,7 +185,7 @@ class Code(clazz: java.lang.Class) {
val method = clazz.getMethod(methName, argTypes)
var obj: JObject = null
if (! Modifier.isStatic(method.getModifiers())) {
- if (instance == null) {
+ if (instance eq null) {
instance = try {
clazz.newInstance()
} catch { case _ =>
@@ -202,7 +202,7 @@ class Code(clazz: java.lang.Class) {
obj = instance
}
val result = method.invoke(obj, args)
- if (result == null) ().asInstanceOf[JObject] else result
+ if (result eq null) ().asInstanceOf[JObject] else result
}
catch {
case me: NoSuchMethodException =>
diff --git a/src/library/scala/mobile/Location.scala b/src/library/scala/mobile/Location.scala
index 246db26fc9..2b8d456ea5 100644
--- a/src/library/scala/mobile/Location.scala
+++ b/src/library/scala/mobile/Location.scala
@@ -41,7 +41,7 @@ class Location(url: URL) {
/** The class loader associated with this location.
*/
- private val loader = if (url == null)
+ private val loader = if (url eq null)
ClassLoader.getSystemClassLoader()
else
lcache.get(url) match {
diff --git a/src/library/scala/runtime/BoxedAnyArray.scala b/src/library/scala/runtime/BoxedAnyArray.scala
index 558c01dead..7242e5763a 100644
--- a/src/library/scala/runtime/BoxedAnyArray.scala
+++ b/src/library/scala/runtime/BoxedAnyArray.scala
@@ -28,7 +28,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
private var elemClass: Class = null
def apply(index: Int): AnyRef = synchronized {
- if (unboxed == null)
+ if (unboxed eq null)
boxed(index);
else if (elemClass eq ScalaRunTime.IntTYPE)
Int.box(unboxed.asInstanceOf[Array[Int]](index))
@@ -51,7 +51,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
}
def update(index: Int, elem: AnyRef): Unit = synchronized {
- if (unboxed == null)
+ if (unboxed eq null)
boxed(index) = elem
else if (elemClass eq ScalaRunTime.IntTYPE)
unboxed.asInstanceOf[Array[Int]](index) = Int.unbox(elem)
@@ -85,7 +85,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
else unbox(Platform.getClassForName(elemTag))
def unbox(elemClass: Class): AnyRef = synchronized {
- if (unboxed == null) {
+ if (unboxed eq null) {
this.elemClass = elemClass;
if (elemClass eq ScalaRunTime.IntTYPE) {
val newvalue = new Array[Int](length)
@@ -165,21 +165,21 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
override def equals(other: Any): Boolean = (
other.isInstanceOf[BoxedAnyArray] && (this eq (other.asInstanceOf[BoxedAnyArray])) ||
- (if (unboxed == null) boxed == other else unboxed == other)
+ (if (unboxed eq null) boxed == other else unboxed == other)
)
override def hashCode(): Int = hash
def value: AnyRef = {
- if (unboxed == null) throw new NotDefinedError("BoxedAnyArray.value")
+ if (unboxed eq null) throw new NotDefinedError("BoxedAnyArray.value")
unboxed
}
private def adapt(other: AnyRef): AnyRef =
- if (this.unboxed == null)
+ if (this.unboxed eq null)
other match {
case that: BoxedAnyArray =>
- if (that.unboxed == null) {
+ if (that.unboxed eq null) {
that.boxed
} else {
if (ScalaRunTime.isValueClass(that.elemClass)) unbox(that.elemClass);
@@ -209,7 +209,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
else
other match {
case that: BoxedAnyArray =>
- if (that.unboxed != null) that.unboxed
+ if (that.unboxed ne null) that.unboxed
else if (ScalaRunTime.isValueClass(this.elemClass)) that.unbox(this.elemClass)
else that.boxed
case that: BoxedArray =>
@@ -220,12 +220,12 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
override def copyFrom(src: AnyRef, from: Int, to: Int, len: Int): Unit = {
val src1 = adapt(src)
- Array.copy(src1, from, if (unboxed != null) unboxed else boxed, to, len)
+ Array.copy(src1, from, if (unboxed ne null) unboxed else boxed, to, len)
}
override def copyTo(from: Int, dest: AnyRef, to: Int, len: Int): Unit = {
var dest1 = adapt(dest)
- Array.copy(if (unboxed != null) unboxed else boxed, from, dest1, to, len)
+ Array.copy(if (unboxed ne null) unboxed else boxed, from, dest1, to, len)
}
override def subArray(start: Int, end: Int): AnyRef = {
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index 7173253316..f0b5eb3ddc 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -52,7 +52,7 @@ object ScalaRunTime {
def run(): Unit = result = block;
def Catch[b >: a](handler: PartialFunction[Throwable, b]): b =
- if (exception == null)
+ if (exception eq null)
result.asInstanceOf[b]
// !!! else if (exception is LocalReturn)
// !!! // ...
@@ -62,7 +62,7 @@ object ScalaRunTime {
throw exception;
def Finally(handler: Unit): a =
- if (exception == null)
+ if (exception eq null)
result.asInstanceOf[a]
else
throw exception;
diff --git a/src/library/scala/xml/Elem.scala b/src/library/scala/xml/Elem.scala
index 96b571c505..77941f1c60 100644
--- a/src/library/scala/xml/Elem.scala
+++ b/src/library/scala/xml/Elem.scala
@@ -28,7 +28,7 @@ case class Elem(override val prefix: String,
override val scope: NamespaceBinding,
val child: Node*) extends Node {
- if (prefix != null && 0 == prefix.length())
+ if ((null != prefix) && 0 == prefix.length())
throw new IllegalArgumentException("prefix of zero length, use null instead");
if (null == scope)
diff --git a/src/library/scala/xml/NamespaceBinding.scala b/src/library/scala/xml/NamespaceBinding.scala
index 0a3f860803..c1acb444e5 100644
--- a/src/library/scala/xml/NamespaceBinding.scala
+++ b/src/library/scala/xml/NamespaceBinding.scala
@@ -59,7 +59,7 @@ class NamespaceBinding(val prefix: String,
def toString(sb: StringBuilder, stop: NamespaceBinding): Unit = {
if (this ne stop) { // contains?
sb.append(" xmlns")
- if (prefix != null) {
+ if (prefix ne null) {
sb.append(':').append(prefix)
}
sb.append('=')
diff --git a/src/library/scala/xml/Node.scala b/src/library/scala/xml/Node.scala
index 141a9f9f1b..e9d233af13 100644
--- a/src/library/scala/xml/Node.scala
+++ b/src/library/scala/xml/Node.scala
@@ -67,7 +67,7 @@ abstract class Node extends NodeSeq {
* @return the namespace if <code>scope != null</code> and prefix was
* found, else <code>null</code>
*/
- def getNamespace(pre: String) = if (scope == null) null else scope.getURI(pre)
+ def getNamespace(pre: String) = if (scope eq null) null else scope.getURI(pre)
/**
* Convenience method, looks up an unprefixed attribute in attributes of this node.
diff --git a/src/library/scala/xml/PrefixedAttribute.scala b/src/library/scala/xml/PrefixedAttribute.scala
index 96ba45c73c..397a68507c 100644
--- a/src/library/scala/xml/PrefixedAttribute.scala
+++ b/src/library/scala/xml/PrefixedAttribute.scala
@@ -21,7 +21,7 @@ class PrefixedAttribute(val pre: String,
val value: Seq[Node],
val next: MetaData) extends MetaData {
- if(value == null)
+ if(value eq null)
throw new UnsupportedOperationException("value is null")
/** same as this(key, Utility.parseAttributeValue(value), next) */
@@ -71,7 +71,7 @@ class PrefixedAttribute(val pre: String,
/** appends string representation of only this attribute to stringbuffer */
- def toString1(sb:StringBuilder): Unit = if(value!=null) {
+ def toString1(sb:StringBuilder): Unit = if(value ne null) {
sb.append(pre)
sb.append(':')
sb.append(key)
diff --git a/src/library/scala/xml/UnprefixedAttribute.scala b/src/library/scala/xml/UnprefixedAttribute.scala
index 5159c5a67f..8f08da3696 100644
--- a/src/library/scala/xml/UnprefixedAttribute.scala
+++ b/src/library/scala/xml/UnprefixedAttribute.scala
@@ -18,11 +18,11 @@ import compat.StringBuilder
*/
class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData) extends MetaData {
- val next = if(value != null) next1 else next1.remove(key)
+ val next = if(value ne null) next1 else next1.remove(key)
/** same as this(key, Utility.parseAttributeValue(value), next) */
def this(key: String, value: String, next: MetaData) =
- this(key, if(value!=null) Text(value) else {val z:NodeSeq=null;z}, next)
+ this(key, if(value ne null) Text(value) else {val z:NodeSeq=null;z}, next)
/** returns a copy of this unprefixed attribute with the given next field*/
def copy(next: MetaData) =
@@ -58,13 +58,13 @@ class UnprefixedAttribute(val key: String, val value: Seq[Node], next1: MetaData
/** returns the hashcode.
*/
override def hashCode() =
- key.hashCode() * 7 + { if(value!=null) value.hashCode() * 53 else 0 } + next.hashCode()
+ key.hashCode() * 7 + { if(value ne null) value.hashCode() * 53 else 0 } + next.hashCode()
/** returns false */
final def isPrefixed = false
/** appends string representation of only this attribute to stringbuffer */
- def toString1(sb:StringBuilder): Unit = if(value!=null) {
+ def toString1(sb:StringBuilder): Unit = if(value ne null) {
sb.append(key)
sb.append('=')
val sb2 = new StringBuilder()
diff --git a/src/library/scala/xml/Utility.scala b/src/library/scala/xml/Utility.scala
index fdc6681b5c..2788fd9529 100644
--- a/src/library/scala/xml/Utility.scala
+++ b/src/library/scala/xml/Utility.scala
@@ -159,7 +159,7 @@ object Utility extends AnyRef with parsing.TokenTests {
// print tag with namespace declarations
sb.append('<')
x.nameToString(sb)
- if (x.attributes != null) {
+ if (x.attributes ne null) {
x.attributes.toString(sb)
}
x.scope.toString(sb, pscope)
@@ -215,7 +215,7 @@ object Utility extends AnyRef with parsing.TokenTests {
* @param children
*/
def hashCode(pre: String, label: String, attribHashCode: Int, scpeHash: Int, children: Seq[Node]) = {
- ( if(pre!=null) {41 * pre.hashCode() % 7} else {0})
+ ( if(pre ne null) {41 * pre.hashCode() % 7} else {0})
+ label.hashCode() * 53
+ attribHashCode * 7
+ scpeHash * 31
@@ -337,7 +337,7 @@ object Utility extends AnyRef with parsing.TokenTests {
return "< not allowed in attribute value";
case '&' =>
val n = getName(value, i+1);
- if (n == null)
+ if (n eq null)
return "malformed entity reference in attribute value ["+value+"]";
i = i + n.length() + 1
if (i >= value.length() || value.charAt(i) != ';')
@@ -372,7 +372,7 @@ object Utility extends AnyRef with parsing.TokenTests {
sb.append(theChar)
case x =>
- if (rfb==null) rfb = new StringBuilder()
+ if (rfb eq null) rfb = new StringBuilder()
rfb.append(x)
c = it.next
while (c != ';') {
diff --git a/src/library/scala/xml/XML.scala b/src/library/scala/xml/XML.scala
index 673c44d333..e9e51ca520 100644
--- a/src/library/scala/xml/XML.scala
+++ b/src/library/scala/xml/XML.scala
@@ -151,7 +151,7 @@ object XML {
final def write(w: java.io.Writer, node: Node, enc: String, xmlDecl: Boolean, doctype: dtd.DocType): Unit = {
/* TODO: optimize by giving writer parameter to toXML*/
if (xmlDecl) w.write("<?xml version='1.0' encoding='" + enc + "'?>\n")
- if (doctype != null) w.write( doctype.toString() + "\n")
+ if (doctype ne null) w.write( doctype.toString() + "\n")
w.write(Utility.toXML(node))
}
}
diff --git a/src/library/scala/xml/dtd/ElementValidator.scala b/src/library/scala/xml/dtd/ElementValidator.scala
index 19406c577d..645caa66eb 100644
--- a/src/library/scala/xml/dtd/ElementValidator.scala
+++ b/src/library/scala/xml/dtd/ElementValidator.scala
@@ -57,7 +57,7 @@ class ElementValidator() extends Function1[Node,Boolean] {
}
case _ =>
- x.namespace == null
+ x.namespace eq null
}}
. map { x => ElemName(x.label) }
. elements;
diff --git a/src/library/scala/xml/dtd/ExternalID.scala b/src/library/scala/xml/dtd/ExternalID.scala
index 304c8b01e0..514db9c60f 100644
--- a/src/library/scala/xml/dtd/ExternalID.scala
+++ b/src/library/scala/xml/dtd/ExternalID.scala
@@ -66,7 +66,7 @@ case class PublicID( publicId:String, systemId:String ) extends ExternalID with
throw new IllegalArgumentException(
"publicId must consist of PubidChars"
)
- if( systemId != null && !checkSysID( systemId ) )
+ if( (systemId ne null) && !checkSysID( systemId ) )
throw new IllegalArgumentException(
"can't use both \" and ' in systemId"
)
@@ -83,7 +83,7 @@ case class PublicID( publicId:String, systemId:String ) extends ExternalID with
/** appends "PUBLIC "+publicId+" SYSTEM "+systemId to argument */
override def toString(sb: StringBuilder): StringBuilder = {
Utility.publicLiteralToString( sb, publicId ).append(' ')
- if(systemId!=null)
+ if(systemId ne null)
Utility.systemLiteralToString( sb, systemId )
else
sb
diff --git a/src/library/scala/xml/parsing/ExternalSources.scala b/src/library/scala/xml/parsing/ExternalSources.scala
index d3fd41314d..90b7f406a4 100644
--- a/src/library/scala/xml/parsing/ExternalSources.scala
+++ b/src/library/scala/xml/parsing/ExternalSources.scala
@@ -30,7 +30,7 @@ trait ExternalSources requires (ExternalSources with MarkupParser with MarkupHan
var inputLine:String = null;
//while (inputLine = in.readLine()) != null) {
- while ({inputLine = in.readLine(); inputLine} != null) {
+ while ({inputLine = in.readLine(); inputLine} ne null) {
// Console.println(inputLine); // DEBUG
str.append(inputLine);
str.append('\n'); // readable output
diff --git a/src/library/scala/xml/parsing/FactoryAdapter.scala b/src/library/scala/xml/parsing/FactoryAdapter.scala
index 99d81aef72..d1deabb5a2 100644
--- a/src/library/scala/xml/parsing/FactoryAdapter.scala
+++ b/src/library/scala/xml/parsing/FactoryAdapter.scala
@@ -188,7 +188,7 @@ abstract class FactoryAdapter extends DefaultHandler() {
// reverse order to get it right
var v: List[Node] = Nil
var child: Node = hStack.pop
- while (child != null) {
+ while (child ne null) {
v = child::v
child = hStack.pop
}
@@ -209,7 +209,7 @@ abstract class FactoryAdapter extends DefaultHandler() {
curTag = tagStack.pop
capture =
- if (curTag != null) nodeContainsText(curTag) // root level
+ if (curTag ne null) nodeContainsText(curTag) // root level
else false
} // endElement(String,String,String)
@@ -243,7 +243,7 @@ abstract class FactoryAdapter extends DefaultHandler() {
Console.print("] ")
var systemId = ex.getSystemId()
- if (systemId != null) {
+ if (systemId ne null) {
val index = systemId.lastIndexOf('/'.asInstanceOf[Int])
if (index != -1)
systemId = systemId.substring(index + 1)
diff --git a/src/library/scala/xml/parsing/MarkupParser.scala b/src/library/scala/xml/parsing/MarkupParser.scala
index c3a69b555a..e1813fdac5 100644
--- a/src/library/scala/xml/parsing/MarkupParser.scala
+++ b/src/library/scala/xml/parsing/MarkupParser.scala
@@ -580,7 +580,7 @@ trait MarkupParser requires (MarkupParser with MarkupHandler) extends AnyRef wit
def parseDTD(): Unit = { // dirty but fast
//Console.println("(DEBUG) parseDTD");
var extID: ExternalID = null
- if (this.dtd != null)
+ if (this.dtd ne null)
reportSyntaxError("unexpected character (DOCTYPE already defined");
xToken("DOCTYPE")
xSpace
@@ -649,7 +649,7 @@ trait MarkupParser requires (MarkupParser with MarkupHandler) extends AnyRef wit
/*override val */decls = handle.decls.reverse
}
//this.dtd.initializeEntities();
- if (doc!=null)
+ if (doc ne null)
doc.dtd = this.dtd
handle.endDTD(n)
diff --git a/src/library/scala/xml/pull/XMLEventReader.scala b/src/library/scala/xml/pull/XMLEventReader.scala
index b89bdb764d..130d7afe19 100644
--- a/src/library/scala/xml/pull/XMLEventReader.scala
+++ b/src/library/scala/xml/pull/XMLEventReader.scala
@@ -59,7 +59,7 @@ class XMLEventReader extends Iterator[XMLEvent] {
notifyAll
}
def getAndClearEvent: XMLEvent = synchronized {
- while(xmlEvent == null) {
+ while(xmlEvent eq null) {
wait()
}
val r = xmlEvent