diff options
author | Paul Phillips <paulp@improving.org> | 2013-02-25 06:40:29 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-02-25 06:40:29 -0800 |
commit | f2be783020a1c8e05ebcae3717740632b41d1751 (patch) | |
tree | f788e353cdf74edc0269363f38a4b4daadeb861f /src/compiler/scala | |
parent | fd4dadd1254f17dc9eb265bfd01b3324a7ad31f5 (diff) | |
parent | d6527d5083d77f67d08749b800938c97e0fcf13a (diff) | |
download | scala-f2be783020a1c8e05ebcae3717740632b41d1751.tar.gz scala-f2be783020a1c8e05ebcae3717740632b41d1751.tar.bz2 scala-f2be783020a1c8e05ebcae3717740632b41d1751.zip |
Merge pull request #2165 from retronym/topic/empty-paren
Spring cleaning
Diffstat (limited to 'src/compiler/scala')
116 files changed, 819 insertions, 834 deletions
diff --git a/src/compiler/scala/reflect/reify/Reifier.scala b/src/compiler/scala/reflect/reify/Reifier.scala index b3224b1aa6..9cf069fe98 100644 --- a/src/compiler/scala/reflect/reify/Reifier.scala +++ b/src/compiler/scala/reflect/reify/Reifier.scala @@ -6,9 +6,9 @@ import scala.reflect.macros.UnexpectedReificationException import scala.reflect.reify.utils.Utils /** Given a tree or a type, generate a tree that when executed at runtime produces the original tree or type. - * See more info in the comments to ``reify'' in scala.reflect.api.Universe. + * See more info in the comments to `reify` in scala.reflect.api.Universe. * - * @author Martin Odersky + * @author Martin Odersky * @version 2.10 */ abstract class Reifier extends States @@ -32,7 +32,7 @@ abstract class Reifier extends States override def hasReifier = true /** - * For ``reifee'' and other reification parameters, generate a tree of the form + * For `reifee` and other reification parameters, generate a tree of the form * * { * val $u: universe.type = <[ universe ]> diff --git a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala index df2eeaa932..78bdf7e132 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenTrees.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenTrees.scala @@ -15,7 +15,7 @@ trait GenTrees { /** * Reify a tree. - * For internal use only, use ``reified'' instead. + * For internal use only, use `reified` instead. */ def reifyTree(tree: Tree): Tree = { assert(tree != null, "tree is null") @@ -29,12 +29,12 @@ trait GenTrees { // the idea behind the new reincarnation of reifier is a simple maxim: // - // never call ``reifyType'' to reify a tree + // never call `reifyType` to reify a tree // // this works because the stuff we are reifying was once represented with trees only // and lexical scope information can be fully captured by reifying symbols // - // to enable this idyll, we work hard in the ``Reshape'' phase + // to enable this idyll, we work hard in the `Reshape` phase // which replaces all types with equivalent trees and works around non-idempotencies of the typechecker // // why bother? because this brings method to the madness @@ -65,7 +65,7 @@ trait GenTrees { } // usually we don't reify symbols/types, because they can be re-inferred during subsequent reflective compilation - // however, reification of AnnotatedTypes is special. see ``reifyType'' to find out why. + // however, reification of AnnotatedTypes is special. see `reifyType` to find out why. if (reifyTreeSymbols && tree.hasSymbolField) { if (reifyDebug) println("reifying symbol %s for tree %s".format(tree.symbol, tree)) rtree = mirrorBuildCall(nme.setSymbol, rtree, reify(tree.symbol)) @@ -86,13 +86,13 @@ trait GenTrees { case TreeSplice(splicee) => if (reifyDebug) println("splicing " + tree) - // see ``Metalevels'' for more info about metalevel breaches + // see `Metalevels` for more info about metalevel breaches // and about how we deal with splices that contain them val isMetalevelBreach = splicee exists (sub => sub.hasSymbolField && sub.symbol != NoSymbol && sub.symbol.metalevel > 0) val isRuntimeEval = splicee exists (sub => sub.hasSymbolField && sub.symbol == ExprSplice) if (isMetalevelBreach || isRuntimeEval) { // we used to convert dynamic splices into runtime evals transparently, but we no longer do that - // why? see comments in ``Metalevels'' + // why? see comments in `Metalevels` // if (reifyDebug) println("splicing has failed: cannot splice when facing a metalevel breach") // EmptyTree CannotReifyRuntimeSplice(tree) @@ -102,7 +102,7 @@ trait GenTrees { // we intentionally don't care about the prefix (the first underscore in the `RefiedTree` pattern match) case ReifiedTree(_, _, inlinedSymtab, rtree, _, _, _) => if (reifyDebug) println("inlining the splicee") - // all free vars local to the enclosing reifee should've already been inlined by ``Metalevels'' + // all free vars local to the enclosing reifee should've already been inlined by `Metalevels` for (sym <- inlinedSymtab.syms if sym.isLocalToReifee) abort("local free var, should have already been inlined by Metalevels: " + inlinedSymtab.symDef(sym)) state.symtab ++= inlinedSymtab diff --git a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala index 2370f18e3a..6c94726231 100644 --- a/src/compiler/scala/reflect/reify/codegen/GenTypes.scala +++ b/src/compiler/scala/reflect/reify/codegen/GenTypes.scala @@ -9,7 +9,7 @@ trait GenTypes { /** * Reify a type. - * For internal use only, use ``reified'' instead. + * For internal use only, use `reified` instead. */ def reifyType(tpe: Type): Tree = { assert(tpe != null, "tpe is null") @@ -155,7 +155,7 @@ trait GenTypes { */ private def reifySemiConcreteTypeMember(tpe: Type): Tree = tpe match { case tpe @ TypeRef(pre @ SingleType(prepre, presym), sym, args) if sym.isAbstractType && !sym.isExistential => - return mirrorFactoryCall(nme.TypeRef, reify(pre), mirrorBuildCall(nme.selectType, reify(sym.owner), reify(sym.name.toString)), reify(args)) + mirrorFactoryCall(nme.TypeRef, reify(pre), mirrorBuildCall(nme.selectType, reify(sym.owner), reify(sym.name.toString)), reify(args)) } /** Reify an annotated type, i.e. the one that makes us deal with AnnotationInfos */ diff --git a/src/compiler/scala/reflect/reify/phases/Calculate.scala b/src/compiler/scala/reflect/reify/phases/Calculate.scala index 5566fd7a77..abd179b24b 100644 --- a/src/compiler/scala/reflect/reify/phases/Calculate.scala +++ b/src/compiler/scala/reflect/reify/phases/Calculate.scala @@ -29,7 +29,7 @@ trait Calculate { * Merely traverses the reifiee and records local symbols along with their metalevels. */ val calculate = new Traverser { - // see the explanation of metalevels in ``Metalevels'' + // see the explanation of metalevels in `Metalevels` var currMetalevel = 1 override def traverse(tree: Tree): Unit = tree match { diff --git a/src/compiler/scala/reflect/reify/phases/Metalevels.scala b/src/compiler/scala/reflect/reify/phases/Metalevels.scala index cccf080dbf..18ea908cdf 100644 --- a/src/compiler/scala/reflect/reify/phases/Metalevels.scala +++ b/src/compiler/scala/reflect/reify/phases/Metalevels.scala @@ -40,15 +40,15 @@ trait Metalevels { * However, how exactly do we do that in the case of y.splice? In this very scenario we can use dataflow analysis and inline it, * but what if y were a var, and what if it were calculated randomly at runtime? * - * This question has a genuinely simple answer. Sure, we cannot resolve such splices statically (i.e. during macro expansion of ``reify''), + * This question has a genuinely simple answer. Sure, we cannot resolve such splices statically (i.e. during macro expansion of `reify`), * but now we have runtime toolboxes, so noone stops us from picking up that reified tree and evaluating it at runtime - * (in fact, this is something that ``Expr.splice'' does transparently). + * (in fact, this is something that `Expr.splice` does transparently). * * This is akin to early vs late binding dilemma. * The prior is faster, plus, the latter (implemented with reflection) might not work because of visibility issues or might be not available on all platforms. * But the latter still has its uses, so I'm allowing metalevel breaches, but introducing the -Xlog-runtime-evals to log them. * - * upd. We no longer do that. In case of a runaway ``splice'' inside a `reify`, one will get a static error. + * upd. We no longer do that. In case of a runaway `splice` inside a `reify`, one will get a static error. * Why? Unfortunately, the cute idea of transparently converting between static and dynamic splices has failed. * 1) Runtime eval that services dynamic splices requires scala-compiler.jar, which might not be on library classpath * 2) Runtime eval incurs a severe performance penalty, so it'd better to be explicit about it @@ -136,7 +136,7 @@ trait Metalevels { } else { withinSplice { super.transform(tree) } } - // todo. also inline usages of ``inlineableBindings'' in the symtab itself + // todo. also inline usages of `inlineableBindings` in the symtab itself // e.g. a free$Foo can well use free$x, if Foo is path-dependent w.r.t x // FreeRef(_, _) check won't work, because metalevels of symbol table and body are different, hence, freerefs in symbol table look different from freerefs in body case FreeRef(_, name) if inlineableBindings contains name => diff --git a/src/compiler/scala/reflect/reify/phases/Reify.scala b/src/compiler/scala/reflect/reify/phases/Reify.scala index eda4cba2bf..143424dac5 100644 --- a/src/compiler/scala/reflect/reify/phases/Reify.scala +++ b/src/compiler/scala/reflect/reify/phases/Reify.scala @@ -35,7 +35,7 @@ trait Reify extends GenSymbols /** * Reifies any supported value. - * For internal use only, use ``reified'' instead. + * For internal use only, use `reified` instead. */ def reify(reifee: Any): Tree = reifyStack.push(reifee)(reifee match { // before adding some case here, in global scope, please, consider diff --git a/src/compiler/scala/reflect/reify/phases/Reshape.scala b/src/compiler/scala/reflect/reify/phases/Reshape.scala index 71fe4ddeea..50ee379c2e 100644 --- a/src/compiler/scala/reflect/reify/phases/Reshape.scala +++ b/src/compiler/scala/reflect/reify/phases/Reshape.scala @@ -130,8 +130,8 @@ trait Reshape { * * NB: This is the trickiest part of reification! * - * In most cases, we're perfectly fine to reify a Type itself (see ``reifyType''). - * However if the type involves a symbol declared inside the quasiquote (i.e. registered in ``boundSyms''), + * In most cases, we're perfectly fine to reify a Type itself (see `reifyType`). + * However if the type involves a symbol declared inside the quasiquote (i.e. registered in `boundSyms`), * then we cannot reify it, or otherwise subsequent reflective compilation will fail. * * Why will it fail? Because reified deftrees (e.g. ClassDef(...)) will generate fresh symbols during that compilation, @@ -139,7 +139,7 @@ trait Reshape { * https://issues.scala-lang.org/browse/SI-5230 * * To deal with this unpleasant fact, we need to fall back from types to equivalent trees (after all, parser trees don't contain any types, just trees, so it should be possible). - * Luckily, these original trees get preserved for us in the ``original'' field when Trees get transformed into TypeTrees. + * Luckily, these original trees get preserved for us in the `original` field when Trees get transformed into TypeTrees. * And if an original of a type tree is empty, we can safely assume that this type is non-essential (e.g. was inferred/generated by the compiler). * In that case the type can be omitted (e.g. reified as an empty TypeTree), since it will be inferred again later on. * @@ -156,8 +156,8 @@ trait Reshape { * upd. There are also problems with CompoundTypeTrees. I had to use attachments to retain necessary information. * * upd. Recently I went ahead and started using original for all TypeTrees, regardless of whether they refer to local symbols or not. - * As a result, ``reifyType'' is never called directly by tree reification (and, wow, it seems to work great!). - * The only usage of ``reifyType'' now is for servicing typetags, however, I have some ideas how to get rid of that as well. + * As a result, `reifyType` is never called directly by tree reification (and, wow, it seems to work great!). + * The only usage of `reifyType` now is for servicing typetags, however, I have some ideas how to get rid of that as well. */ private def isDiscarded(tt: TypeTree) = tt.original == null private def toPreTyperTypeTree(tt: TypeTree): Tree = { @@ -280,7 +280,7 @@ trait Reshape { detectBeanAccessors("get") detectBeanAccessors("set") detectBeanAccessors("is") - }); + }) val stats1 = stats flatMap { case vdef @ ValDef(mods, name, tpt, rhs) if !mods.isLazy => diff --git a/src/compiler/scala/reflect/reify/utils/NodePrinters.scala b/src/compiler/scala/reflect/reify/utils/NodePrinters.scala index 0740f8d0b6..0903bc481c 100644 --- a/src/compiler/scala/reflect/reify/utils/NodePrinters.scala +++ b/src/compiler/scala/reflect/reify/utils/NodePrinters.scala @@ -71,10 +71,10 @@ trait NodePrinters { s.trim }) - val printout = scala.collection.mutable.ListBuffer[String](); + val printout = scala.collection.mutable.ListBuffer[String]() printout += universe.trim if (mirrorIsUsed) printout += mirror.replace("Mirror[", "scala.reflect.api.Mirror[").trim - val imports = scala.collection.mutable.ListBuffer[String](); + val imports = scala.collection.mutable.ListBuffer[String]() imports += nme.UNIVERSE_SHORT.toString // if (buildIsUsed) imports += nme.build if (mirrorIsUsed) imports += nme.MIRROR_SHORT.toString diff --git a/src/compiler/scala/tools/ant/Pack200Task.scala b/src/compiler/scala/tools/ant/Pack200Task.scala index 3180911414..3c1bc8cad9 100644 --- a/src/compiler/scala/tools/ant/Pack200Task.scala +++ b/src/compiler/scala/tools/ant/Pack200Task.scala @@ -65,7 +65,7 @@ class Pack200Task extends ScalaMatchingTask { /** Set the flag to specify if file reordering should be performed. Reordering * is used to remove empty packages and improve pack200 optimization. - * @param keep + * @param x * `'''true'''` to retain file ordering. * `'''false'''` to optimize directory structure (DEFAULT). */ def setKeepFileOrder(x: Boolean) { keepFileOrder = x } diff --git a/src/compiler/scala/tools/ant/Same.scala b/src/compiler/scala/tools/ant/Same.scala index e53679f052..a1f0cda662 100644 --- a/src/compiler/scala/tools/ant/Same.scala +++ b/src/compiler/scala/tools/ant/Same.scala @@ -110,7 +110,7 @@ class Same extends ScalaMatchingTask { \*============================================================================*/ override def execute() = { - validateAttributes + validateAttributes() val mapper = getMapper allEqualNow = true val originNames: Array[String] = getDirectoryScanner(origin.get).getIncludedFiles diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala index 633145a97c..e7ac53c8fb 100644 --- a/src/compiler/scala/tools/ant/ScalaTool.scala +++ b/src/compiler/scala/tools/ant/ScalaTool.scala @@ -190,13 +190,13 @@ class ScalaTool extends ScalaMatchingTask { val builder = new StringBuilder() while (chars.hasNext) { - val char = chars.next + val char = chars.next() if (char == '@') { - var char = chars.next + var char = chars.next() val token = new StringBuilder() while (chars.hasNext && char != '@') { token.append(char) - char = chars.next + char = chars.next() } if (token.toString == "") builder.append('@') @@ -212,13 +212,13 @@ class ScalaTool extends ScalaMatchingTask { val builder = new StringBuilder() while (chars.hasNext) { - val char = chars.next + val char = chars.next() if (char == '@') { - var char = chars.next + var char = chars.next() val token = new StringBuilder() while (chars.hasNext && char != '@') { token.append(char) - char = chars.next + char = chars.next() } if (tokens.contains(token.toString)) builder.append(tokens(token.toString)) diff --git a/src/compiler/scala/tools/ant/Scalac.scala b/src/compiler/scala/tools/ant/Scalac.scala index 3b8ae202f6..2a9567b567 100644 --- a/src/compiler/scala/tools/ant/Scalac.scala +++ b/src/compiler/scala/tools/ant/Scalac.scala @@ -496,7 +496,7 @@ class Scalac extends ScalaMatchingTask with ScalacShared { path.map(asString) mkString File.pathSeparator /** Transforms a file into a Scalac-readable string. - * @param path A file to convert. + * @param file A file to convert. * @return A string-representation of the file like `/x/k/a.scala`. */ protected def asString(file: File): String = file.getAbsolutePath() @@ -676,7 +676,7 @@ class Scalac extends ScalaMatchingTask with ScalacShared { file } - val res = execWithArgFiles(java, List(writeSettings.getAbsolutePath)) + val res = execWithArgFiles(java, List(writeSettings().getAbsolutePath)) if (failonerror && res != 0) buildError("Compilation failed because of an internal compiler error;"+ " 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 7fc811788e..fd6d637212 100644 --- a/src/compiler/scala/tools/ant/Scaladoc.scala +++ b/src/compiler/scala/tools/ant/Scaladoc.scala @@ -78,7 +78,7 @@ class Scaladoc extends ScalaMatchingTask { val values = List("yes", "no", "on", "off") def getBooleanValue(value: String, flagName: String): Boolean = if (Flag.isPermissible(value)) - return ("yes".equals(value) || "on".equals(value)) + ("yes".equals(value) || "on".equals(value)) else buildError("Unknown " + flagName + " flag '" + value + "'") } @@ -563,7 +563,7 @@ class Scaladoc extends ScalaMatchingTask { /** Transforms a file into a Scalac-readable string. * - * @param path A file to convert. + * @param file A file to convert. * @return A string-representation of the file like `/x/k/a.scala`. */ private def asString(file: File): String = diff --git a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala index d5545fe76a..76820b8060 100644 --- a/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala +++ b/src/compiler/scala/tools/ant/sabbus/ScalacFork.scala @@ -119,7 +119,7 @@ class ScalacFork extends ScalaMatchingTask with ScalacShared with TaskArgs { return if (includedFiles.nonEmpty) - log("Compiling %d file%s to %s".format(includedFiles.size, plural(includedFiles.size), destinationDir)) + log("Compiling %d file%s to %s".format(includedFiles.length, plural(includedFiles.length), destinationDir)) argfile foreach (x => log("Using argfile file: @" + x)) diff --git a/src/compiler/scala/tools/ant/sabbus/Use.scala b/src/compiler/scala/tools/ant/sabbus/Use.scala index 2c97232aec..5f50bb7908 100644 --- a/src/compiler/scala/tools/ant/sabbus/Use.scala +++ b/src/compiler/scala/tools/ant/sabbus/Use.scala @@ -53,9 +53,9 @@ class Use extends ScalaMatchingTask { compiler.settings.d, mapper ) map (new File(sourceDir.get, _)) - if (includedFiles.size > 0) + if (includedFiles.length > 0) try { - log("Compiling " + includedFiles.size + " file" + (if (includedFiles.size > 1) "s" else "") + " to " + compiler.settings.d.getAbsolutePath) + log("Compiling " + includedFiles.length + " file" + (if (includedFiles.length > 1) "s" else "") + " to " + compiler.settings.d.getAbsolutePath) val (errors, warnings) = compiler.compile(includedFiles) if (errors > 0) sys.error("Compilation failed with " + errors + " error" + (if (errors > 1) "s" else "") + ".") diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala index dbd2195938..35d4eaf1b6 100644 --- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala +++ b/src/compiler/scala/tools/cmd/gen/AnyVals.scala @@ -13,7 +13,7 @@ trait AnyValReps { sealed abstract class AnyValNum(name: String, repr: Option[String], javaEquiv: String) extends AnyValRep(name,repr,javaEquiv) { - case class Op(val op : String, val doc : String) + case class Op(op : String, doc : String) private def companionCoercions(tos: AnyValRep*) = { tos.toList map (to => diff --git a/src/compiler/scala/tools/nsc/CompileServer.scala b/src/compiler/scala/tools/nsc/CompileServer.scala index 72e8cc69c7..c5366566d9 100644 --- a/src/compiler/scala/tools/nsc/CompileServer.scala +++ b/src/compiler/scala/tools/nsc/CompileServer.scala @@ -115,7 +115,7 @@ class StandardCompileServer extends SocketServer { reporter = new ConsoleReporter(newSettings, in, out) { // disable prompts, so that compile server cannot block - override def displayPrompt = () + override def displayPrompt() = () } def isCompilerReusable: Boolean = { if (compiler == null) { @@ -157,7 +157,7 @@ class StandardCompileServer extends SocketServer { } } reporter.printSummary() - if (isMemoryFullEnough) { + if (isMemoryFullEnough()) { info("Nulling out compiler due to memory utilization.") clearCompiler() } diff --git a/src/compiler/scala/tools/nsc/ConsoleWriter.scala b/src/compiler/scala/tools/nsc/ConsoleWriter.scala index 5c5606e98b..6c16d19d2c 100644 --- a/src/compiler/scala/tools/nsc/ConsoleWriter.scala +++ b/src/compiler/scala/tools/nsc/ConsoleWriter.scala @@ -13,9 +13,9 @@ import java.io.Writer * @version 1.0 */ class ConsoleWriter extends Writer { - def close = flush + def close() = flush() - def flush = Console.flush + def flush() = Console.flush() def write(cbuf: Array[Char], off: Int, len: Int) { if (len > 0) diff --git a/src/compiler/scala/tools/nsc/EvalLoop.scala b/src/compiler/scala/tools/nsc/EvalLoop.scala index c4147fad4c..15a296c836 100644 --- a/src/compiler/scala/tools/nsc/EvalLoop.scala +++ b/src/compiler/scala/tools/nsc/EvalLoop.scala @@ -14,7 +14,7 @@ trait EvalLoop { def loop(action: (String) => Unit) { @tailrec def inner() { Console.print(prompt) - val line = try Console.readLine catch { case _: EOFException => null } + val line = try Console.readLine() catch { case _: EOFException => null } if (line != null && line != "") { action(line) inner() diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index c5184eeae8..fea9e72512 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -409,7 +409,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) currentRun.informUnitStarting(this, unit) apply(unit) } - currentRun.advanceUnit + currentRun.advanceUnit() } finally { //assert(currentUnit == unit) currentRun.currentUnit = unit0 @@ -805,8 +805,8 @@ class Global(var currentSettings: Settings, var reporter: Reporter) /** Invalidates packages that contain classes defined in a classpath entry, and * rescans that entry. - * @param path A fully qualified name that refers to a directory or jar file that's - * an entry on the classpath. + * @param paths Fully qualified names that refer to directories or jar files that are + * a entries on the classpath. * First, causes the classpath entry referred to by `path` to be rescanned, so that * any new files or deleted files or changes in subpackages are picked up. * Second, invalidates any packages for which one of the following considitions is met: @@ -1200,7 +1200,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) // Flush the cache in the terminal phase: the chain could have been built // before without being used. (This happens in the interpreter.) - terminal.reset + terminal.reset() // Each subcomponent supplies a phase, which are chained together. // If -Ystop:phase is given, neither that phase nor any beyond it is added. @@ -1256,8 +1256,8 @@ class Global(var currentSettings: Settings, var reporter: Reporter) // this handler should not be nessasary, but it seems that `fsc` // eats exceptions if they appear here. Need to find out the cause for // this and fix it. - inform("[reset] exception happened: "+ex); - ex.printStackTrace(); + inform("[reset] exception happened: "+ex) + ex.printStackTrace() throw ex } @@ -1283,14 +1283,14 @@ class Global(var currentSettings: Settings, var reporter: Reporter) def advancePhase() { unitc = 0 phasec += 1 - refreshProgress + refreshProgress() } /** take note that a phase on a unit is completed * (for progress reporting) */ def advanceUnit() { unitc += 1 - refreshProgress + refreshProgress() } def cancel() { reporter.cancelled = true } @@ -1400,8 +1400,8 @@ class Global(var currentSettings: Settings, var reporter: Reporter) if (canCheck) { phase = globalPhase - if (globalPhase.id >= icodePhase.id) icodeChecker.checkICodes - else treeChecker.checkTrees + if (globalPhase.id >= icodePhase.id) icodeChecker.checkICodes() + else treeChecker.checkTrees() } } @@ -1451,7 +1451,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) } } else { - allConditionalWarnings foreach (_.summarize) + allConditionalWarnings foreach (_.summarize()) if (seenMacroExpansionsFallingBack) warning("some macros could not be expanded and code fell back to overridden methods;"+ @@ -1502,7 +1502,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) while (globalPhase.hasNext && !reporter.hasErrors) { val startTime = currentTime phase = globalPhase - globalPhase.run + globalPhase.run() // progress update informTime(globalPhase.description, startTime) @@ -1542,7 +1542,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) if (settings.Ystatistics.value) statistics.print(phase) - advancePhase + advancePhase() } if (traceSymbolActivity) @@ -1602,7 +1602,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) val maxId = math.max(globalPhase.id, typerPhase.id) firstPhase.iterator takeWhile (_.id < maxId) foreach (ph => enteringPhase(ph)(ph.asInstanceOf[GlobalPhase] applyPhase unit)) - refreshProgress + refreshProgress() } } diff --git a/src/compiler/scala/tools/nsc/Main.scala b/src/compiler/scala/tools/nsc/Main.scala index c3c919fae4..27132f3c51 100644 --- a/src/compiler/scala/tools/nsc/Main.scala +++ b/src/compiler/scala/tools/nsc/Main.scala @@ -38,7 +38,7 @@ object Main extends Driver with EvalLoop { case Some(ex) => reporter.cancelled = true // Causes exit code to be non-0 case None => reporter.reset() // Causes other compiler errors to be ignored } - askShutdown + askShutdown() false } else true diff --git a/src/compiler/scala/tools/nsc/MainTokenMetric.scala b/src/compiler/scala/tools/nsc/MainTokenMetric.scala index 50cd51d486..584805b37e 100644 --- a/src/compiler/scala/tools/nsc/MainTokenMetric.scala +++ b/src/compiler/scala/tools/nsc/MainTokenMetric.scala @@ -21,11 +21,11 @@ object MainTokenMetric { var totale = 0 for (source <- fnames) { val s = new UnitScanner(new CompilationUnit(compiler.getSourceFile(source))) - s.nextToken + s.nextToken() var i = 0 while (s.token != EOF) { i += 1 - s.nextToken + s.nextToken() } Console.println(i.toString + " " + source.toString()) totale += i @@ -43,8 +43,8 @@ object MainTokenMetric { } catch { case ex @ FatalError(msg) => if (command.settings.debug.value) - ex.printStackTrace(); - reporter.error(null, "fatal error: " + msg) + ex.printStackTrace() + reporter.error(null, "fatal error: " + msg) } } diff --git a/src/compiler/scala/tools/nsc/PhaseAssembly.scala b/src/compiler/scala/tools/nsc/PhaseAssembly.scala index 67dc1e3b66..ae71eb7255 100644 --- a/src/compiler/scala/tools/nsc/PhaseAssembly.scala +++ b/src/compiler/scala/tools/nsc/PhaseAssembly.scala @@ -165,7 +165,7 @@ trait PhaseAssembly { } else { val promote = hl.to.before.filter(e => (!e.hard)) - hl.to.before.clear + hl.to.before.clear() sanity foreach (edge => hl.to.before += edge) for (edge <- promote) { rerun = true diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index 7e6a323d3d..f86f45fb43 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -303,7 +303,6 @@ trait DocComments { self: Global => /** Lookup definition of variable. * * @param vble The variable for which a definition is searched - * @param owner The current owner in which variable definitions are searched. * @param site The class for which doc comments are generated */ def lookupVariable(vble: String, site: Symbol): Option[String] = site match { @@ -322,10 +321,10 @@ trait DocComments { self: Global => /** Expand variable occurrences in string `str`, until a fix point is reached or * an expandLimit is exceeded. * - * @param str The string to be expanded - * @param sym The symbol for which doc comments are generated - * @param site The class for which doc comments are generated - * @return Expanded string + * @param initialStr The string to be expanded + * @param sym The symbol for which doc comments are generated + * @param site The class for which doc comments are generated + * @return Expanded string */ protected def expandVariables(initialStr: String, sym: Symbol, site: Symbol): String = { val expandLimit = 10 diff --git a/src/compiler/scala/tools/nsc/ast/Printers.scala b/src/compiler/scala/tools/nsc/ast/Printers.scala index b9f348632a..bff036e782 100644 --- a/src/compiler/scala/tools/nsc/ast/Printers.scala +++ b/src/compiler/scala/tools/nsc/ast/Printers.scala @@ -152,7 +152,7 @@ trait Printers extends scala.reflect.internal.Printers { this: Global => // If thenp or elsep has only one statement, it doesn't need more than one line. case If(cond, thenp, elsep) => def ifIndented(x: Tree) = { - indent ; println() ; printTree(x) ; undent + indent() ; println() ; printTree(x) ; undent() } val List(thenStmts, elseStmts) = List(thenp, elsep) map allStatements @@ -166,12 +166,12 @@ trait Printers extends scala.reflect.internal.Printers { this: Global => if (elseStmts.nonEmpty) { print(" else") - indent ; println() + indent() ; println() elseStmts match { case List(x) => printTree(x) case _ => printTree(elsep) } - undent ; println() + undent() ; println() } case _ => s() } diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala index 30a9348fb0..b73016837d 100644 --- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala +++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala @@ -32,7 +32,7 @@ abstract class TreeBrowsers { val borderSize = 10 - def create(): SwingBrowser = new SwingBrowser(); + def create(): SwingBrowser = new SwingBrowser() /** Pseudo tree class, so that all JTree nodes are treated uniformly */ case class ProgramTree(units: List[UnitTree]) extends Tree { @@ -59,7 +59,7 @@ abstract class TreeBrowsers { frame.createFrame(lock) // wait for the frame to be closed - lock.acquire + lock.acquire() t } @@ -81,7 +81,7 @@ abstract class TreeBrowsers { frame.createFrame(lock) // wait for the frame to be closed - lock.acquire + lock.acquire() } } @@ -182,14 +182,14 @@ abstract class TreeBrowsers { * especially symbols/types would change while the window is visible. */ def createFrame(lock: Lock): Unit = { - lock.acquire // keep the lock until the user closes the window + lock.acquire() // keep the lock until the user closes the window frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) frame.addWindowListener(new WindowAdapter() { /** Release the lock, so compilation may resume after the window is closed. */ - override def windowClosed(e: WindowEvent): Unit = lock.release - }); + override def windowClosed(e: WindowEvent): Unit = lock.release() + }) jTree = new JTree(treeModel) { /** Return the string for a tree node. */ @@ -251,7 +251,7 @@ abstract class TreeBrowsers { putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q, menuKey + shiftKey, false)) override def actionPerformed(e: ActionEvent) { closeWindow() - global.currentRun.cancel + global.currentRun.cancel() } } ) @@ -530,7 +530,7 @@ abstract class TreeBrowsers { if ((s ne null) && (s != NoSymbol)) { var str = s.flagString - if (s.isStaticMember) str = str + " isStatic "; + if (s.isStaticMember) str = str + " isStatic " (str + " annotations: " + s.annotations.mkString("", " ", "") + (if (s.isTypeSkolem) "\ndeSkolemized annotations: " + s.deSkolemize.annotations.mkString("", " ", "") else "")) } diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala index 4b5e23e177..c8b878225e 100644 --- a/src/compiler/scala/tools/nsc/ast/Trees.scala +++ b/src/compiler/scala/tools/nsc/ast/Trees.scala @@ -122,7 +122,7 @@ trait Trees extends scala.reflect.internal.Trees { self: Global => } else { // convert (implicit ... ) to ()(implicit ... ) if its the only parameter section if (vparamss1.isEmpty || !vparamss1.head.isEmpty && vparamss1.head.head.mods.isImplicit) - vparamss1 = List() :: vparamss1; + vparamss1 = List() :: vparamss1 val superRef: Tree = atPos(superPos)(gen.mkSuperInitCall) val superCall = pendingSuperCall // we can't know in advance which of the parents will end up as a superclass // this requires knowing which of the parents is a type macro and which is not diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala index 639780149e..e8cef0d9b1 100755 --- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala @@ -99,7 +99,7 @@ trait MarkupParsers { */ def xCheckEmbeddedBlock: Boolean = { // attentions, side-effect, used in xText - xEmbeddedBlock = (ch == '{') && { nextch; (ch != '{') } + xEmbeddedBlock = (ch == '{') && { nextch(); (ch != '{') } xEmbeddedBlock } @@ -115,7 +115,7 @@ trait MarkupParsers { while (isNameStart(ch)) { val start = curOffset val key = xName - xEQ + xEQ() val mid = curOffset val value: Tree = ch match { case '"' | '\'' => @@ -128,7 +128,7 @@ trait MarkupParsers { } case '{' => - nextch + nextch() xEmbeddedExpr case SU => throw TruncatedXMLControl @@ -141,7 +141,7 @@ trait MarkupParsers { aMap(key) = value if (ch != '/' && ch != '>') - xSpace + xSpace() } aMap } @@ -184,10 +184,10 @@ trait MarkupParsers { * @precond ch == '&' */ def content_AMP(ts: ArrayBuffer[Tree]) { - nextch + nextch() val toAppend = ch match { case '#' => // CharacterRef - nextch + nextch() val theChar = handle.text(tmppos, xCharRef) xToken(';') theChar @@ -216,8 +216,8 @@ trait MarkupParsers { return true // end tag val toAppend = ch match { - case '!' => nextch ; if (ch =='[') xCharData else xComment // CDATA or Comment - case '?' => nextch ; xProcInstr // PI + case '!' => nextch() ; if (ch =='[') xCharData else xComment // CDATA or Comment + case '?' => nextch() ; xProcInstr // PI case _ => element // child node } @@ -234,7 +234,7 @@ trait MarkupParsers { tmppos = o2p(curOffset) ch match { // end tag, cdata, comment, pi or child node - case '<' => nextch ; if (content_LT(ts)) return ts + case '<' => nextch() ; if (content_LT(ts)) return ts // either the character '{' or an embedded scala block } case '{' => content_BRACE(tmppos, ts) // } // EntityRef or CharRef @@ -266,7 +266,7 @@ trait MarkupParsers { debugLastStartElement.push((start, qname)) val ts = content xEndTag(qname) - debugLastStartElement.pop + debugLastStartElement.pop() val pos = r2p(start, start, curOffset) qname match { case "xml:group" => handle.group(pos, ts) @@ -285,12 +285,12 @@ trait MarkupParsers { while (ch != SU) { if (ch == '}') { - if (charComingAfter(nextch) == '}') nextch + if (charComingAfter(nextch()) == '}') nextch() else errorBraces() } buf append ch - nextch + nextch() if (xCheckEmbeddedBlock || ch == '<' || ch == '&') return done } @@ -337,12 +337,12 @@ trait MarkupParsers { content_LT(ts) // parse more XML ? - if (charComingAfter(xSpaceOpt) == '<') { - xSpaceOpt + if (charComingAfter(xSpaceOpt()) == '<') { + xSpaceOpt() while (ch == '<') { - nextch + nextch() ts append element - xSpaceOpt + xSpaceOpt() } handle.makeXMLseq(r2p(start, start, curOffset), ts) } @@ -363,7 +363,7 @@ trait MarkupParsers { saving[Boolean, Tree](handle.isPattern, handle.isPattern = _) { handle.isPattern = true val tree = xPattern - xSpaceOpt + xSpaceOpt() tree } }, @@ -401,10 +401,10 @@ trait MarkupParsers { val start = curOffset val qname = xName debugLastStartElement.push((start, qname)) - xSpaceOpt + xSpaceOpt() val ts = new ArrayBuffer[Tree] - val isEmptyTag = (ch == '/') && { nextch ; true } + val isEmptyTag = (ch == '/') && { nextch() ; true } xToken('>') if (!isEmptyTag) { @@ -414,13 +414,13 @@ trait MarkupParsers { if (xEmbeddedBlock) ts ++= xScalaPatterns else ch match { case '<' => // tag - nextch + nextch() if (ch != '/') ts append xPattern // child else return false // terminate case '{' => // embedded Scala patterns while (ch == '{') { - nextch + nextch() ts ++= xScalaPatterns } assert(!xEmbeddedBlock, "problem with embedded block") @@ -438,7 +438,7 @@ trait MarkupParsers { while (doPattern) { } // call until false xEndTag(qname) - debugLastStartElement.pop + debugLastStartElement.pop() } handle.makeXMLpat(r2p(start, start, curOffset), qname, ts) diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala index 61c65c211b..17c9d7814d 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -170,8 +170,8 @@ self => val global: self.global.type = self.global } - def xmlLiteral : Tree = xmlp.xLiteral - def xmlLiteralPattern : Tree = xmlp.xLiteralPattern + def xmlLiteral() : Tree = xmlp.xLiteral + def xmlLiteralPattern() : Tree = xmlp.xLiteralPattern } class OutlineParser(source: SourceFile) extends SourceFileParser(source) { @@ -1519,7 +1519,7 @@ self => placeholderParams = param :: placeholderParams id case LPAREN => - atPos(in.offset)(makeParens(commaSeparated(expr))) + atPos(in.offset)(makeParens(commaSeparated(expr()))) case LBRACE => canApply = false blockExpr() @@ -2482,7 +2482,7 @@ self => * }}} */ def funDefOrDcl(start : Int, mods: Modifiers): Tree = { - in.nextToken + in.nextToken() if (in.token == THIS) { atPos(start, in.skipToken()) { val vparamss = paramClauses(nme.CONSTRUCTOR, classContextBounds map (_.duplicate), ofCaseClass = false) @@ -2644,7 +2644,7 @@ self => * }}} */ def classDef(start: Int, mods: Modifiers): ClassDef = { - in.nextToken + in.nextToken() val nameOffset = in.offset val name = identForType() atPos(start, if (name == tpnme.ERROR) start else nameOffset) { @@ -2684,7 +2684,7 @@ self => * }}} */ def objectDef(start: Int, mods: Modifiers): ModuleDef = { - in.nextToken + in.nextToken() val nameOffset = in.offset val name = ident() val tstart = in.offset @@ -2790,7 +2790,7 @@ self => if (inScalaRootPackage && ScalaValueClassNames.contains(name)) Template(parents0, self, anyvalConstructor :: body) else - Template(anyrefParents, self, constrMods, vparamss, body, o2p(tstart)) + Template(anyrefParents(), self, constrMods, vparamss, body, o2p(tstart)) } } diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala index 1554be6ebb..b28d4cd08d 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala @@ -366,7 +366,7 @@ trait Scanners extends ScannersCommon { getOperatorRest() } } - fetchLT + fetchLT() case '~' | '!' | '@' | '#' | '%' | '^' | '*' | '+' | '-' | /*'<' | */ '>' | '?' | ':' | '=' | '&' | @@ -403,7 +403,7 @@ trait Scanners extends ScannersCommon { } getNumber() } - fetchZero + fetchZero() case '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => base = 10 getNumber() @@ -444,7 +444,7 @@ trait Scanners extends ScannersCommon { } } } - fetchDoubleQuote + fetchDoubleQuote() case '\'' => def fetchSingleQuote() = { nextChar() @@ -463,7 +463,7 @@ trait Scanners extends ScannersCommon { } } } - fetchSingleQuote + fetchSingleQuote() case '.' => nextChar() if ('0' <= ch && ch <= '9') { @@ -512,7 +512,7 @@ trait Scanners extends ScannersCommon { nextChar() } } - fetchOther + fetchOther() } } diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala index add932441d..f361daa574 100644 --- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala @@ -411,7 +411,7 @@ abstract class TreeBuilder { ValFrom(pos, pat, makeCombination(rhs.pos union test.pos, nme.withFilter, rhs, pat.duplicate, test)) :: rest, body) case ValFrom(pos, pat, rhs) :: rest => - val valeqs = rest.take(definitions.MaxTupleArity - 1).takeWhile(_.isInstanceOf[ValEq]); + val valeqs = rest.take(definitions.MaxTupleArity - 1).takeWhile(_.isInstanceOf[ValEq]) assert(!valeqs.isEmpty) val rest1 = rest.drop(valeqs.length) val pats = valeqs map { case ValEq(_, pat, _) => pat } diff --git a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala index f6b0701f86..1f9862596c 100644 --- a/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala +++ b/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala @@ -494,8 +494,8 @@ abstract class ScalaPrimitives { def isArraySet(code: Int): Boolean = code match { case ZARRAY_SET | BARRAY_SET | SARRAY_SET | CARRAY_SET | IARRAY_SET | LARRAY_SET | FARRAY_SET | DARRAY_SET | - OARRAY_SET | UPDATE => true; - case _ => false; + OARRAY_SET | UPDATE => true + case _ => false } /** Check whether the given code is a comparison operator */ @@ -514,7 +514,7 @@ abstract class ScalaPrimitives { DIV | MOD => true; // binary case OR | XOR | AND | LSL | LSR | ASR => true; // bitwise - case _ => false; + case _ => false } def isLogicalOp(code: Int): Boolean = code match { diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala index 24c18e6530..917fe8b292 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala @@ -263,10 +263,6 @@ trait BasicBlocks { /** Replaces `oldInstr` with `is`. It does not update * the position field in the newly inserted instructions, so it behaves * differently than the one-instruction versions of this function. - * - * @param iold .. - * @param is .. - * @return .. */ def replaceInstruction(oldInstr: Instruction, is: List[Instruction]): Boolean = { assert(closed, "Instructions can be replaced only after the basic block is closed") @@ -500,18 +496,6 @@ trait BasicBlocks { } object BBFlags { - val flagMap = Map[Int, String]( - LOOP_HEADER -> "loopheader", - IGNORING -> "ignore", - EX_HEADER -> "exheader", - CLOSED -> "closed", - DIRTYSUCCS -> "dirtysuccs", - DIRTYPREDS -> "dirtypreds" - ) - def flagsToString(flags: Int) = { - flagMap collect { case (bit, name) if (bit & flags) != 0 => "<" + name + ">" } mkString " " - } - /** This block is a loop header (was translated from a while). */ final val LOOP_HEADER = (1 << 0) @@ -529,4 +513,16 @@ object BBFlags { /** Code has been changed, recompute predecessors. */ final val DIRTYPREDS = (1 << 5) + + val flagMap = Map[Int, String]( + LOOP_HEADER -> "loopheader", + IGNORING -> "ignore", + EX_HEADER -> "exheader", + CLOSED -> "closed", + DIRTYSUCCS -> "dirtysuccs", + DIRTYPREDS -> "dirtypreds" + ) + def flagsToString(flags: Int) = { + flagMap collect { case (bit, name) if (bit & flags) != 0 => "<" + name + ">" } mkString " " + } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala index a872e9cd00..7243264773 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ExceptionHandlers.scala @@ -24,11 +24,11 @@ trait ExceptionHandlers { class ExceptionHandler(val method: IMethod, val label: TermName, val cls: Symbol, val pos: Position) { def loadExceptionClass = if (cls == NoSymbol) ThrowableClass else cls - private var _startBlock: BasicBlock = _; - var finalizer: Finalizer = _; + private var _startBlock: BasicBlock = _ + var finalizer: Finalizer = _ def setStartBlock(b: BasicBlock) = { - _startBlock = b; + _startBlock = b b.exceptionHandlerStart = true } def startBlock = _startBlock @@ -46,11 +46,11 @@ trait ExceptionHandlers { /** The body of this exception handler. May contain 'dead' blocks (which will not * make it into generated code because linearizers may not include them) */ - var blocks: List[BasicBlock] = Nil; + var blocks: List[BasicBlock] = Nil - def addBlock(b: BasicBlock): Unit = blocks = b :: blocks; + def addBlock(b: BasicBlock): Unit = blocks = b :: blocks - override def toString() = "exh_" + label + "(" + cls.simpleName + ")"; + override def toString() = "exh_" + label + "(" + cls.simpleName + ")" /** A standard copy constructor */ def this(other: ExceptionHandler) = { diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 7e17495035..122972039b 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -50,14 +50,14 @@ abstract class GenICode extends SubComponent { var unit: CompilationUnit = NoCompilationUnit override def run() { - scalaPrimitives.init + scalaPrimitives.init() classes.clear() super.run() } override def apply(unit: CompilationUnit): Unit = { this.unit = unit - unit.icode.clear + unit.icode.clear() informProgress("Generating icode for " + unit) gen(unit.body) this.unit = NoCompilationUnit @@ -91,7 +91,7 @@ abstract class GenICode extends SubComponent { debuglog("Generating class: " + tree.symbol.fullName) val outerClass = ctx.clazz ctx setClass (new IClass(tree.symbol) setCompilationUnit unit) - addClassFields(ctx, tree.symbol); + addClassFields(ctx, tree.symbol) classes += (tree.symbol -> ctx.clazz) unit.icode += ctx.clazz gen(impl, ctx) @@ -119,7 +119,7 @@ abstract class GenICode extends SubComponent { m.native = m.symbol.hasAnnotation(definitions.NativeAttr) if (!m.isAbstractMethod && !m.native) { - ctx1 = genLoad(rhs, ctx1, m.returnType); + ctx1 = genLoad(rhs, ctx1, m.returnType) // reverse the order of the local variables, to match the source-order m.locals = m.locals.reverse @@ -137,7 +137,7 @@ abstract class GenICode extends SubComponent { else ctx1.bb.closeWith(RETURN(m.returnType)) } - if (!ctx1.bb.closed) ctx1.bb.close + if (!ctx1.bb.closed) ctx1.bb.close() prune(ctx1.method) } else ctx1.method.setCode(NoCode) @@ -186,7 +186,7 @@ abstract class GenICode extends SubComponent { val thrownKind = toTypeKind(expr.tpe) val ctx1 = genLoad(expr, ctx, thrownKind) ctx1.bb.emit(THROW(expr.tpe.typeSymbol), expr.pos) - ctx1.bb.enterIgnoreMode + ctx1.bb.enterIgnoreMode() (ctx1, NothingReference) } @@ -224,10 +224,10 @@ abstract class GenICode extends SubComponent { // binary operation case rarg :: Nil => - resKind = getMaxType(larg.tpe :: rarg.tpe :: Nil); + resKind = getMaxType(larg.tpe :: rarg.tpe :: Nil) if (scalaPrimitives.isShiftOp(code) || scalaPrimitives.isBitwiseOp(code)) assert(resKind.isIntegralType | resKind == BOOL, - resKind.toString() + " incompatible with arithmetic modulo operation: " + ctx1); + resKind.toString() + " incompatible with arithmetic modulo operation: " + ctx1) ctx1 = genLoad(larg, ctx1, resKind) ctx1 = genLoad(rarg, @@ -271,7 +271,7 @@ abstract class GenICode extends SubComponent { if (scalaPrimitives.isArrayGet(code)) { // load argument on stack debugassert(args.length == 1, - "Too many arguments for array get operation: " + tree); + "Too many arguments for array get operation: " + tree) ctx1 = genLoad(args.head, ctx1, INT) generatedType = elem ctx1.bb.emit(LOAD_ARRAY_ITEM(elementType), tree.pos) @@ -283,7 +283,7 @@ abstract class GenICode extends SubComponent { } else if (scalaPrimitives.isArraySet(code)) { debugassert(args.length == 2, - "Too many arguments for array set operation: " + tree); + "Too many arguments for array set operation: " + tree) ctx1 = genLoad(args.head, ctx1, INT) ctx1 = genLoad(args.tail.head, ctx1, toTypeKind(args.tail.head.tpe)) // the following line should really be here, but because of bugs in erasure @@ -335,7 +335,7 @@ abstract class GenICode extends SubComponent { MONITOR_EXIT() setPos tree.pos, THROW(ThrowableClass) )) - exhCtx.bb.enterIgnoreMode + exhCtx.bb.enterIgnoreMode() exhCtx })), EmptyTree, tree) @@ -349,9 +349,9 @@ abstract class GenICode extends SubComponent { private def genLoadIf(tree: If, ctx: Context, expectedType: TypeKind): (Context, TypeKind) = { val If(cond, thenp, elsep) = tree - var thenCtx = ctx.newBlock - var elseCtx = ctx.newBlock - val contCtx = ctx.newBlock + var thenCtx = ctx.newBlock() + var elseCtx = ctx.newBlock() + val contCtx = ctx.newBlock() genCond(cond, ctx, thenCtx, elseCtx) @@ -404,8 +404,8 @@ abstract class GenICode extends SubComponent { (pat.symbol.tpe.typeSymbol, kind, { ctx: Context => - ctx.bb.emit(STORE_LOCAL(exception), pat.pos); - genLoad(body, ctx, kind); + ctx.bb.emit(STORE_LOCAL(exception), pat.pos) + genLoad(body, ctx, kind) }) } } @@ -434,7 +434,7 @@ abstract class GenICode extends SubComponent { else if (isArrayOp(code)) genArrayOp(tree, ctx, code, expectedType) else if (isLogicalOp(code) || isComparisonOp(code)) { - val trueCtx, falseCtx, afterCtx = ctx.newBlock + val trueCtx, falseCtx, afterCtx = ctx.newBlock() genCond(tree, ctx, trueCtx, falseCtx) trueCtx.bb.emitOnly( @@ -477,7 +477,7 @@ abstract class GenICode extends SubComponent { val resCtx: Context = tree match { case LabelDef(name, params, rhs) => def genLoadLabelDef = { - val ctx1 = ctx.newBlock + val ctx1 = ctx.newBlock() if (nme.isLoopHeaderLabel(name)) ctx1.bb.loopHeader = true @@ -491,7 +491,7 @@ abstract class GenICode extends SubComponent { val pair = (tree.symbol -> (new Label(tree.symbol) anchor ctx1.bb setParams (params map (_.symbol)))) debuglog("Adding label " + tree.symbol.fullLocationString + " in genLoad.") ctx1.labels += pair - ctx.method.addLocals(params map (p => new Local(p.symbol, toTypeKind(p.symbol.info), false))); + ctx.method.addLocals(params map (p => new Local(p.symbol, toTypeKind(p.symbol.info), false))) } ctx.bb.closeWith(JUMP(ctx1.bb), tree.pos) @@ -509,13 +509,13 @@ abstract class GenICode extends SubComponent { val local = ctx.method.addLocal(new Local(sym, toTypeKind(sym.info), false)) if (rhs == EmptyTree) { - debuglog("Uninitialized variable " + tree + " at: " + (tree.pos)); + debuglog("Uninitialized variable " + tree + " at: " + (tree.pos)) ctx.bb.emit(getZeroOf(local.kind)) } var ctx1 = ctx if (rhs != EmptyTree) - ctx1 = genLoad(rhs, ctx, local.kind); + ctx1 = genLoad(rhs, ctx, local.kind) ctx1.bb.emit(STORE_LOCAL(local), tree.pos) ctx1.scope.add(local) @@ -559,7 +559,7 @@ abstract class GenICode extends SubComponent { // we have to run this without the same finalizer in // the list, otherwise infinite recursion happens for // finalizers that contain 'return' - val fctx = finalizerCtx.newBlock + val fctx = finalizerCtx.newBlock() ctx1.bb.closeWith(JUMP(fctx.bb)) ctx1 = genLoad(f1, fctx, UNIT) } @@ -572,7 +572,7 @@ abstract class GenICode extends SubComponent { } adapt(returnedKind, ctx1.method.returnType, ctx1, tree.pos) ctx1.bb.emit(RETURN(ctx.method.returnType), tree.pos) - ctx1.bb.enterIgnoreMode + ctx1.bb.enterIgnoreMode() generatedType = expectedType ctx1 } @@ -624,7 +624,7 @@ abstract class GenICode extends SubComponent { } else { genCast(l, r, ctx1, cast) } - generatedType = if (cast) r else BOOL; + generatedType = if (cast) r else BOOL ctx1 } genLoadApply1 @@ -637,7 +637,7 @@ abstract class GenICode extends SubComponent { // on the stack (contrary to what the type in the AST says). case Apply(fun @ Select(Super(_, mix), _), args) => def genLoadApply2 = { - debuglog("Call to super: " + tree); + debuglog("Call to super: " + tree) val invokeStyle = SuperCall(mix) // if (fun.symbol.isConstructor) Static(true) else SuperCall(mix); @@ -700,7 +700,7 @@ abstract class GenICode extends SubComponent { case Apply(fun @ _, List(expr)) if (definitions.isBox(fun.symbol)) => def genLoadApply4 = { - debuglog("BOX : " + fun.symbol.fullName); + debuglog("BOX : " + fun.symbol.fullName) val ctx1 = genLoad(expr, ctx, toTypeKind(expr.tpe)) val nativeKind = toTypeKind(expr.tpe) if (settings.Xdce.value) { @@ -750,14 +750,14 @@ abstract class GenICode extends SubComponent { // (if it's not in ignore mode, double-closing is an error) val ctx1 = genLoadLabelArguments(args, label, ctx) ctx1.bb.emitOnly(if (label.anchored) JUMP(label.block) else PJUMP(label)) - ctx1.bb.enterIgnoreMode + ctx1.bb.enterIgnoreMode() ctx1 } else if (isPrimitive(sym)) { // primitive method call val (newCtx, resKind) = genPrimitiveOp(app, ctx, expectedType) generatedType = resKind newCtx } else { // normal method call - debuglog("Gen CALL_METHOD with sym: " + sym + " isStaticSymbol: " + sym.isStaticMember); + debuglog("Gen CALL_METHOD with sym: " + sym + " isStaticSymbol: " + sym.isStaticMember) val invokeStyle = if (sym.isStaticMember) Static(false) @@ -889,16 +889,16 @@ abstract class GenICode extends SubComponent { def genLoadLiteral = { if (value.tag != UnitTag) (value.tag, expectedType) match { case (IntTag, LONG) => - ctx.bb.emit(CONSTANT(Constant(value.longValue)), tree.pos); + ctx.bb.emit(CONSTANT(Constant(value.longValue)), tree.pos) generatedType = LONG case (FloatTag, DOUBLE) => - ctx.bb.emit(CONSTANT(Constant(value.doubleValue)), tree.pos); + ctx.bb.emit(CONSTANT(Constant(value.doubleValue)), tree.pos) generatedType = DOUBLE case (NullTag, _) => - ctx.bb.emit(CONSTANT(value), tree.pos); + ctx.bb.emit(CONSTANT(value), tree.pos) generatedType = NullReference case _ => - ctx.bb.emit(CONSTANT(value), tree.pos); + ctx.bb.emit(CONSTANT(value), tree.pos) generatedType = toTypeKind(tree.tpe) } ctx @@ -906,10 +906,10 @@ abstract class GenICode extends SubComponent { genLoadLiteral case Block(stats, expr) => - ctx.enterScope + ctx.enterScope() var ctx1 = genStat(stats, ctx) ctx1 = genLoad(expr, ctx1, expectedType) - ctx1.exitScope + ctx1.exitScope() ctx1 case Typed(Super(_, _), _) => @@ -946,9 +946,9 @@ abstract class GenICode extends SubComponent { case Match(selector, cases) => def genLoadMatch = { - debuglog("Generating SWITCH statement."); + debuglog("Generating SWITCH statement.") val ctx1 = genLoad(selector, ctx, INT) // TODO: Java 7 allows strings in switches (so, don't assume INT and don't convert the literals using intValue) - val afterCtx = ctx1.newBlock + val afterCtx = ctx1.newBlock() var caseCtx: Context = null generatedType = toTypeKind(tree.tpe) @@ -958,7 +958,7 @@ abstract class GenICode extends SubComponent { for (caze @ CaseDef(pat, guard, body) <- cases) { assert(guard == EmptyTree, guard) - val tmpCtx = ctx1.newBlock + val tmpCtx = ctx1.newBlock() pat match { case Literal(value) => tags = value.intValue :: tags @@ -1053,7 +1053,7 @@ abstract class GenICode extends SubComponent { // 3: invokevirtual #29; //Method scala/Predef$.$qmark$qmark$qmark:()Lscala/runtime/Nothing$; // 6: athrow // So this case tacks on the ahtrow which makes the JVM happy because class Nothing is declared as a subclass of Throwable - case NothingReference => ctx.bb.emit(THROW(ThrowableClass)) ; ctx.bb.enterIgnoreMode + case NothingReference => ctx.bb.emit(THROW(ThrowableClass)) ; ctx.bb.enterIgnoreMode() // TODO why do we have this case? It's saying if we have a throwable and a non-throwable is expected then we should emit a cast? Why would we get here? case ThrowableReference if !(ThrowableClass.tpe <:< to.toType) => ctx.bb.emit(CHECK_CAST(to)) // downcast throwables case _ => @@ -1379,7 +1379,7 @@ abstract class GenICode extends SubComponent { } } - debuglog("Entering genCond with tree: " + tree); + debuglog("Entering genCond with tree: " + tree) // the default emission def default() = { @@ -1397,7 +1397,7 @@ abstract class GenICode extends SubComponent { lazy val rhs = args.head def genZandOrZor(and: Boolean) = { - val ctxInterm = ctx.newBlock + val ctxInterm = ctx.newBlock() if (and) genCond(lhs, ctx, ctxInterm, elseCtx) else genCond(lhs, ctx, thenCtx, ctxInterm) @@ -1423,10 +1423,10 @@ abstract class GenICode extends SubComponent { else if (isComparisonOp(code)) genComparisonOp(lhs, rhs, code) else - default + default() } - case _ => default + case _ => default() } } @@ -1495,11 +1495,11 @@ abstract class GenICode extends SubComponent { } else { val eqEqTempLocal = getTempLocal var ctx1 = genLoad(l, ctx, ObjectReference) - lazy val nonNullCtx = ctx1.newBlock + lazy val nonNullCtx = ctx1.newBlock() // l == r -> if (l eq null) r eq null else l.equals(r) ctx1 = genLoad(r, ctx1, ObjectReference) - val nullCtx = ctx1.newBlock + val nullCtx = ctx1.newBlock() ctx1.bb.emitOnly( STORE_LOCAL(eqEqTempLocal) setPos l.pos, @@ -1582,14 +1582,14 @@ abstract class GenICode extends SubComponent { case _ => None } if (block.size == 1 && optCont.isDefined) { - val Some(cont) = optCont; - val pred = block.predecessors; - debuglog("Preds: " + pred + " of " + block + " (" + optCont + ")"); + val Some(cont) = optCont + val pred = block.predecessors + debuglog("Preds: " + pred + " of " + block + " (" + optCont + ")") pred foreach { p => changed = true p.lastInstruction match { case CJUMP(succ, fail, cond, kind) if (succ == block || fail == block) => - debuglog("Pruning empty if branch."); + debuglog("Pruning empty if branch.") p.replaceInstruction(p.lastInstruction, if (block == succ) if (block == fail) @@ -1602,7 +1602,7 @@ abstract class GenICode extends SubComponent { abort("Could not find block in preds: " + method + " " + block + " " + pred + " " + p)) case CZJUMP(succ, fail, cond, kind) if (succ == block || fail == block) => - debuglog("Pruning empty ifz branch."); + debuglog("Pruning empty ifz branch.") p.replaceInstruction(p.lastInstruction, if (block == succ) if (block == fail) @@ -1615,12 +1615,12 @@ abstract class GenICode extends SubComponent { abort("Could not find block in preds")) case JUMP(b) if (b == block) => - debuglog("Pruning empty JMP branch."); + debuglog("Pruning empty JMP branch.") val replaced = p.replaceInstruction(p.lastInstruction, JUMP(cont)) debugassert(replaced, "Didn't find p.lastInstruction") case SWITCH(tags, labels) if (labels contains block) => - debuglog("Pruning empty SWITCH branch."); + debuglog("Pruning empty SWITCH branch.") p.replaceInstruction(p.lastInstruction, SWITCH(tags, labels map (l => if (l == block) cont else l))) @@ -1636,7 +1636,7 @@ abstract class GenICode extends SubComponent { e.covered = e.covered filter (_ != block) e.blocks = e.blocks filter (_ != block) if (e.startBlock eq block) - e setStartBlock cont; + e setStartBlock cont } } } @@ -1648,7 +1648,7 @@ abstract class GenICode extends SubComponent { method.blocks foreach prune0 } while (changed) - debuglog("Prune fixpoint reached in " + n + " iterations."); + debuglog("Prune fixpoint reached in " + n + " iterations.") } def getMaxType(ts: List[Type]): TypeKind = @@ -1820,7 +1820,7 @@ abstract class GenICode extends SubComponent { } def addFinalizer(f: Tree, ctx: Context): this.type = { - cleanups = Finalizer(f, ctx) :: cleanups; + cleanups = Finalizer(f, ctx) :: cleanups this } @@ -1833,13 +1833,13 @@ abstract class GenICode extends SubComponent { ctx1.bb = ctx1.method.startBlock ctx1.defdef = d ctx1.scope = EmptyScope - ctx1.enterScope + ctx1.enterScope() ctx1 } /** Return a new context for a new basic block. */ def newBlock(): Context = { - val block = method.code.newBlock + val block = method.code.newBlock() handlers foreach (_ addCoveredBlock block) currentExceptionHandlers foreach (_ addBlock block) block.varsInScope.clear() @@ -1868,7 +1868,7 @@ abstract class GenICode extends SubComponent { val exh = new ExceptionHandler(method, newTermNameCached("" + handlerCount), cls, pos) method.addHandler(exh) handlers = exh :: handlers - debuglog("added handler: " + exh); + debuglog("added handler: " + exh) exh } @@ -1878,7 +1878,7 @@ abstract class GenICode extends SubComponent { private def addActiveHandler(exh: ExceptionHandler) { handlerCount += 1 handlers = exh :: handlers - debuglog("added handler: " + exh); + debuglog("added handler: " + exh) } /** Return a new context for generating code for the given @@ -1886,7 +1886,7 @@ abstract class GenICode extends SubComponent { */ private def enterExceptionHandler(exh: ExceptionHandler): Context = { currentExceptionHandlers ::= exh - val ctx = newBlock + val ctx = newBlock() exh.setStartBlock(ctx.bb) ctx } @@ -1929,7 +1929,7 @@ abstract class GenICode extends SubComponent { val outerCtx = this.dup // context for generating exception handlers, covered by finalizer val finalizerCtx = this.dup // context for generating finalizer handler - val afterCtx = outerCtx.newBlock + val afterCtx = outerCtx.newBlock() var tmp: Local = null val kind = toTypeKind(tree.tpe) val guardResult = kind != UNIT && mayCleanStack(finalizer) @@ -1943,7 +1943,7 @@ abstract class GenICode extends SubComponent { } def emitFinalizer(ctx: Context): Context = if (!finalizer.isEmpty) { - val ctx1 = finalizerCtx.dup.newBlock + val ctx1 = finalizerCtx.dup.newBlock() ctx.bb.closeWith(JUMP(ctx1.bb)) if (guardResult) { @@ -1962,12 +1962,12 @@ abstract class GenICode extends SubComponent { val ctx = finalizerCtx.enterExceptionHandler(exh) val exception = ctx.makeLocal(finalizer.pos, ThrowableClass.tpe, "exc") loadException(ctx, exh, finalizer.pos) - ctx.bb.emit(STORE_LOCAL(exception)); - val ctx1 = genLoad(finalizer, ctx, UNIT); - ctx1.bb.emit(LOAD_LOCAL(exception)); - ctx1.bb.emit(THROW(ThrowableClass)); - ctx1.bb.enterIgnoreMode; - ctx1.bb.close + ctx.bb.emit(STORE_LOCAL(exception)) + val ctx1 = genLoad(finalizer, ctx, UNIT) + ctx1.bb.emit(LOAD_LOCAL(exception)) + ctx1.bb.emit(THROW(ThrowableClass)) + ctx1.bb.enterIgnoreMode() + ctx1.bb.close() finalizerCtx.endHandler() } @@ -1983,7 +1983,7 @@ abstract class GenICode extends SubComponent { outerCtx.endHandler() } - val bodyCtx = this.newBlock + val bodyCtx = this.newBlock() if (finalizer != EmptyTree) bodyCtx.addFinalizer(finalizer, finalizerCtx) @@ -2028,7 +2028,7 @@ abstract class GenICode extends SubComponent { /** Add an instruction that refers to this label. */ def addCallingInstruction(i: Instruction) = - toPatch = i :: toPatch; + toPatch = i :: toPatch /** * Patch the code by replacing pseudo call instructions with @@ -2090,7 +2090,7 @@ abstract class GenICode extends SubComponent { // register with the given label if (!label.anchored) - label.addCallingInstruction(this); + label.addCallingInstruction(this) } case class PJUMP(whereto: Label) extends PseudoJUMP(whereto) diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala index 5d32795e24..fb1ef311d2 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/ICodeCheckers.scala @@ -208,7 +208,7 @@ abstract class ICodeCheckers { if (s1.length != s2.length) { if (allUnits(s1) && allUnits(s2)) workaround("Ignoring mismatched boxed units") - else if (isHandlerBlock) + else if (isHandlerBlock()) workaround("Ignoring mismatched stacks entering exception handler") else throw new CheckerException(incompatibleString) @@ -233,8 +233,8 @@ abstract class ICodeCheckers { } if (preds.nonEmpty) { - in(bl) = (preds map out.apply) reduceLeft meet2; - log("Input changed for block: " + bl +" to: " + in(bl)); + in(bl) = (preds map out.apply) reduceLeft meet2 + log("Input changed for block: " + bl +" to: " + in(bl)) } } @@ -380,9 +380,9 @@ abstract class ICodeCheckers { def checkField(obj: TypeKind, field: Symbol): Unit = obj match { case REFERENCE(sym) => if (sym.info.member(field.name) == NoSymbol) - icodeError(" " + field + " is not defined in class " + clasz); + icodeError(" " + field + " is not defined in class " + clasz) case _ => - icodeError(" expected reference type, but " + obj + " found"); + icodeError(" expected reference type, but " + obj + " found") } /** Checks that tpe is a subtype of one of the allowed types */ @@ -419,11 +419,11 @@ abstract class ICodeCheckers { receiver match { case REFERENCE(sym) => checkBool(sym.info.member(method.name) != NoSymbol, - "Method " + method + " does not exist in " + sym.fullName); + "Method " + method + " does not exist in " + sym.fullName) if (method.isPrivate) checkBool(method.owner == clasz.symbol, "Cannot call private method of " + method.owner.fullName - + " from " + clasz.symbol.fullName); + + " from " + clasz.symbol.fullName) else if (method.isProtected) { val isProtectedOK = ( (clasz.symbol isSubClass method.owner) || @@ -432,7 +432,7 @@ abstract class ICodeCheckers { checkBool(isProtectedOK, "Cannot call protected method of " + method.owner.fullName - + " from " + clasz.symbol.fullName); + + " from " + clasz.symbol.fullName) } case ARRAY(_) => @@ -465,7 +465,7 @@ abstract class ICodeCheckers { pushStack(elem) case (a, b) => icodeError(" expected an INT and an array reference, but " + - a + ", " + b + " found"); + a + ", " + b + " found") } case LOAD_LOCAL(local) => @@ -483,10 +483,10 @@ abstract class ICodeCheckers { case LOAD_MODULE(module) => checkBool((module.isModule || module.isModuleClass), - "Expected module: " + module + " flags: " + module.flagString); - pushStack(toTypeKind(module.tpe)); + "Expected module: " + module + " flags: " + module.flagString) + pushStack(toTypeKind(module.tpe)) - case STORE_THIS(kind) => + case STORE_THIS(kind) => val actualType = popStack if (actualType.isReferenceType) subtypeTest(actualType, kind) else icodeError("Expected this reference but found: " + actualType) @@ -498,7 +498,7 @@ abstract class ICodeCheckers { subtypeTest(k, elem) case (a, b, c) => icodeError(" expected and array reference, and int and " + kind + - " but " + a + ", " + b + ", " + c + " found"); + " but " + a + ", " + b + ", " + c + " found") } case STORE_LOCAL(local) => @@ -653,7 +653,7 @@ abstract class ICodeCheckers { case RETURN(kind) => val top = popStack if (kind.isValueType) checkType(top, kind) - else checkBool(!top.isValueType, "" + kind + " is a reference type, but " + top + " is not"); + else checkBool(!top.isValueType, "" + kind + " is a reference type, but " + top + " is not") case THROW(clasz) => checkType(popStack, toTypeKind(clasz.tpe)) diff --git a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala index 80477f0c6e..c5fe3228a3 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Linearizers.scala @@ -35,15 +35,15 @@ trait Linearizers { var blocks: List[BasicBlock] = Nil def linearize(m: IMethod): List[BasicBlock] = { - val b = m.startBlock; - blocks = Nil; + val b = m.startBlock + blocks = Nil run { - worklist pushAll (m.exh map (_.startBlock)); - worklist.push(b); + worklist pushAll (m.exh map (_.startBlock)) + worklist.push(b) } - blocks.reverse; + blocks.reverse } def linearizeAt(m: IMethod, start: BasicBlock): List[BasicBlock] = { @@ -55,30 +55,30 @@ trait Linearizers { /** Linearize another subtree and append it to the existing blocks. */ def linearize(startBlock: BasicBlock): List[BasicBlock] = { //blocks = startBlock :: Nil; - run( { worklist.push(startBlock); } ); - blocks.reverse; + run( { worklist.push(startBlock); } ) + blocks.reverse } def processElement(b: BasicBlock) = if (b.nonEmpty) { - add(b); + add(b) b.lastInstruction match { case JUMP(whereto) => - add(whereto); + add(whereto) case CJUMP(success, failure, _, _) => - add(success); - add(failure); + add(success) + add(failure) case CZJUMP(success, failure, _, _) => - add(success); - add(failure); + add(success) + add(failure) case SWITCH(_, labels) => - add(labels); - case RETURN(_) => (); - case THROW(clasz) => (); + add(labels) + case RETURN(_) => () + case THROW(clasz) => () } } - def dequeue: Elem = worklist.pop; + def dequeue: Elem = worklist.pop() /** * Prepend b to the list, if not already scheduled. @@ -88,25 +88,25 @@ trait Linearizers { if (blocks.contains(b)) () else { - blocks = b :: blocks; - worklist push b; + blocks = b :: blocks + worklist push b } } - def add(bs: List[BasicBlock]): Unit = bs foreach add; + def add(bs: List[BasicBlock]): Unit = bs foreach add } /** * Linearize code using a depth first traversal. */ class DepthFirstLinerizer extends Linearizer { - var blocks: List[BasicBlock] = Nil; + var blocks: List[BasicBlock] = Nil def linearize(m: IMethod): List[BasicBlock] = { - blocks = Nil; + blocks = Nil - dfs(m.startBlock); - m.exh foreach (b => dfs(b.startBlock)); + dfs(m.startBlock) + m.exh foreach (b => dfs(b.startBlock)) blocks.reverse } @@ -119,7 +119,7 @@ trait Linearizers { def dfs(b: BasicBlock): Unit = if (b.nonEmpty && add(b)) - b.successors foreach dfs; + b.successors foreach dfs /** * Prepend b to the list, if not already scheduled. @@ -128,7 +128,7 @@ trait Linearizers { */ def add(b: BasicBlock): Boolean = !(blocks contains b) && { - blocks = b :: blocks; + blocks = b :: blocks true } } @@ -144,12 +144,12 @@ trait Linearizers { val added = new mutable.BitSet def linearize(m: IMethod): List[BasicBlock] = { - blocks = Nil; + blocks = Nil visited.clear() - added.clear; + added.clear() - m.exh foreach (b => rpo(b.startBlock)); - rpo(m.startBlock); + m.exh foreach (b => rpo(b.startBlock)) + rpo(m.startBlock) // if the start block has predecessors, it won't be the first one // in the linearization, so we need to enforce it here @@ -170,7 +170,7 @@ trait Linearizers { def rpo(b: BasicBlock): Unit = if (b.nonEmpty && !visited(b)) { - visited += b; + visited += b b.successors foreach rpo add(b) } @@ -184,7 +184,7 @@ trait Linearizers { if (!added(b.label)) { added += b.label - blocks = b :: blocks; + blocks = b :: blocks } } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala index 248a505b54..5c90fbf366 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala @@ -58,7 +58,7 @@ trait Members { } // Constructor code - startBlock = newBlock + startBlock = newBlock() def removeBlock(b: BasicBlock) { if (settings.debug.value) { @@ -80,7 +80,7 @@ trait Members { } /** This methods returns a string representation of the ICode */ - override def toString = "ICode '" + name + "'"; + override def toString = "ICode '" + name + "'" /* Compute a unique new label */ def nextLabel: Int = { @@ -92,8 +92,8 @@ trait Members { */ def newBlock(): BasicBlock = { touched = true - val block = new BasicBlock(nextLabel, method); - blocks += block; + val block = new BasicBlock(nextLabel, method) + blocks += block block } } @@ -115,17 +115,17 @@ trait Members { var cunit: CompilationUnit = _ def addField(f: IField): this.type = { - fields = f :: fields; + fields = f :: fields this } def addMethod(m: IMethod): this.type = { - methods = m :: methods; + methods = m :: methods this } def setCompilationUnit(unit: CompilationUnit): this.type = { - this.cunit = unit; + this.cunit = unit this } @@ -155,7 +155,7 @@ trait Members { class IMethod(val symbol: Symbol) extends IMember { var code: Code = NoCode - def newBlock() = code.newBlock + def newBlock() = code.newBlock() def startBlock = code.startBlock def lastBlock = { assert(blocks.nonEmpty, symbol); blocks.last } def blocks = code.blocksList @@ -180,7 +180,7 @@ trait Members { def hasCode = code ne NoCode def setCode(code: Code): IMethod = { - this.code = code; + this.code = code this } @@ -220,10 +220,10 @@ trait Members { val nextBlock: mutable.Map[BasicBlock, BasicBlock] = mutable.HashMap.empty for (b <- code.blocks.toList if b.successors.length == 1; - succ = b.successors.head; - if succ ne b; - if succ.predecessors.length == 1; - if succ.predecessors.head eq b; + succ = b.successors.head + if succ ne b + if succ.predecessors.length == 1 + if succ.predecessors.head eq b if !(exh.exists { (e: ExceptionHandler) => (e.covers(succ) && !e.covers(b)) || (e.covers(b) && !e.covers(succ)) })) { nextBlock(b) = succ @@ -232,10 +232,10 @@ trait Members { var bb = code.startBlock while (!nextBlock.isEmpty) { if (nextBlock.isDefinedAt(bb)) { - bb.open + bb.open() var succ = bb do { - succ = nextBlock(succ); + succ = nextBlock(succ) val lastInstr = bb.lastInstruction /* Ticket SI-5672 * Besides removing the control-flow instruction at the end of `bb` (usually a JUMP), we have to pop any values it pushes. @@ -246,7 +246,7 @@ trait Members { val oldTKs = lastInstr.consumedTypes assert(lastInstr.consumed == oldTKs.size, "Someone forgot to override consumedTypes() in " + lastInstr) - bb.removeLastInstruction + bb.removeLastInstruction() for(tk <- oldTKs.reverse) { bb.emit(DROP(tk), lastInstr.pos) } succ.toList foreach { i => bb.emit(i, i.pos) } code.removeBlock(succ) @@ -254,9 +254,9 @@ trait Members { nextBlock -= bb } while (nextBlock.isDefinedAt(succ)) - bb.close + bb.close() } else - bb = nextBlock.keysIterator.next + bb = nextBlock.keysIterator.next() } checkValid(this) } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala index 137e2b556f..d8aac8e9db 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Opcodes.scala @@ -64,7 +64,7 @@ import scala.reflect.internal.util.{Position,NoPosition} * in the source files. */ trait Opcodes { self: ICodes => - import global.{Symbol, NoSymbol, Name, Constant}; + import global.{Symbol, NoSymbol, Name, Constant} // categories of ICode instructions final val localsCat = 1 @@ -195,7 +195,7 @@ trait Opcodes { self: ICodes => case class LOAD_FIELD(field: Symbol, isStatic: Boolean) extends Instruction { /** Returns a string representation of this instruction */ override def toString(): String = - "LOAD_FIELD " + (if (isStatic) field.fullName else field.toString()); + "LOAD_FIELD " + (if (isStatic) field.fullName else field.toString()) override def consumed = if (isStatic) 0 else 1 override def produced = 1 @@ -257,16 +257,17 @@ trait Opcodes { self: ICodes => case class STORE_FIELD(field: Symbol, isStatic: Boolean) extends Instruction { /** Returns a string representation of this instruction */ override def toString(): String = - "STORE_FIELD "+field + (if (isStatic) " (static)" else " (dynamic)"); + "STORE_FIELD "+field + (if (isStatic) " (static)" else " (dynamic)") - override def consumed = if(isStatic) 1 else 2; - override def produced = 0; + override def consumed = if(isStatic) 1 else 2 + + override def produced = 0 override def consumedTypes = if (isStatic) toTypeKind(field.tpe) :: Nil else - REFERENCE(field.owner) :: toTypeKind(field.tpe) :: Nil; + REFERENCE(field.owner) :: toTypeKind(field.tpe) :: Nil override def category = fldsCat } @@ -420,10 +421,12 @@ trait Opcodes { self: ICodes => */ case class NEW(kind: REFERENCE) extends Instruction { /** Returns a string representation of this instruction */ - override def toString(): String = "NEW "+ kind; + override def toString(): String = "NEW "+ kind + + override def consumed = 0 + + override def produced = 1 - override def consumed = 0; - override def produced = 1; override def producedTypes = kind :: Nil /** The corresponding constructor call. */ @@ -439,11 +442,13 @@ trait Opcodes { self: ICodes => */ case class CREATE_ARRAY(elem: TypeKind, dims: Int) extends Instruction { /** Returns a string representation of this instruction */ - override def toString(): String ="CREATE_ARRAY "+elem + " x " + dims; + override def toString(): String ="CREATE_ARRAY "+elem + " x " + dims + + override def consumed = dims - override def consumed = dims; override def consumedTypes = List.fill(dims)(INT) - override def produced = 1; + override def produced = 1 + override def producedTypes = ARRAY(elem) :: Nil override def category = arraysCat @@ -532,7 +537,7 @@ trait Opcodes { self: ICodes => override def toString(): String = ( "CJUMP (" + kind + ")" + cond + " ? "+successBlock.label+" : "+failureBlock.label - ); + ) override def consumed = 2 override def produced = 0 @@ -555,7 +560,7 @@ trait Opcodes { self: ICodes => override def toString(): String = ( "CZJUMP (" + kind + ")" + cond + " ? "+successBlock.label+" : "+failureBlock.label - ); + ) override def consumed = 1 override def produced = 0 @@ -647,10 +652,11 @@ trait Opcodes { self: ICodes => */ case class MONITOR_EXIT() extends Instruction { /** Returns a string representation of this instruction */ - override def toString(): String ="MONITOR_EXIT"; + override def toString(): String ="MONITOR_EXIT" - override def consumed = 1; - override def produced = 0; + override def consumed = 1 + + override def produced = 0 override def consumedTypes = ObjectReference :: Nil diff --git a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala index 351d99f51a..4fa717309e 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Primitives.scala @@ -6,9 +6,9 @@ package scala.tools.nsc package backend -package icode; +package icode -import java.io.PrintWriter; +import java.io.PrintWriter trait Primitives { self: ICodes => @@ -51,12 +51,12 @@ trait Primitives { self: ICodes => // type : (src) => dst // range: src,dst <- { Ix, Ux, Rx } // jvm : i2{l, f, d}, l2{i, f, d}, f2{i, l, d}, d2{i, l, f}, i2{b, c, s} - case class Conversion(src: TypeKind, dst: TypeKind) extends Primitive; + case class Conversion(src: TypeKind, dst: TypeKind) extends Primitive // type : (Array[REF]) => I4 // range: type <- { BOOL, Ix, Ux, Rx, REF } // jvm : arraylength - case class ArrayLength(kind: TypeKind) extends Primitive; + case class ArrayLength(kind: TypeKind) extends Primitive // type : (buf,el) => buf // range: lf,rg <- { BOOL, Ix, Ux, Rx, REF, STR } @@ -230,9 +230,9 @@ trait Primitives { self: ICodes => /** Returns a string representation of this operation. */ override def toString(): String = this match { - case AND => return "AND" - case OR => return "OR" - case XOR => return "XOR" + case AND => "AND" + case OR => "OR" + case XOR => "XOR" case _ => throw new RuntimeException("LogicalOp unknown case") } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala index 61af6e5119..5b47e3cfff 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala @@ -27,15 +27,15 @@ trait Printers { self: ICodes => def print(o: Any) { print(o.toString()) } def println(s: String) { - print(s); - println + print(s) + println() } def println() { out.println() var i = 0 while (i < margin) { - print(" "); + print(" ") i += 1 } } @@ -53,26 +53,26 @@ trait Printers { self: ICodes => } def printClass(cls: IClass) { - print(cls.symbol.toString()); print(" extends "); - printList(cls.symbol.info.parents, ", "); - indent; println(" {"); - println("// fields:"); - cls.fields.foreach(printField); println; - println("// methods"); - cls.methods.foreach(printMethod); - undent; println; + print(cls.symbol.toString()); print(" extends ") + printList(cls.symbol.info.parents, ", ") + indent(); println(" {") + println("// fields:") + cls.fields.foreach(printField); println() + println("// methods") + cls.methods.foreach(printMethod) + undent(); println() println("}") } def printField(f: IField) { - print(f.symbol.keyString); print(" "); - print(f.symbol.nameString); print(": "); - println(f.symbol.info.toString()); + print(f.symbol.keyString); print(" ") + print(f.symbol.nameString); print(": ") + println(f.symbol.info.toString()) } def printMethod(m: IMethod) { - print("def "); print(m.symbol.name); - print("("); printList(printParam)(m.params, ", "); print(")"); + print("def "); print(m.symbol.name) + print("("); printList(printParam)(m.params, ", "); print(")") print(": "); print(m.symbol.info.resultType) if (!m.isAbstractMethod) { @@ -80,40 +80,40 @@ trait Printers { self: ICodes => println("locals: " + m.locals.mkString("", ", ", "")) println("startBlock: " + m.startBlock) println("blocks: " + m.code.blocks.mkString("[", ",", "]")) - println + println() lin.linearize(m) foreach printBlock println("}") - indent; println("Exception handlers: ") + indent(); println("Exception handlers: ") m.exh foreach printExceptionHandler - undent; println + undent(); println() } else - println + println() } def printParam(p: Local) { - print(p.sym.name); print(": "); print(p.sym.info); + print(p.sym.name); print(": "); print(p.sym.info) print(" ("); print(p.kind); print(")") } def printExceptionHandler(e: ExceptionHandler) { - indent; - println("catch (" + e.cls.simpleName + ") in " + e.covered.toSeq.sortBy(_.label) + " starting at: " + e.startBlock); - println("consisting of blocks: " + e.blocks); - undent; - println("with finalizer: " + e.finalizer); -// linearizer.linearize(e.startBlock) foreach printBlock; + indent() + println("catch (" + e.cls.simpleName + ") in " + e.covered.toSeq.sortBy(_.label) + " starting at: " + e.startBlock) + println("consisting of blocks: " + e.blocks) + undent() + println("with finalizer: " + e.finalizer) + // linearizer.linearize(e.startBlock) foreach printBlock; } def printBlock(bb: BasicBlock) { print(bb.label) if (bb.loopHeader) print("[loop header]") - print(": "); + print(": ") if (settings.debug.value) print("pred: " + bb.predecessors + " succs: " + bb.successors + " flags: " + bb.flagsString) - indent; println + indent(); println() bb.toList foreach printInstruction - undent; println + undent(); println() } def printInstruction(i: Instruction) { diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala index a32b00f385..6a392449e0 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/TypeKinds.scala @@ -294,7 +294,7 @@ trait TypeKinds { self: ICodes => else ARRAY(ArrayN(elem, dims - 1)) } - final case class ARRAY(val elem: TypeKind) extends TypeKind { + final case class ARRAY(elem: TypeKind) extends TypeKind { override def toString = "ARRAY[" + elem + "]" override def isArrayType = true override def dimensions = 1 + elem.dimensions diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala index 7f32b2b764..941d200d13 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala @@ -123,7 +123,7 @@ abstract class CopyPropagation { } override def toString(): String = - "\nBindings: " + bindings + "\nStack: " + stack; + "\nBindings: " + bindings + "\nStack: " + stack def dup: State = { val b: Bindings = mutable.HashMap() @@ -164,7 +164,7 @@ abstract class CopyPropagation { val resBindings = mutable.HashMap[Location, Value]() for ((k, v) <- a.bindings if b.bindings.isDefinedAt(k) && v == b.bindings(k)) - resBindings += (k -> v); + resBindings += (k -> v) new State(resBindings, resStack) } } @@ -189,11 +189,11 @@ abstract class CopyPropagation { debuglog("CopyAnalysis added point: " + b) } m.exh foreach { e => - in(e.startBlock) = new copyLattice.State(copyLattice.emptyBinding, copyLattice.exceptionHandlerStack); + in(e.startBlock) = new copyLattice.State(copyLattice.emptyBinding, copyLattice.exceptionHandlerStack) } // first block is special: it's not bottom, but a precisely defined state with no bindings - in(m.startBlock) = new lattice.State(lattice.emptyBinding, Nil); + in(m.startBlock) = new lattice.State(lattice.emptyBinding, Nil) } } @@ -202,7 +202,7 @@ abstract class CopyPropagation { if (settings.debug.value) { linearizer.linearize(method).foreach(b => if (b != method.startBlock) assert(in(b) != lattice.bottom, - "Block " + b + " in " + this.method + " has input equal to bottom -- not visited?")); + "Block " + b + " in " + this.method + " has input equal to bottom -- not visited?")) } } @@ -227,7 +227,7 @@ abstract class CopyPropagation { case CONSTANT(k) => if (k.tag != UnitTag) - out.stack = Const(k) :: out.stack; + out.stack = Const(k) :: out.stack case LOAD_ARRAY_ITEM(_) => out.stack = (Unknown :: out.stack.drop(2)) @@ -276,14 +276,14 @@ abstract class CopyPropagation { v match { case Deref(LocalVar(other)) => if (other != local) - out.bindings += (LocalVar(local) -> v); + out.bindings += (LocalVar(local) -> v) case _ => out.bindings += (LocalVar(local) -> v) } case Nil => sys.error("Incorrect icode in " + method + ". Expecting something on the stack.") } - out.stack = out.stack drop 1; + out.stack = out.stack drop 1 case STORE_THIS(_) => cleanReferencesTo(out, This) @@ -291,14 +291,14 @@ abstract class CopyPropagation { case STORE_FIELD(field, isStatic) => if (isStatic) - out.stack = out.stack.drop(1); + out.stack = out.stack.drop(1) else { - out.stack = out.stack.drop(2); - cleanReferencesTo(out, Field(AllRecords, field)); + out.stack = out.stack.drop(2) + cleanReferencesTo(out, Field(AllRecords, field)) in.stack match { case v :: Record(_, bindings) :: vs => bindings += (field -> v) - case _ => (); + case _ => () } } @@ -319,7 +319,7 @@ abstract class CopyPropagation { case Record(_, bindings) => for (v <- out.stack.take(method.info.paramTypes.length + 1) if v ne obj) { - bindings ++= getBindingsForPrimaryCtor(in, method); + bindings ++= getBindingsForPrimaryCtor(in, method) } case _ => () } @@ -390,7 +390,7 @@ abstract class CopyPropagation { out.stack = out.stack.head :: out.stack case MONITOR_ENTER() => - out.stack = out.stack.drop(1); + out.stack = out.stack.drop(1) case MONITOR_EXIT() => out.stack = out.stack.drop(1) @@ -438,7 +438,7 @@ abstract class CopyPropagation { case Deref(loc1) if (loc1 == target) => false case Boxed(loc1) if (loc1 == target) => false case rec @ Record(_, _) => - cleanRecord(rec); + cleanRecord(rec) true case _ => true }) && @@ -454,12 +454,12 @@ abstract class CopyPropagation { * If the method is impure, all bindings to record fields are cleared. */ final def simulateCall(state: copyLattice.State, method: Symbol, static: Boolean): copyLattice.State = { - val out = new copyLattice.State(state.bindings, state.stack); - out.stack = out.stack.drop(method.info.paramTypes.length + (if (static) 0 else 1)); + val out = new copyLattice.State(state.bindings, state.stack) + out.stack = out.stack.drop(method.info.paramTypes.length + (if (static) 0 else 1)) if (method.info.resultType != definitions.UnitClass.tpe && !method.isConstructor) - out.stack = Unknown :: out.stack; + out.stack = Unknown :: out.stack if (!isPureMethod(method)) - invalidateRecords(out); + invalidateRecords(out) out } @@ -500,8 +500,8 @@ abstract class CopyPropagation { * they are passed on the stack. It works for primary constructors. */ private def getBindingsForPrimaryCtor(in: copyLattice.State, ctor: Symbol): mutable.Map[Symbol, Value] = { - val paramAccessors = ctor.owner.constrParamAccessors; - var values = in.stack.take(1 + ctor.info.paramTypes.length).reverse.drop(1); + val paramAccessors = ctor.owner.constrParamAccessors + var values = in.stack.take(1 + ctor.info.paramTypes.length).reverse.drop(1) val bindings = mutable.HashMap[Symbol, Value]() debuglog("getBindings for: " + ctor + " acc: " + paramAccessors) @@ -527,8 +527,8 @@ abstract class CopyPropagation { // + " having acc: " + (paramAccessors map (_.tpe))+ " vs. params" + paramTypes // + "\n\t failed at pos " + i + " with " + p.tpe + " == " + paramTypes(i)) if (p.tpe == paramTypes(i)) - bindings += (p -> values.head); - values = values.tail; + bindings += (p -> values.head) + values = values.tail } debuglog("\t" + bindings) diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala index cc3a7eb876..704439e178 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/DataFlowAnalysis.scala @@ -30,7 +30,7 @@ trait DataFlowAnalysis[L <: SemiLattice] { /* Implement this function to initialize the worklist. */ def init(f: => Unit): Unit = { iterations = 0 - in.clear; out.clear; worklist.clear; visited.clear; + in.clear(); out.clear(); worklist.clear(); visited.clear() f } @@ -46,7 +46,7 @@ trait DataFlowAnalysis[L <: SemiLattice] { while (!worklist.isEmpty) { if (stat) iterations += 1 //Console.println("worklist in: " + worklist); - val point = worklist.iterator.next; worklist -= point; visited += point; + val point = worklist.iterator.next(); worklist -= point; visited += point //Console.println("taking out point: " + point + " worklist out: " + worklist); val output = f(point, in(point)) diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala index abda639dec..14b57f287f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala @@ -77,7 +77,7 @@ abstract class Liveness { if (settings.debug.value) { linearizer.linearize(method).foreach(b => if (b != method.startBlock) assert(lattice.bottom != in(b), - "Block " + b + " in " + this.method + " has input equal to bottom -- not visited?")); + "Block " + b + " in " + this.method + " has input equal to bottom -- not visited?")) } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala index 48755d4424..2d29e6b14f 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/ReachingDefinitions.scala @@ -147,7 +147,7 @@ abstract class ReachingDefinitions { "Block " + b + " in " + this.method + " has input equal to bottom -- not visited? " + in(b) + ": bot: " + lattice.bottom + "\nin(b) == bottom: " + (in(b) == lattice.bottom) - + "\nbottom == in(b): " + (lattice.bottom == in(b)))); + + "\nbottom == in(b): " + (lattice.bottom == in(b)))) } } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index c9d295a350..227c1064ea 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -131,15 +131,15 @@ abstract class TypeFlowAnalysis { init(m) } - def run = { - timer.start + def run() = { + timer.start() // icodes.lubs0 = 0 forwardAnalysis(blockTransfer) timer.stop if (settings.debug.value) { linearizer.linearize(method).foreach(b => if (b != method.startBlock) assert(visited.contains(b), - "Block " + b + " in " + this.method + " has input equal to bottom -- not visited? .." + visited)); + "Block " + b + " in " + this.method + " has input equal to bottom -- not visited? .." + visited)) } // log("" + method.symbol.fullName + " [" + method.code.blocks.size + " blocks] " // + "\n\t" + iterations + " iterations: " + t + " ms." @@ -207,7 +207,7 @@ abstract class TypeFlowAnalysis { case Test(_, kind, zero) => stack.pop if (!zero) { stack.pop } - stack push BOOL; + stack push BOOL case Comparison(_, _) => stack.pop2; stack push INT @@ -355,7 +355,7 @@ abstract class TypeFlowAnalysis { override def run { - timer.start + timer.start() forwardAnalysis(blockTransfer) timer.stop @@ -396,7 +396,7 @@ abstract class TypeFlowAnalysis { override def blockTransfer(b: BasicBlock, in: lattice.Elem): lattice.Elem = { var result = lattice.IState(new VarBinding(in.vars), new TypeStack(in.stack)) - val stopAt = if(isOnPerimeter(b)) lastInstruction(b) else null; + val stopAt = if(isOnPerimeter(b)) lastInstruction(b) else null var isPastLast = false var instrs = b.toList @@ -598,10 +598,10 @@ abstract class TypeFlowAnalysis { return } else if(staleOut.isEmpty && inlined.isEmpty && staleIn.isEmpty) { // this promotes invoking reinit if in doubt, no performance degradation will ensue! - return; + return } - worklist.clear // calling reinit(f: => Unit) would also clear visited, thus forgetting about blocks visited before reinit. + worklist.clear() // calling reinit(f: => Unit) would also clear visited, thus forgetting about blocks visited before reinit. // asserts conveying an idea what CFG shapes arrive here: // staleIn foreach (p => assert( !in.isDefinedAt(p), p)) @@ -665,14 +665,14 @@ abstract class TypeFlowAnalysis { override def forwardAnalysis(f: (P, lattice.Elem) => lattice.Elem): Unit = { while (!worklist.isEmpty && relevantBBs.nonEmpty) { if (stat) iterations += 1 - val point = worklist.iterator.next; worklist -= point; + val point = worklist.iterator.next(); worklist -= point if(relevantBBs(point)) { shrinkedWatchlist = false val output = f(point, in(point)) - visited += point; + visited += point if(isOnPerimeter(point)) { if(shrinkedWatchlist && !isWatching(point)) { - relevantBBs -= point; + relevantBBs -= point populatePerimeter() } } else { diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 45c366cc69..75a8dfff90 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -456,8 +456,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } def createJAttribute(name: String, b: Array[Byte], offset: Int, len: Int): asm.Attribute = { - val dest = new Array[Byte](len); - System.arraycopy(b, offset, dest, 0, len); + val dest = new Array[Byte](len) + System.arraycopy(b, offset, dest, 0, len) new asm.CustomAttr(name, dest) } @@ -606,7 +606,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def javaType(s: Symbol): asm.Type = { if (s.isMethod) { - val resT: asm.Type = if (s.isClassConstructor) asm.Type.VOID_TYPE else javaType(s.tpe.resultType); + val resT: asm.Type = if (s.isClassConstructor) asm.Type.VOID_TYPE else javaType(s.tpe.resultType) asm.Type.getMethodType( resT, (s.tpe.paramTypes map javaType): _*) } else { javaType(s.tpe) } } @@ -881,9 +881,9 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } def ubytesToCharArray(bytes: Array[Byte]): Array[Char] = { - val ca = new Array[Char](bytes.size) + val ca = new Array[Char](bytes.length) var idx = 0 - while(idx < bytes.size) { + while(idx < bytes.length) { val b: Byte = bytes(idx) assert((b & ~0x7f) == 0) ca(idx) = b.asInstanceOf[Char] @@ -900,7 +900,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { var prevOffset = 0 var offset = 0 var encLength = 0 - while(offset < bSeven.size) { + while(offset < bSeven.length) { val deltaEncLength = (if(bSeven(offset) == 0) 2 else 1) val newEncLength = encLength.toLong + deltaEncLength if(newEncLength >= 65535) { @@ -1297,7 +1297,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } val ps = c.symbol.info.parents - val superInterfaces0: List[Symbol] = if(ps.isEmpty) Nil else c.symbol.mixinClasses; + val superInterfaces0: List[Symbol] = if(ps.isEmpty) Nil else c.symbol.mixinClasses val superInterfaces = (superInterfaces0 ++ c.symbol.annotations.flatMap(ann => newParentForAttr(ann.symbol))).distinct if(superInterfaces.isEmpty) EMPTY_STRING_ARRAY @@ -1322,7 +1322,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { thisName = javaName(c.symbol) // the internal name of the class being emitted val ps = c.symbol.info.parents - val superClass: String = if(ps.isEmpty) JAVA_LANG_OBJECT.getInternalName else javaName(ps.head.typeSymbol); + val superClass: String = if(ps.isEmpty) JAVA_LANG_OBJECT.getInternalName else javaName(ps.head.typeSymbol) val ifaces = getSuperInterfaces(c) @@ -1437,7 +1437,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { assert(enclClass.isClass, enclClass) val sym = enclClass.primaryConstructor if (sym == NoSymbol) { - log("Ran out of room looking for an enclosing method for %s: no constructor here.".format(enclClass, clazz)) + log("Ran out of room looking for an enclosing method for %s: no constructor here.".format(enclClass)) } else { debuglog("enclosing method for %s is %s (in %s)".format(clazz, sym, enclClass)) res = EnclMethodEntry(javaName(enclClass), javaName(sym), javaType(sym)) @@ -1618,7 +1618,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { if (isParcelableClass) { addCreatorCode(lastBlock) } lastBlock emit RETURN(UNIT) - lastBlock.close + lastBlock.close() method = m jmethod = clinitMethod @@ -1680,7 +1680,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { val kind = toTypeKind(const.typeValue) val toPush: asm.Type = if (kind.isValueType) classLiteral(kind) - else javaType(kind); + else javaType(kind) mv.visitLdcInsn(toPush) case EnumTag => @@ -1703,7 +1703,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { */ object jcode { - import asm.Opcodes; + import asm.Opcodes final def boolconst(b: Boolean) { iconst(if(b) 1 else 0) } @@ -1798,8 +1798,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } def goTo(label: asm.Label) { jmethod.visitJumpInsn(Opcodes.GOTO, label) } - def emitIF(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIF, label) } - def emitIF_ICMP(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIFICMP, label) } + def emitIF(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIF(), label) } + def emitIF_ICMP(cond: TestOp, label: asm.Label) { jmethod.visitJumpInsn(cond.opcodeIFICMP(), label) } def emitIF_ACMP(cond: TestOp, label: asm.Label) { assert((cond == EQ) || (cond == NE), cond) val opc = (if(cond == EQ) Opcodes.IF_ACMPEQ else Opcodes.IF_ACMPNE) @@ -1867,10 +1867,10 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { // use a table in which holes are filled with defaultBranch. val keyRange = (keyMax - keyMin + 1) val newBranches = new Array[asm.Label](keyRange) - var oldPos = 0; + var oldPos = 0 var i = 0 while(i < keyRange) { - val key = keyMin + i; + val key = keyMin + i if (keys(oldPos) == key) { newBranches(i) = branches(oldPos) oldPos += 1 @@ -2069,7 +2069,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { // TODO in that case, ExceptionHandler.cls doesn't go through javaName(). What if cls is an inner class? for (e <- this.method.exh ; if e.covered.nonEmpty ; p <- intervals(e)) { debuglog("Adding exception handler " + e + "at block: " + e.startBlock + " for " + method + - " from: " + p.start + " to: " + p.end + " catching: " + e.cls); + " from: " + p.start + " to: " + p.end + " catching: " + e.cls) val cls: String = if (e.cls == NoSymbol || e.cls == ThrowableClass) null else javaName(e.cls) jmethod.visitTryCatchBlock(labels(p.start), linNext(p.end), labels(e.startBlock), cls) @@ -2093,8 +2093,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def overlaps(that: Interval): Boolean = { !(this.precedes(that) || that.precedes(this)) } def mergeWith(that: Interval): Interval = { - val newStart = if(this.start <= that.start) this.lstart else that.lstart; - val newEnd = if(this.end <= that.end) that.lend else this.lend; + val newStart = if(this.start <= that.start) this.lstart else that.lstart + val newEnd = if(this.end <= that.end) that.lend else this.lend Interval(newStart, newEnd) } @@ -2150,7 +2150,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def getMerged(): scala.collection.Map[Local, List[Interval]] = { // TODO should but isn't: unbalanced start(s) of scope(s) - val shouldBeEmpty = pending filter { p => val Pair(_, st) = p; st.nonEmpty }; + val shouldBeEmpty = pending filter { p => val Pair(_, st) = p; st.nonEmpty } val merged = mutable.Map[Local, List[Interval]]() def addToMerged(lv: Local, start: Label, end: Label) { val intv = Interval(start, end) @@ -2168,10 +2168,10 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { if(merged.isDefinedAt(k)) { val balancedStart = merged(k).head.lstart if(balancedStart.getOffset < start.getOffset) { - start = balancedStart; + start = balancedStart } } - val endOpt: Option[Label] = for(ranges <- merged.get(k)) yield ranges.last.lend; + val endOpt: Option[Label] = for(ranges <- merged.get(k)) yield ranges.last.lend val end = endOpt.getOrElse(onePastLast) addToMerged(k, start, end) } @@ -2204,7 +2204,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { for(Pair(local, ranges) <- scoping.getMerged()) { var name = javaName(local.sym) if (name == null) { - anonCounter += 1; + anonCounter += 1 name = "<anon" + anonCounter + ">" } for(intrvl <- ranges) { @@ -2365,14 +2365,14 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { scoping.popScope(lv, end, instr.pos) } } - genLocalInstr + genLocalInstr() case icodes.stackCat => def genStackInstr() = (instr: @unchecked) match { case LOAD_MODULE(module) => // assert(module.isModule, "Expected module: " + module) - debuglog("generating LOAD_MODULE for: " + module + " flags: " + module.flagString); + debuglog("generating LOAD_MODULE for: " + module + " flags: " + module.flagString) if (clasz.symbol == module.moduleClass && jMethodName != nme.readResolve.toString) { jmethod.visitVarInsn(Opcodes.ALOAD, 0) } else { @@ -2389,7 +2389,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { case LOAD_EXCEPTION(_) => () } - genStackInstr + genStackInstr() case icodes.constCat => genConstant(jmethod, instr.asInstanceOf[CONSTANT].constant) @@ -2423,7 +2423,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } } - genCastInstr + genCastInstr() case icodes.objsCat => def genObjsInstr() = (instr: @unchecked) match { @@ -2442,7 +2442,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { case MONITOR_ENTER() => emit(Opcodes.MONITORENTER) case MONITOR_EXIT() => emit(Opcodes.MONITOREXIT) } - genObjsInstr + genObjsInstr() case icodes.fldsCat => def genFldsInstr() = (instr: @unchecked) match { @@ -2463,7 +2463,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { jmethod.visitFieldInsn(opc, owner, fieldJName, fieldDescr) } - genFldsInstr + genFldsInstr() case icodes.mthdsCat => def genMethodsInstr() = (instr: @unchecked) match { @@ -2476,7 +2476,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { case call @ CALL_METHOD(method, style) => genCallMethod(call) } - genMethodsInstr + genMethodsInstr() case icodes.arraysCat => def genArraysInstr() = (instr: @unchecked) match { @@ -2485,7 +2485,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { case CREATE_ARRAY(elem, 1) => jcode newarray elem case CREATE_ARRAY(elem, dims) => jmethod.visitMultiANewArrayInsn(descriptor(ArrayN(elem, dims)), dims) } - genArraysInstr + genArraysInstr() case icodes.jumpsCat => def genJumpInstr() = (instr: @unchecked) match { @@ -2502,7 +2502,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { while (restTagss.nonEmpty) { val currLabel = labels(restBranches.head) for (cTag <- restTagss.head) { - flatKeys(k) = cTag; + flatKeys(k) = cTag flatBranches(k) = currLabel k += 1 } @@ -2535,7 +2535,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { case CJUMP(success, failure, cond, kind) => if (kind.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT if (nextBlock == success) { - jcode.emitIF_ICMP(cond.negate, labels(failure)) + jcode.emitIF_ICMP(cond.negate(), labels(failure)) // .. and fall through to success label } else { jcode.emitIF_ICMP(cond, labels(success)) @@ -2543,7 +2543,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } } else if (kind.isRefOrArrayType) { // REFERENCE(_) | ARRAY(_) if (nextBlock == success) { - jcode.emitIF_ACMP(cond.negate, labels(failure)) + jcode.emitIF_ACMP(cond.negate(), labels(failure)) // .. and fall through to success label } else { jcode.emitIF_ACMP(cond, labels(success)) @@ -2560,7 +2560,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { else emit(Opcodes.DCMPL) } if (nextBlock == success) { - jcode.emitIF(cond.negate, labels(failure)) + jcode.emitIF(cond.negate(), labels(failure)) // .. and fall through to success label } else { jcode.emitIF(cond, labels(success)) @@ -2571,7 +2571,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { case CZJUMP(success, failure, cond, kind) => if (kind.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT if (nextBlock == success) { - jcode.emitIF(cond.negate, labels(failure)) + jcode.emitIF(cond.negate(), labels(failure)) } else { jcode.emitIF(cond, labels(success)) if (nextBlock != failure) { jcode goTo labels(failure) } @@ -2607,7 +2607,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { else emit(Opcodes.DCMPL) } if (nextBlock == success) { - jcode.emitIF(cond.negate, labels(failure)) + jcode.emitIF(cond.negate(), labels(failure)) } else { jcode.emitIF(cond, labels(success)) if (nextBlock != failure) { jcode goTo labels(failure) } @@ -2615,14 +2615,14 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } } - genJumpInstr + genJumpInstr() case icodes.retCat => def genRetInstr() = (instr: @unchecked) match { case RETURN(kind) => jcode emitRETURN kind case THROW(_) => emit(Opcodes.ATHROW) } - genRetInstr + genRetInstr() } } @@ -2701,7 +2701,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def genPrimitive(primitive: Primitive, pos: Position) { - import asm.Opcodes; + import asm.Opcodes primitive match { @@ -2732,7 +2732,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { abort("Unknown arithmetic primitive " + primitive) } } - genArith + genArith() // TODO Logical's 2nd elem should be declared ValueTypeKind, to better approximate its allowed values (isIntSized, its comments appears to convey) // TODO GenICode uses `toTypeKind` to define that elem, `toValueTypeKind` would be needed instead. @@ -2764,7 +2764,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { if (kind != BOOL) { emitT2T(INT, kind) } } } - genLogical + genLogical() case Shift(op, kind) => def genShift() = op match { @@ -2793,7 +2793,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { emitT2T(INT, kind) } } - genShift + genShift() case Comparison(op, kind) => def genCompare() = op match { @@ -2813,7 +2813,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } } - genCompare + genCompare() case Conversion(src, dst) => debuglog("Converting from: " + src + " to: " + dst) @@ -2879,7 +2879,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { * *Does not assume the parameters come first!* */ def computeLocalVarsIndex(m: IMethod) { - var idx = if (m.symbol.isStaticMember) 0 else 1; + var idx = if (m.symbol.isStaticMember) 0 else 1 for (l <- m.params) { debuglog("Index value for " + l + "{" + l.## + "}: " + idx) @@ -2901,7 +2901,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { class JMirrorBuilder(bytecodeWriter: BytecodeWriter) extends JCommonBuilder(bytecodeWriter) { private var cunit: CompilationUnit = _ - def getCurrentCUnit(): CompilationUnit = cunit; + def getCurrentCUnit(): CompilationUnit = cunit /** Generate a mirror class for a top-level module. A mirror class is a class * containing only static methods that forward to the corresponding method @@ -2994,8 +2994,8 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { for (f <- clasz.fields if f.symbol.hasGetter; g = f.symbol.getter(clasz.symbol); - s = f.symbol.setter(clasz.symbol); - if g.isPublic && !(f.symbol.name startsWith "$") + s = f.symbol.setter(clasz.symbol) + if g.isPublic && !(f.symbol.name startsWith "$") ) { // inserting $outer breaks the bean fieldList = javaName(f.symbol) :: javaName(g) :: (if (s != NoSymbol) javaName(s) else null) :: fieldList @@ -3180,7 +3180,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { // leave infinite-loops in place return (dest, hops filterNot (dest eq _)) } - prev = dest; + prev = dest false case None => true } @@ -3268,11 +3268,11 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { /* remove from all containers that may contain a reference to */ def elide(redu: BasicBlock) { assert(m.startBlock != redu, "startBlock should have been re-wired by now") - m.code.removeBlock(redu); + m.code.removeBlock(redu) } var wasReduced = false - val entryPoints: List[BasicBlock] = m.startBlock :: (m.exh map (_.startBlock)); + val entryPoints: List[BasicBlock] = m.startBlock :: (m.exh map (_.startBlock)) val elided = mutable.Set.empty[BasicBlock] // debug val newTargets = mutable.Set.empty[BasicBlock] // debug @@ -3303,7 +3303,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def normalize(m: IMethod) { if(!m.hasCode) { return } collapseJumpOnlyBlocks(m) - var wasReduced = false; + var wasReduced = false do { wasReduced = false // Prune from an exception handler those covered blocks which are jump-only. diff --git a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala index 5dd20a6919..8f439fc800 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala @@ -96,7 +96,7 @@ abstract class ClosureElimination extends SubComponent { /* Some embryonic copy propagation. */ def analyzeMethod(m: IMethod): Unit = try {if (m.hasCode) { cpp.init(m) - cpp.run + cpp.run() m.linearizedBlocks() foreach { bb => var info = cpp.in(bb) @@ -108,7 +108,7 @@ abstract class ClosureElimination extends SubComponent { val t = info.getBinding(l) t match { case Deref(This) | Const(_) => - bb.replaceInstruction(i, valueToInstruction(t)); + bb.replaceInstruction(i, valueToInstruction(t)) debuglog(s"replaced $i with $t") case _ => @@ -200,7 +200,7 @@ abstract class ClosureElimination extends SubComponent { def apply(m: IMethod): Unit = if (m.hasCode) { liveness = new global.icodes.liveness.LivenessAnalysis liveness.init(m) - liveness.run + liveness.run() m foreachBlock transformBlock } @@ -226,7 +226,7 @@ abstract class ClosureElimination extends SubComponent { h = t.head t = t.tail } - } while (redo); + } while (redo) b fromList newInstructions } } diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala index 20e1cd2188..3b94e2bd8d 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala @@ -54,7 +54,7 @@ abstract class DeadCodeElimination extends SubComponent { } } - val rdef = new reachingDefinitions.ReachingDefinitionsAnalysis; + val rdef = new reachingDefinitions.ReachingDefinitionsAnalysis /** Use-def chain: give the reaching definitions at the beginning of given instruction. */ var defs: immutable.Map[InstrLoc, immutable.Set[rdef.lattice.Definition]] = immutable.HashMap.empty @@ -82,7 +82,7 @@ abstract class DeadCodeElimination extends SubComponent { def dieCodeDie(m: IMethod) { if (m.hasCode) { - debuglog("dead code elimination on " + m); + debuglog("dead code elimination on " + m) dropOf.clear() localStores.clear() clobbers.clear() @@ -104,13 +104,13 @@ abstract class DeadCodeElimination extends SubComponent { /** collect reaching definitions and initial useful instructions for this method. */ def collectRDef(m: IMethod): Unit = if (m.hasCode) { - defs = immutable.HashMap.empty; worklist.clear(); useful.clear(); - rdef.init(m); - rdef.run; + defs = immutable.HashMap.empty; worklist.clear(); useful.clear() + rdef.init(m) + rdef.run() m foreachBlock { bb => useful(bb) = new mutable.BitSet(bb.size) - var rd = rdef.in(bb); + var rd = rdef.in(bb) for (Pair(i, idx) <- bb.toList.zipWithIndex) { // utility for adding to worklist @@ -340,8 +340,8 @@ abstract class DeadCodeElimination extends SubComponent { m foreachBlock { bb => debuglog(bb + ":") val oldInstr = bb.toList - bb.open - bb.clear + bb.open() + bb.clear() for (Pair(i, idx) <- oldInstr.zipWithIndex) { if (useful(bb)(idx)) { debuglog(" * " + i + " is useful") @@ -374,7 +374,7 @@ abstract class DeadCodeElimination extends SubComponent { } } - if (bb.nonEmpty) bb.close + if (bb.nonEmpty) bb.close() else log(s"empty block encountered in $m") } } diff --git a/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala b/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala index 4e65c72b0b..dcf0590951 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/InlineExceptionHandlers.scala @@ -69,9 +69,9 @@ abstract class InlineExceptionHandlers extends SubComponent { * -some exception handler duplicates expect the exception on the stack while others expect it in a local * => Option[Local] */ - private val handlerCopies = perRunCaches.newMap[BasicBlock, Option[(Option[Local], BasicBlock)]] + private val handlerCopies = perRunCaches.newMap[BasicBlock, Option[(Option[Local], BasicBlock)]]() /* This map is the inverse of handlerCopies, used to compute the stack of duplicate blocks */ - private val handlerCopiesInverted = perRunCaches.newMap[BasicBlock, (BasicBlock, TypeKind)] + private val handlerCopiesInverted = perRunCaches.newMap[BasicBlock, (BasicBlock, TypeKind)]() private def handlerLocal(bb: BasicBlock): Option[Local] = for (v <- handlerCopies get bb ; (local, block) <- v ; l <- local) yield l @@ -262,7 +262,7 @@ abstract class InlineExceptionHandlers extends SubComponent { if (analyzedMethod eq NoIMethod) { analyzedMethod = bblock.method tfa.init(bblock.method) - tfa.run + tfa.run() log(" performed tfa on method: " + bblock.method) for (block <- bblock.method.blocks.sortBy(_.label)) @@ -357,7 +357,7 @@ abstract class InlineExceptionHandlers extends SubComponent { } val caughtException = toTypeKind(caughtClass.tpe) // copy the exception handler code once again, dropping the LOAD_EXCEPTION - val copy = handler.code.newBlock + val copy = handler.code.newBlock() copy.emitOnly((handler.iterator drop dropCount).toSeq: _*) // extend the handlers of the handler to the copy diff --git a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala index ca1cfc8929..d183b3a291 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/Inliners.scala @@ -232,7 +232,7 @@ abstract class Inliners extends SubComponent { val hasRETURN = containsRETURN(incm.code.blocksList) || (incm.exh exists { eh => containsRETURN(eh.blocks) }) var a: analysis.MethodTFA = null - if(hasRETURN) { a = new analysis.MethodTFA(incm); a.run } + if(hasRETURN) { a = new analysis.MethodTFA(incm); a.run() } if(forceable) { recentTFAs.put(incm.symbol, (hasRETURN, a)) } @@ -242,7 +242,7 @@ abstract class Inliners extends SubComponent { def clearCaches() { // methods NonPublicRefs.usesNonPublics.clear() - recentTFAs.clear + recentTFAs.clear() tfa.knownUnsafe.clear() tfa.knownSafe.clear() tfa.knownNever.clear() @@ -363,7 +363,7 @@ abstract class Inliners extends SubComponent { assert(ocm.method.isEffectivelyFinal && ocm.method.owner.isEffectivelyFinal) if(analyzeInc(ocm, x, ocm.method.owner, -1, ocm.method)) { inlineCount += 1 - break + break() } } } @@ -513,7 +513,7 @@ abstract class Inliners extends SubComponent { for (cm <- cms; if tfa.remainingCALLs.isDefinedAt(cm)) { val analysis.CallsiteInfo(_, receiver, stackLength, concreteMethod) = tfa.remainingCALLs(cm) if (analyzeInc(cm, bb, receiver, stackLength, concreteMethod)) { - break + break() } } } @@ -568,7 +568,7 @@ abstract class Inliners extends SubComponent { warn(inlFail.pos, "At the end of the day, could not inline @inline-marked method " + inlFail.method.originalName.decode) } - m.normalize + m.normalize() if (sizeBeforeInlining > 0) { val instrAfterInlining = m.code.instructionCount val inlinings = caller.inlinedCalls @@ -811,7 +811,7 @@ abstract class Inliners extends SubComponent { /** Add a new block in the current context. */ def newBlock() = { - val b = caller.m.code.newBlock + val b = caller.m.code.newBlock() activeHandlers foreach (_ addCoveredBlock b) if (retVal ne null) b.varsInScope += retVal b.varsInScope += inlinedThis @@ -890,8 +890,8 @@ abstract class Inliners extends SubComponent { } // re-emit the instructions before the call - block.open - block.clear + block.open() + block.clear() block emit instrBefore // store the arguments into special locals @@ -900,7 +900,7 @@ abstract class Inliners extends SubComponent { // jump to the start block of the callee blockEmit(JUMP(inlinedBlock(inc.m.startBlock))) - block.close + block.close() // duplicate the other blocks in the callee val calleeLin = inc.m.linearizedBlocks() @@ -923,11 +923,11 @@ abstract class Inliners extends SubComponent { emitInlined(map(i)) info = if(hasRETURN) a.interpret(info, i) else null } - inlinedBlock(bb).close + inlinedBlock(bb).close() } afterBlock emit instrAfter - afterBlock.close + afterBlock.close() staleIn += afterBlock splicedBlocks ++= (calleeLin map inlinedBlock) @@ -969,7 +969,7 @@ abstract class Inliners extends SubComponent { } if(sameSymbols) { // TODO but this also amounts to recursive, ie should lead to adding to tfa.knownNever, right? - tfa.knownUnsafe += inc.sym; + tfa.knownUnsafe += inc.sym return DontInlineHere("sameSymbols (ie caller == callee)") } @@ -1043,9 +1043,9 @@ abstract class Inliners extends SubComponent { if (caller.isInClosure) score -= 2 else if (caller.inlinedCalls < 1) score -= 1 // only monadic methods can trigger the first inline - if (inc.isSmall) score += 1; + if (inc.isSmall) score += 1 // if (inc.hasClosureParam) score += 2 - if (inc.isLarge) score -= 1; + if (inc.isLarge) score -= 1 if (caller.isSmall && isLargeSum) { score -= 1 debuglog(s"inliner score decreased to $score because small caller $caller would become large") @@ -1054,8 +1054,8 @@ abstract class Inliners extends SubComponent { if (inc.isMonadic) score += 3 else if (inc.isHigherOrder) score += 1 - if (inc.isInClosure) score += 2; - if (inlinedMethodCount(inc.sym) > 2) score -= 2; + if (inc.isInClosure) score += 2 + if (inlinedMethodCount(inc.sym) > 2) score -= 2 score } } diff --git a/src/compiler/scala/tools/nsc/dependencies/Changes.scala b/src/compiler/scala/tools/nsc/dependencies/Changes.scala index 7807f0ba03..531348b451 100644 --- a/src/compiler/scala/tools/nsc/dependencies/Changes.scala +++ b/src/compiler/scala/tools/nsc/dependencies/Changes.scala @@ -168,7 +168,7 @@ abstract class Changes { implicit val defaultStrictTypeRefTest = true val to = toSym.info - changedTypeParams.clear + changedTypeParams.clear() def omitSymbols(s: Symbol): Boolean = !s.hasFlag(LOCAL | LIFTED | PRIVATE | SYNTHETIC) val cs = new mutable.ListBuffer[Change] diff --git a/src/compiler/scala/tools/nsc/doc/DocFactory.scala b/src/compiler/scala/tools/nsc/doc/DocFactory.scala index a99b17dce4..f203a5eeb7 100644 --- a/src/compiler/scala/tools/nsc/doc/DocFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/DocFactory.scala @@ -14,7 +14,7 @@ import scala.reflect.internal.util.BatchSourceFile * documentation, which is as follows. * * * A simplified compiler instance (with only the front-end phases enabled) - * * is created, and additional ''sourceless'' comments are registered. + * * is created, and additional `sourceless` comments are registered. * * Documentable files are compiled, thereby filling the compiler's symbol table. * * A documentation model is extracted from the post-compilation symbol table. * * A generator is used to transform the model into the correct final format (HTML). @@ -118,7 +118,7 @@ class DocFactory(val reporter: Reporter, val settings: doc.Settings) { processor } case _ => () } - docletInstance.generate + docletInstance.generate() } try generate() diff --git a/src/compiler/scala/tools/nsc/doc/Settings.scala b/src/compiler/scala/tools/nsc/doc/Settings.scala index 75312e2279..90b94e1336 100644 --- a/src/compiler/scala/tools/nsc/doc/Settings.scala +++ b/src/compiler/scala/tools/nsc/doc/Settings.scala @@ -11,7 +11,7 @@ import scala.language.postfixOps /** An extended version of compiler settings, with additional Scaladoc-specific options. * @param error A function that prints a string to the appropriate error stream - * @param print A function that prints the string, without any extra boilerplate of error */ + * @param printMsg A function that prints the string, without any extra boilerplate of error */ class Settings(error: String => Unit, val printMsg: String => Unit = println(_)) extends scala.tools.nsc.Settings(error) { /** A setting that defines in which format the documentation is output. ''Note:'' this setting is currently always diff --git a/src/compiler/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/compiler/scala/tools/nsc/doc/base/CommentFactoryBase.scala index c2b3c410fe..a308292811 100755 --- a/src/compiler/scala/tools/nsc/doc/base/CommentFactoryBase.scala +++ b/src/compiler/scala/tools/nsc/doc/base/CommentFactoryBase.scala @@ -17,8 +17,6 @@ import scala.language.postfixOps * Call `parse` to run the parser. Note that the parser is stateless and * should only be built once for a given Scaladoc run. * - * @param reporter The reporter on which user messages (error, warnings) should be printed. - * * @author Manohar Jonnalagedda * @author Gilles Dubochet */ trait CommentFactoryBase { this: MemberLookupBase => @@ -516,7 +514,7 @@ trait CommentFactoryBase { this: MemberLookupBase => else { val s = summary() val r = - if (checkParaEnded) List(s) else List(s, inline(false)) + if (checkParaEnded()) List(s) else List(s, inline(false)) summaryParsed = true Paragraph(Chain(r)) } diff --git a/src/compiler/scala/tools/nsc/doc/doclet/Generator.scala b/src/compiler/scala/tools/nsc/doc/doclet/Generator.scala index 735b79c336..42b56aa927 100644 --- a/src/compiler/scala/tools/nsc/doc/doclet/Generator.scala +++ b/src/compiler/scala/tools/nsc/doc/doclet/Generator.scala @@ -21,7 +21,7 @@ abstract class Generator { /** Outputs documentation (as a side effect). */ def generate(): Unit = { assert(checks forall { check => check() }) - generateImpl + generateImpl() } /** Outputs documentation (as a side effect). This method is called only if all `checks` are true. */ diff --git a/src/compiler/scala/tools/nsc/doc/html/Doclet.scala b/src/compiler/scala/tools/nsc/doc/html/Doclet.scala index 3aa3e87554..21c5f6bb67 100644 --- a/src/compiler/scala/tools/nsc/doc/html/Doclet.scala +++ b/src/compiler/scala/tools/nsc/doc/html/Doclet.scala @@ -13,7 +13,7 @@ import doclet._ class Doclet extends Generator with Universer with Indexer { def generateImpl() { - new html.HtmlFactory(universe, index).generate + new html.HtmlFactory(universe, index).generate() } } diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala index 4630c3dda8..d721a96ad7 100644 --- a/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/html/HtmlFactory.scala @@ -103,7 +103,7 @@ class HtmlFactory(val universe: doc.Universe, index: doc.Index) { /** Generates the Scaladoc site for a model into the site root. * A scaladoc site is a set of HTML and related files * that document a model extracted from a compiler run. - * @param model The model to generate in the form of a sequence of packages. */ + */ def generate() { def copyResource(subPath: String) { @@ -111,7 +111,7 @@ class HtmlFactory(val universe: doc.Universe, index: doc.Index) { val p = "/scala/tools/nsc/doc/html/resource/" + subPath val inputStream = getClass.getResourceAsStream(p) assert(inputStream != null, p) - }.toByteArray + }.toByteArray() val dest = Directory(siteRoot) / subPath dest.parent.createDirectory() val out = dest.toFile.bufferedOutput() diff --git a/src/compiler/scala/tools/nsc/doc/html/Page.scala b/src/compiler/scala/tools/nsc/doc/html/Page.scala index ef9beb1dce..91939cf3de 100644 --- a/src/compiler/scala/tools/nsc/doc/html/Page.scala +++ b/src/compiler/scala/tools/nsc/doc/html/Page.scala @@ -45,7 +45,7 @@ abstract class Page { /** Writes this page as a file. The file's location is relative to the * generator's site root, and the encoding is also defined by the generator. - * @param generator The generator that is writing this page. */ + * @param site The generator that is writing this page. */ def writeFor(site: HtmlFactory): Unit def kindToString(mbr: MemberEntity) = @@ -84,7 +84,7 @@ abstract class Page { } /** A relative link from this page to some destination class entity. - * @param destEntity The class or object entity that the link will point to. */ + * @param destClass The class or object entity that the link will point to. */ def relativeLinkTo(destClass: TemplateEntity): String = relativeLinkTo(templateToPath(destClass)) diff --git a/src/compiler/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala b/src/compiler/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala index 512becd04d..92dd05e70a 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala @@ -31,7 +31,7 @@ class DotDiagramGenerator(settings: doc.Settings) extends DiagramGenerator { private var counter = 0 def generate(diagram: Diagram, template: DocTemplateEntity, page: HtmlPage):NodeSeq = { - counter = counter + 1; + counter = counter + 1 this.page = page pathToLib = "../" * (page.templateToPath(template).size - 1) + "lib/" val dot = generateDot(diagram) @@ -207,7 +207,7 @@ class DotDiagramGenerator(settings: doc.Settings) extends DiagramGenerator { private def node2Dot(node: Node) = { // escape HTML characters in node names - def escape(name: String) = name.replace("&", "&").replace("<", "<").replace(">", ">"); + def escape(name: String) = name.replace("&", "&").replace("<", "<").replace(">", ">") // assemble node attribues in a map val attr = scala.collection.mutable.Map[String, String]() @@ -315,11 +315,11 @@ class DotDiagramGenerator(settings: doc.Settings) extends DiagramGenerator { * Calls dot with a given dot string and returns the SVG output. */ private def generateSVG(dotInput: String, template: DocTemplateEntity) = { - val dotOutput = DiagramGenerator.getDotRunner.feedToDot(dotInput, template) + val dotOutput = DiagramGenerator.getDotRunner().feedToDot(dotInput, template) var tSVG = -System.currentTimeMillis val result = if (dotOutput != null) { - val src = scala.io.Source.fromString(dotOutput); + val src = scala.io.Source.fromString(dotOutput) try { val cpa = scala.xml.parsing.ConstructingParser.fromSource(src, false) val doc = cpa.document() diff --git a/src/compiler/scala/tools/nsc/doc/model/CommentFactory.scala b/src/compiler/scala/tools/nsc/doc/model/CommentFactory.scala index 9ba89146c0..574d6b04f8 100644 --- a/src/compiler/scala/tools/nsc/doc/model/CommentFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/CommentFactory.scala @@ -18,8 +18,6 @@ import scala.language.postfixOps * Call `parse` to run the parser. Note that the parser is stateless and * should only be built once for a given Scaladoc run. * - * @param reporter The reporter on which user messages (error, warnings) should be printed. - * * @author Manohar Jonnalagedda * @author Gilles Dubochet */ trait CommentFactory extends base.CommentFactoryBase { diff --git a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala index 303fe9f184..1df725636a 100644 --- a/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala +++ b/src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala @@ -51,7 +51,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { } _modelFinished = true // complete the links between model entities, everthing that couldn't have been done before - universe.rootPackage.completeModel + universe.rootPackage.completeModel() Some(universe) filter (_.rootPackage != null) } @@ -382,7 +382,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { if (!sym.isAliasType && !sym.isAbstractType) for (member <- members) member match { - case d: DocTemplateImpl => d.completeModel + case d: DocTemplateImpl => d.completeModel() case _ => } @@ -631,7 +631,7 @@ class ModelFactory(val global: Global, val settings: doc.Settings) { import Streamable._ Path(settings.docRootContent.value) match { case f : File => { - val rootComment = closing(f.inputStream)(is => parse(slurp(is), "", NoPosition, Option(inTpl))) + val rootComment = closing(f.inputStream())(is => parse(slurp(is), "", NoPosition, Option(inTpl))) Some(rootComment) } case _ => None diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala index f10c00b8e0..a81604235b 100644 --- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala +++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala @@ -233,9 +233,6 @@ trait CompilerControl { self: Global => * prints its output and all defined values in a comment column. * * @param source The source file to be analyzed - * @param keepLoaded If set to `true`, source file will be kept as a loaded unit afterwards. - * If keepLoaded is `false` the operation is run at low priority, only after - * everything is brought up to date in a regular type checker run. * @param response The response. */ @deprecated("SI-6458: Instrumentation logic will be moved out of the compiler.","2.10.0") @@ -337,7 +334,7 @@ trait CompilerControl { self: Global => response raise new MissingResponse } - case class AskTypeAtItem(val pos: Position, response: Response[Tree]) extends WorkItem { + case class AskTypeAtItem(pos: Position, response: Response[Tree]) extends WorkItem { def apply() = self.getTypedTreeAt(pos, response) override def toString = "typeat "+pos.source+" "+pos.show @@ -345,7 +342,7 @@ trait CompilerControl { self: Global => response raise new MissingResponse } - case class AskTypeItem(val source: SourceFile, val forceReload: Boolean, response: Response[Tree]) extends WorkItem { + case class AskTypeItem(source: SourceFile, forceReload: Boolean, response: Response[Tree]) extends WorkItem { def apply() = self.getTypedTree(source, forceReload, response) override def toString = "typecheck" @@ -353,7 +350,7 @@ trait CompilerControl { self: Global => response raise new MissingResponse } - case class AskTypeCompletionItem(val pos: Position, response: Response[List[Member]]) extends WorkItem { + case class AskTypeCompletionItem(pos: Position, response: Response[List[Member]]) extends WorkItem { def apply() = self.getTypeCompletion(pos, response) override def toString = "type completion "+pos.source+" "+pos.show @@ -361,7 +358,7 @@ trait CompilerControl { self: Global => response raise new MissingResponse } - case class AskScopeCompletionItem(val pos: Position, response: Response[List[Member]]) extends WorkItem { + case class AskScopeCompletionItem(pos: Position, response: Response[List[Member]]) extends WorkItem { def apply() = self.getScopeCompletion(pos, response) override def toString = "scope completion "+pos.source+" "+pos.show @@ -379,7 +376,7 @@ trait CompilerControl { self: Global => def raiseMissing() = () } - case class AskLinkPosItem(val sym: Symbol, val source: SourceFile, response: Response[Position]) extends WorkItem { + case class AskLinkPosItem(sym: Symbol, source: SourceFile, response: Response[Position]) extends WorkItem { def apply() = self.getLinkPos(sym, source, response) override def toString = "linkpos "+sym+" in "+source @@ -387,7 +384,7 @@ trait CompilerControl { self: Global => response raise new MissingResponse } - case class AskDocCommentItem(val sym: Symbol, val site: Symbol, val source: SourceFile, response: Response[(String, String, Position)]) extends WorkItem { + case class AskDocCommentItem(sym: Symbol, site: Symbol, source: SourceFile, response: Response[(String, String, Position)]) extends WorkItem { def apply() = self.getDocComment(sym, site, source, response) override def toString = "doc comment "+sym+" in "+source @@ -395,7 +392,7 @@ trait CompilerControl { self: Global => response raise new MissingResponse } - case class AskLoadedTypedItem(val source: SourceFile, response: Response[Tree]) extends WorkItem { + case class AskLoadedTypedItem(source: SourceFile, response: Response[Tree]) extends WorkItem { def apply() = self.waitLoadedTyped(source, response, this.onCompilerThread) override def toString = "wait loaded & typed "+source @@ -403,7 +400,7 @@ trait CompilerControl { self: Global => response raise new MissingResponse } - case class AskParsedEnteredItem(val source: SourceFile, val keepLoaded: Boolean, response: Response[Tree]) extends WorkItem { + case class AskParsedEnteredItem(source: SourceFile, keepLoaded: Boolean, response: Response[Tree]) extends WorkItem { def apply() = self.getParsedEntered(source, keepLoaded, response, this.onCompilerThread) override def toString = "getParsedEntered "+source+", keepLoaded = "+keepLoaded @@ -412,7 +409,7 @@ trait CompilerControl { self: Global => } @deprecated("SI-6458: Instrumentation logic will be moved out of the compiler.","2.10.0") - case class AskInstrumentedItem(val source: SourceFile, line: Int, response: Response[(String, Array[Char])]) extends WorkItem { + case class AskInstrumentedItem(source: SourceFile, line: Int, response: Response[(String, Array[Char])]) extends WorkItem { def apply() = self.getInstrumented(source, line, response) override def toString = "getInstrumented "+source diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index b0318f40c4..fa1d4a38b9 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -366,7 +366,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") .format(waitLoadedTypeResponses.size, getParsedEnteredResponses.size)) checkNoResponsesOutstanding() - log.flush(); + log.flush() scheduler = new NoWorkScheduler throw ShutdownReq } @@ -1025,7 +1025,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") getUnit(source) match { case Some(unit) => if (unit.isUpToDate) { - debugLog("already typed"); + debugLog("already typed") response set unit.body } else if (ignoredFiles(source.file)) { response.raise(lastException.getOrElse(CancelException)) diff --git a/src/compiler/scala/tools/nsc/interactive/REPL.scala b/src/compiler/scala/tools/nsc/interactive/REPL.scala index d545a5738c..71dd0d3bbf 100644 --- a/src/compiler/scala/tools/nsc/interactive/REPL.scala +++ b/src/compiler/scala/tools/nsc/interactive/REPL.scala @@ -51,8 +51,8 @@ object REPL { } catch { case ex @ FatalError(msg) => if (true || command.settings.debug.value) // !!! - ex.printStackTrace(); - reporter.error(null, "fatal error: " + msg) + ex.printStackTrace() + reporter.error(null, "fatal error: " + msg) } } } @@ -65,7 +65,7 @@ object REPL { def loop(action: (String) => Unit) { Console.print(prompt) try { - val line = Console.readLine + val line = Console.readLine() if (line.length() > 0) { action(line) } diff --git a/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala b/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala index 7f0265bf4f..8b4c2ce4eb 100644 --- a/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala +++ b/src/compiler/scala/tools/nsc/interactive/ScratchPadMaker.scala @@ -163,7 +163,7 @@ trait ScratchPadMaker { self: Global => while (scanner.token != EOF) { startOffset += scanner.offset token += scanner.token - scanner.nextToken + scanner.nextToken() endOffset += scanner.lastOffset } diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala index ba1722382b..a5c228a549 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/core/TestMarker.scala @@ -16,7 +16,7 @@ object TestMarker { } } -abstract case class TestMarker(val marker: String) { +abstract case class TestMarker(marker: String) { TestMarker.checkForDuplicate(this) } diff --git a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala index 9fbd337b9d..3b272aee32 100644 --- a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala @@ -52,7 +52,7 @@ class AbstractFileClassLoader(val root: AbstractFile, parent: ClassLoader) return null } - return file + file } // parent delegation in JCL uses getResource; so either add parent.getResAsStream diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index b2af53574f..d08c9cb36c 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -256,7 +256,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) private def findToolsJar() = { val jdkPath = Directory(jdkHome) - val jar = jdkPath / "lib" / "tools.jar" toFile; + val jar = jdkPath / "lib" / "tools.jar" toFile if (jar isFile) Some(jar) @@ -265,7 +265,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) else None } private def addToolsJarToLoader() = { - val cl = findToolsJar match { + val cl = findToolsJar() match { case Some(tools) => ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader) case _ => intp.classLoader } @@ -656,7 +656,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) foreach (intp quietRun _) ) // classloader and power mode setup - intp.setContextClassLoader + intp.setContextClassLoader() if (isReplPower) { replProps.power setValue true unleashAndSetPhase() diff --git a/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala b/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala index 39979c8fbe..0d11020752 100644 --- a/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala +++ b/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala @@ -68,7 +68,7 @@ trait LoopCommands { } // the result of a single command - case class Result(val keepRunning: Boolean, val lineToRecord: Option[String]) + case class Result(keepRunning: Boolean, lineToRecord: Option[String]) object Result { // the default result means "keep running, and don't record that line" diff --git a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala index 33311f5bb3..a73bb80157 100644 --- a/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala +++ b/src/compiler/scala/tools/nsc/interpreter/TypeStrings.scala @@ -140,7 +140,7 @@ trait StructuredTypeStrings extends DestructureTypes { def wrapAtom[U](value: U) = new TypeAtom(value) } - def show(tp: Type): String = intoNodes(tp).show + def show(tp: Type): String = intoNodes(tp).show() } diff --git a/src/compiler/scala/tools/nsc/io/Jar.scala b/src/compiler/scala/tools/nsc/io/Jar.scala index 0dca75dab9..94399f936b 100644 --- a/src/compiler/scala/tools/nsc/io/Jar.scala +++ b/src/compiler/scala/tools/nsc/io/Jar.scala @@ -115,9 +115,9 @@ class JarWriter(val file: File, val manifest: Manifest) { val buf = new Array[Byte](10240) def loop(): Unit = in.read(buf, 0, buf.length) match { case -1 => in.close() - case n => out.write(buf, 0, n) ; loop + case n => out.write(buf, 0, n) ; loop() } - loop + loop() } def close() = out.close() diff --git a/src/compiler/scala/tools/nsc/io/Lexer.scala b/src/compiler/scala/tools/nsc/io/Lexer.scala index aed6e882e6..b50b01aa27 100644 --- a/src/compiler/scala/tools/nsc/io/Lexer.scala +++ b/src/compiler/scala/tools/nsc/io/Lexer.scala @@ -278,7 +278,7 @@ class Lexer(rd: Reader) { /** The current token is a delimiter consisting of given character, reads next token, * otherwise raises an error. - * @param c the given delimiter character to compare current token with + * @param ch the given delimiter character to compare current token with * @throws MalformedInput if the current token `token` is not a delimiter, or * consists of a character different from `c`. */ diff --git a/src/compiler/scala/tools/nsc/io/Pickler.scala b/src/compiler/scala/tools/nsc/io/Pickler.scala index 5d32c10143..43a6ef3c61 100644 --- a/src/compiler/scala/tools/nsc/io/Pickler.scala +++ b/src/compiler/scala/tools/nsc/io/Pickler.scala @@ -18,7 +18,7 @@ import scala.reflect.ClassTag * Subclasses of `Pickler` each can write and read individual classes * of values. * - * @param T the type of values handled by this pickler. + * @tparam T the type of values handled by this pickler. * * These Picklers build on the work of Andrew Kennedy. They are most closely inspired by * Iulian Dragos' picklers for Scala to XML. See: @@ -71,8 +71,8 @@ abstract class Pickler[T] { def wrapped [U] (in: T => U)(out: U => T): Pickler[U] = wrappedPickler(this)(in)(out) /** A conditional pickler obtained from the current pickler. - * @param cond the condition to test to find out whether pickler can handle - * some Scala value. + * @param p the condition to test to find out whether pickler can handle + * some Scala value. */ def cond(p: Any => Boolean): CondPickler[T] = conditionalPickler(this, p) @@ -87,7 +87,7 @@ object Pickler { /** A base class representing unpickler result. It has two subclasses: * `UnpickleSucess` for successful unpicklings and `UnpickleFailure` for failures, * where a value of the given type `T` could not be unpickled from input. - * @param T the type of unpickled values in case of success. + * @tparam T the type of unpickled values in case of success. */ abstract class Unpickled[+T] { /** Transforms success values to success values using given function, @@ -125,7 +125,7 @@ object Pickler { } /** A class representing successful unpicklings - * @param T the type of the unpickled value + * @tparam T the type of the unpickled value * @param result the unpickled value */ case class UnpickleSuccess[+T](result: T) extends Unpickled[T] @@ -167,7 +167,7 @@ object Pickler { */ def labelledPickler[T](label: String, p: Pickler[T]): Pickler[T] = new Pickler[T] { def pickle(wr: Writer, x: T) = { - wr.write(quoted(label)); + wr.write(quoted(label)) wr.write("(") p.pickle(wr, x) wr.write(")") @@ -361,8 +361,8 @@ abstract class CondPickler[T](val canPickle: Any => Boolean) extends Pickler[T] * To unpickle a value, this unpickler is tried first. If it cannot read * the input (as indicated by a `UnpickleFailure` result), then the * alternative pickler is tried. - * @param V The handled type of the returned pickler. - * @param U The handled type of the alternative pickler. + * @tparam V The handled type of the returned pickler. + * @tparam U The handled type of the alternative pickler. * @param that The alternative pickler. */ def | [V >: T, U <: V] (that: => CondPickler[U]): CondPickler[V] = diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala index bb82cfb827..8f5dca2702 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala @@ -74,7 +74,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { nbraces += 1 case _ => } - in.nextToken + in.nextToken() } } @@ -148,7 +148,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { nbraces += 1 case _ => } - in.nextToken + in.nextToken() in.token match { case RPAREN => nparens -= 1 @@ -163,7 +163,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { while (!(tokens contains in.token) && in.token != EOF) { if (in.token == LBRACE) { skipAhead(); accept(RBRACE) } else if (in.token == LPAREN) { skipAhead(); accept(RPAREN) } - else in.nextToken + else in.nextToken() } } @@ -180,7 +180,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { syntaxError(posToReport, msg, true) } - if (in.token == token) in.nextToken + if (in.token == token) in.nextToken() pos } @@ -200,7 +200,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def ident(): Name = if (in.token == IDENTIFIER) { val name = in.name - in.nextToken + in.nextToken() name } else { accept(IDENTIFIER) @@ -210,7 +210,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def repsep[T <: Tree](p: () => T, sep: Int): List[T] = { val buf = ListBuffer[T](p()) while (in.token == sep) { - in.nextToken + in.nextToken() buf += p() } buf.toList @@ -234,7 +234,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def qualId(): RefTree = { var t: RefTree = atPos(in.currentPos) { Ident(ident()) } while (in.token == DOT) { - in.nextToken + in.nextToken() t = atPos(in.currentPos) { Select(t, ident()) } } t @@ -243,7 +243,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def optArrayBrackets(tpt: Tree): Tree = if (in.token == LBRACKET) { val tpt1 = atPos(in.pos) { arrayOf(tpt) } - in.nextToken + in.nextToken() accept(RBRACKET) optArrayBrackets(tpt1) } else tpt @@ -251,21 +251,21 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def basicType(): Tree = atPos(in.pos) { in.token match { - case BYTE => in.nextToken; TypeTree(ByteClass.tpe) - case SHORT => in.nextToken; TypeTree(ShortClass.tpe) - case CHAR => in.nextToken; TypeTree(CharClass.tpe) - case INT => in.nextToken; TypeTree(IntClass.tpe) - case LONG => in.nextToken; TypeTree(LongClass.tpe) - case FLOAT => in.nextToken; TypeTree(FloatClass.tpe) - case DOUBLE => in.nextToken; TypeTree(DoubleClass.tpe) - case BOOLEAN => in.nextToken; TypeTree(BooleanClass.tpe) + case BYTE => in.nextToken(); TypeTree(ByteClass.tpe) + case SHORT => in.nextToken(); TypeTree(ShortClass.tpe) + case CHAR => in.nextToken(); TypeTree(CharClass.tpe) + case INT => in.nextToken(); TypeTree(IntClass.tpe) + case LONG => in.nextToken(); TypeTree(LongClass.tpe) + case FLOAT => in.nextToken(); TypeTree(FloatClass.tpe) + case DOUBLE => in.nextToken(); TypeTree(DoubleClass.tpe) + case BOOLEAN => in.nextToken(); TypeTree(BooleanClass.tpe) case _ => syntaxError("illegal start of type", true); errorTypeTree } } def typ(): Tree = optArrayBrackets { - if (in.token == FINAL) in.nextToken + if (in.token == FINAL) in.nextToken() if (in.token == IDENTIFIER) { var t = typeArgs(atPos(in.currentPos)(Ident(ident()))) // typeSelect generates Select nodes is the lhs is an Ident or Select, @@ -278,7 +278,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { case _ => SelectFromTypeTree(t, name.toTypeName) } while (in.token == DOT) { - in.nextToken + in.nextToken() t = typeArgs(atPos(in.currentPos)(typeSelect(t, ident()))) } convertToTypeId(t) @@ -292,14 +292,14 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def typeArg(): Tree = if (in.token == QMARK) { val pos = in.currentPos - in.nextToken + in.nextToken() var lo: Tree = TypeTree(NothingClass.tpe) var hi: Tree = TypeTree(AnyClass.tpe) if (in.token == EXTENDS) { - in.nextToken + in.nextToken() hi = typ() } else if (in.token == SUPER) { - in.nextToken + in.nextToken() lo = typ() } val tdef = atPos(pos) { @@ -315,7 +315,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { typ() } if (in.token == LT) { - in.nextToken + in.nextToken() val t1 = convertToTypeId(t) val args = repsep(typeArg, COMMA) acceptClosingAngle() @@ -330,7 +330,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def annotations(): List[Tree] = { //var annots = new ListBuffer[Tree] while (in.token == AT) { - in.nextToken + in.nextToken() annotation() } List() // don't pass on annotations for now @@ -354,38 +354,38 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { while (true) { in.token match { case AT if (in.lookaheadToken != INTERFACE) => - in.nextToken + in.nextToken() annotation() case PUBLIC => isPackageAccess = false - in.nextToken + in.nextToken() case PROTECTED => flags |= Flags.PROTECTED - in.nextToken + in.nextToken() case PRIVATE => isPackageAccess = false flags |= Flags.PRIVATE - in.nextToken + in.nextToken() case STATIC => flags |= Flags.STATIC - in.nextToken + in.nextToken() case ABSTRACT => flags |= Flags.ABSTRACT - in.nextToken + in.nextToken() case FINAL => flags |= Flags.FINAL - in.nextToken + in.nextToken() case NATIVE => addAnnot(NativeAttr) - in.nextToken + in.nextToken() case TRANSIENT => addAnnot(TransientAttr) - in.nextToken + in.nextToken() case VOLATILE => addAnnot(VolatileAttr) - in.nextToken + in.nextToken() case SYNCHRONIZED | STRICTFP => - in.nextToken + in.nextToken() case _ => val privateWithin: TypeName = if (isPackageAccess && !inInterface) thisPackageName @@ -399,7 +399,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def typeParams(): List[TypeDef] = if (in.token == LT) { - in.nextToken + in.nextToken() val tparams = repsep(typeParam, COMMA) acceptClosingAngle() tparams @@ -410,7 +410,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val name = identForType() val hi = if (in.token == EXTENDS) { - in.nextToken + in.nextToken() bound() } else { scalaDot(tpnme.Any) @@ -423,7 +423,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { atPos(in.currentPos) { val buf = ListBuffer[Tree](typ()) while (in.token == AMP) { - in.nextToken + in.nextToken() buf += typ() } val ts = buf.toList @@ -439,11 +439,11 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { } def formalParam(): ValDef = { - if (in.token == FINAL) in.nextToken + if (in.token == FINAL) in.nextToken() annotations() var t = typ() if (in.token == DOTDOTDOT) { - in.nextToken + in.nextToken() t = atPos(t.pos) { AppliedTypeTree(scalaDot(tpnme.JAVA_REPEATED_PARAM_CLASS_NAME), List(t)) } @@ -453,7 +453,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def optThrows() { if (in.token == THROWS) { - in.nextToken + in.nextToken() repsep(typ, COMMA) } } @@ -472,7 +472,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val isVoid = in.token == VOID var rtpt = if (isVoid) { - in.nextToken + in.nextToken() TypeTree(UnitClass.tpe) setPos in.pos } else typ() var pos = in.currentPos @@ -545,7 +545,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val buf = ListBuffer[Tree](varDecl(pos, mods, tpt, name.toTermName)) val maybe = new ListBuffer[Tree] // potential variable definitions. while (in.token == COMMA) { - in.nextToken + in.nextToken() if (in.token == IDENTIFIER) { // if there's an ident after the comma ... val name = ident() if (in.token == ASSIGN || in.token == SEMI) { // ... followed by a `=` or `;`, we know it's a real variable definition @@ -626,19 +626,19 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def collectIdents() : Int = { if (in.token == ASTERISK) { val starOffset = in.pos - in.nextToken + in.nextToken() buf += nme.WILDCARD starOffset } else { val nameOffset = in.pos buf += ident() if (in.token == DOT) { - in.nextToken + in.nextToken() collectIdents() } else nameOffset } } - if (in.token == STATIC) in.nextToken + if (in.token == STATIC) in.nextToken() else buf += nme.ROOTPKG val lastnameOffset = collectIdents() accept(SEMI) @@ -659,7 +659,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { def interfacesOpt() = if (in.token == IMPLEMENTS) { - in.nextToken + in.nextToken() repsep(typ, COMMA) } else { List() @@ -672,7 +672,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val tparams = typeParams() val superclass = if (in.token == EXTENDS) { - in.nextToken + in.nextToken() typ() } else { javaLangObject() @@ -691,10 +691,10 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val tparams = typeParams() val parents = if (in.token == EXTENDS) { - in.nextToken + in.nextToken() repsep(typ, COMMA) } else { - List(javaLangObject) + List(javaLangObject()) } val (statics, body) = typeBody(INTERFACE, name) addCompanionObject(statics, atPos(pos) { @@ -721,7 +721,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { skipAhead() // skip init block, we just assume we have seen only static accept(RBRACE) } else if (in.token == SEMI) { - in.nextToken + in.nextToken() } else { if (in.token == ENUM || definesInterface(in.token)) mods |= Flags.STATIC val decls = memberDecl(mods, parentToken) @@ -779,7 +779,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { if (in.token != RBRACE && in.token != SEMI && in.token != EOF) { buf += enumConst(enumType) if (in.token == COMMA) { - in.nextToken + in.nextToken() parseEnumConsts() } } @@ -788,7 +788,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { val consts = buf.toList val (statics, body) = if (in.token == SEMI) { - in.nextToken + in.nextToken() typeBodyDecls(ENUM, name) } else { (List(), List()) @@ -839,13 +839,13 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { case INTERFACE => interfaceDecl(mods) case AT => annotationDecl(mods) case CLASS => classDecl(mods) - case _ => in.nextToken; syntaxError("illegal start of type declaration", true); List(errorTypeTree) + case _ => in.nextToken(); syntaxError("illegal start of type declaration", true); List(errorTypeTree) } /** CompilationUnit ::= [package QualId semi] TopStatSeq */ def compilationUnit(): Tree = { - var pos = in.currentPos; + var pos = in.currentPos val pkg: RefTree = if (in.token == AT || in.token == PACKAGE) { annotations() @@ -865,7 +865,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners { while (in.token == IMPORT) buf ++= importDecl() while (in.token != EOF && in.token != RBRACE) { - while (in.token == SEMI) in.nextToken + while (in.token == SEMI) in.nextToken() if (in.token != EOF) buf ++= typeDecl(modifiers(false)) } diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala index 84eee36f18..ad92b2e742 100644 --- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala +++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala @@ -266,7 +266,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { def lookaheadToken: Int = { prev copyFrom this - nextToken + nextToken() val t = token next copyFrom this this copyFrom prev @@ -281,7 +281,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { while (true) { in.ch match { case ' ' | '\t' | CR | LF | FF => - in.next + in.next() case _ => pos = in.cpos (in.ch: @switch) match { @@ -298,47 +298,47 @@ trait JavaScanners extends ast.parser.ScannersCommon { 'u' | 'v' | 'w' | 'x' | 'y' | 'z' => putChar(in.ch) - in.next - getIdentRest + in.next() + getIdentRest() return case '0' => putChar(in.ch) - in.next + in.next() if (in.ch == 'x' || in.ch == 'X') { - in.next + in.next() base = 16 } else { base = 8 } - getNumber + getNumber() return case '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => base = 10 - getNumber + getNumber() return case '\"' => - in.next + in.next() while (in.ch != '\"' && (in.isUnicode || in.ch != CR && in.ch != LF && in.ch != SU)) { getlitch() } if (in.ch == '\"') { token = STRINGLIT setName() - in.next + in.next() } else { syntaxError("unclosed string literal") } return case '\'' => - in.next + in.next() getlitch() if (in.ch == '\'') { - in.next + in.next() token = CHARLIT setName() } else { @@ -348,31 +348,31 @@ trait JavaScanners extends ast.parser.ScannersCommon { case '=' => token = ASSIGN - in.next + in.next() if (in.ch == '=') { token = EQEQ - in.next + in.next() } return case '>' => token = GT - in.next + in.next() if (in.ch == '=') { token = GTEQ - in.next + in.next() } else if (in.ch == '>') { token = GTGT - in.next + in.next() if (in.ch == '=') { token = GTGTEQ - in.next + in.next() } else if (in.ch == '>') { token = GTGTGT - in.next + in.next() if (in.ch == '=') { token = GTGTGTEQ - in.next + in.next() } } } @@ -380,145 +380,145 @@ trait JavaScanners extends ast.parser.ScannersCommon { case '<' => token = LT - in.next + in.next() if (in.ch == '=') { token = LTEQ - in.next + in.next() } else if (in.ch == '<') { token = LTLT - in.next + in.next() if (in.ch == '=') { token = LTLTEQ - in.next + in.next() } } return case '!' => token = BANG - in.next + in.next() if (in.ch == '=') { token = BANGEQ - in.next + in.next() } return case '~' => token = TILDE - in.next + in.next() return case '?' => token = QMARK - in.next + in.next() return case ':' => token = COLON - in.next + in.next() return case '@' => token = AT - in.next + in.next() return case '&' => token = AMP - in.next + in.next() if (in.ch == '&') { token = AMPAMP - in.next + in.next() } else if (in.ch == '=') { token = AMPEQ - in.next + in.next() } return case '|' => token = BAR - in.next + in.next() if (in.ch == '|') { token = BARBAR - in.next + in.next() } else if (in.ch == '=') { token = BAREQ - in.next + in.next() } return case '+' => token = PLUS - in.next + in.next() if (in.ch == '+') { token = PLUSPLUS - in.next + in.next() } else if (in.ch == '=') { token = PLUSEQ - in.next + in.next() } return case '-' => token = MINUS - in.next + in.next() if (in.ch == '-') { token = MINUSMINUS - in.next + in.next() } else if (in.ch == '=') { token = MINUSEQ - in.next + in.next() } return case '*' => token = ASTERISK - in.next + in.next() if (in.ch == '=') { token = ASTERISKEQ - in.next + in.next() } return case '/' => - in.next + in.next() if (!skipComment()) { token = SLASH - in.next + in.next() if (in.ch == '=') { token = SLASHEQ - in.next + in.next() } return } case '^' => token = HAT - in.next + in.next() if (in.ch == '=') { token = HATEQ - in.next + in.next() } return case '%' => token = PERCENT - in.next + in.next() if (in.ch == '=') { token = PERCENTEQ - in.next + in.next() } return case '.' => token = DOT - in.next + in.next() if ('0' <= in.ch && in.ch <= '9') { - putChar('.'); getFraction + putChar('.'); getFraction() } else if (in.ch == '.') { - in.next + in.next() if (in.ch == '.') { - in.next + in.next() token = DOTDOTDOT } else syntaxError("`.' character expected") } @@ -526,60 +526,60 @@ trait JavaScanners extends ast.parser.ScannersCommon { case ';' => token = SEMI - in.next + in.next() return case ',' => token = COMMA - in.next + in.next() return case '(' => token = LPAREN - in.next + in.next() return case '{' => token = LBRACE - in.next + in.next() return case ')' => token = RPAREN - in.next + in.next() return case '}' => token = RBRACE - in.next + in.next() return case '[' => token = LBRACKET - in.next + in.next() return case ']' => token = RBRACKET - in.next + in.next() return case SU => if (!in.hasNext) token = EOF else { syntaxError("illegal character") - in.next + in.next() } return case _ => if (Character.isUnicodeIdentifierStart(in.ch)) { putChar(in.ch) - in.next - getIdentRest + in.next() + getIdentRest() } else { syntaxError("illegal character: "+in.ch.toInt) - in.next + in.next() } return } @@ -590,26 +590,26 @@ trait JavaScanners extends ast.parser.ScannersCommon { private def skipComment(): Boolean = { if (in.ch == '/') { do { - in.next + in.next() } while ((in.ch != CR) && (in.ch != LF) && (in.ch != SU)) true } else if (in.ch == '*') { docBuffer = null - in.next + in.next() val scalaDoc = ("/**", "*/") if (in.ch == '*' && forScaladoc) docBuffer = new StringBuilder(scalaDoc._1) do { do { if (in.ch != '*' && in.ch != SU) { - in.next; putDocChar(in.ch) + in.next(); putDocChar(in.ch) } } while (in.ch != '*' && in.ch != SU) while (in.ch == '*') { - in.next; putDocChar(in.ch) + in.next(); putDocChar(in.ch) } } while (in.ch != '/' && in.ch != SU) - if (in.ch == '/') in.next + if (in.ch == '/') in.next() else incompleteInputError("unclosed comment") true } else { @@ -637,12 +637,12 @@ trait JavaScanners extends ast.parser.ScannersCommon { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => putChar(in.ch) - in.next + in.next() case '_' => putChar(in.ch) - in.next - getIdentRest + in.next() + getIdentRest() return case SU => setName() @@ -651,7 +651,7 @@ trait JavaScanners extends ast.parser.ScannersCommon { case _ => if (Character.isUnicodeIdentifierPart(in.ch)) { putChar(in.ch) - in.next + in.next() } else { setName() token = JavaScannerConfiguration.name2token(name) @@ -667,17 +667,17 @@ trait JavaScanners extends ast.parser.ScannersCommon { */ protected def getlitch() = if (in.ch == '\\') { - in.next + in.next() if ('0' <= in.ch && in.ch <= '7') { val leadch: Char = in.ch var oct: Int = digit2int(in.ch, 8) - in.next + in.next() if ('0' <= in.ch && in.ch <= '7') { oct = oct * 8 + digit2int(in.ch, 8) - in.next + in.next() if (leadch <= '3' && '0' <= in.ch && in.ch <= '7') { oct = oct * 8 + digit2int(in.ch, 8) - in.next + in.next() } } putChar(oct.asInstanceOf[Char]) @@ -695,11 +695,11 @@ trait JavaScanners extends ast.parser.ScannersCommon { syntaxError(in.cpos - 1, "invalid escape character") putChar(in.ch) } - in.next + in.next() } } else { putChar(in.ch) - in.next + in.next() } /** read fractional part and exponent of floating point number @@ -709,35 +709,35 @@ trait JavaScanners extends ast.parser.ScannersCommon { token = DOUBLELIT while ('0' <= in.ch && in.ch <= '9') { putChar(in.ch) - in.next + in.next() } if (in.ch == 'e' || in.ch == 'E') { val lookahead = in.copy - lookahead.next + lookahead.next() if (lookahead.ch == '+' || lookahead.ch == '-') { - lookahead.next + lookahead.next() } if ('0' <= lookahead.ch && lookahead.ch <= '9') { putChar(in.ch) - in.next + in.next() if (in.ch == '+' || in.ch == '-') { putChar(in.ch) - in.next + in.next() } while ('0' <= in.ch && in.ch <= '9') { putChar(in.ch) - in.next + in.next() } } token = DOUBLELIT } if (in.ch == 'd' || in.ch == 'D') { putChar(in.ch) - in.next + in.next() token = DOUBLELIT } else if (in.ch == 'f' || in.ch == 'F') { putChar(in.ch) - in.next + in.next() token = FLOATLIT } setName() @@ -797,23 +797,23 @@ trait JavaScanners extends ast.parser.ScannersCommon { protected def getNumber() { while (digit2int(in.ch, if (base < 10) 10 else base) >= 0) { putChar(in.ch) - in.next + in.next() } token = INTLIT if (base <= 10 && in.ch == '.') { val lookahead = in.copy - lookahead.next + lookahead.next() lookahead.ch match { case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'd' | 'D' | 'e' | 'E' | 'f' | 'F' => putChar(in.ch) - in.next - return getFraction + in.next() + return getFraction() case _ => if (!isIdentifierStart(lookahead.ch)) { putChar(in.ch) - in.next - return getFraction + in.next() + return getFraction() } } } @@ -821,11 +821,11 @@ trait JavaScanners extends ast.parser.ScannersCommon { (in.ch == 'e' || in.ch == 'E' || in.ch == 'f' || in.ch == 'F' || in.ch == 'd' || in.ch == 'D')) { - return getFraction + return getFraction() } setName() if (in.ch == 'l' || in.ch == 'L') { - in.next + in.next() token = LONGLIT } } @@ -875,14 +875,14 @@ trait JavaScanners extends ast.parser.ScannersCommon { /** INIT: read lookahead character and token. */ def init() { - in.next - nextToken + in.next() + nextToken() } } class JavaUnitScanner(unit: CompilationUnit) extends JavaScanner { in = new JavaCharArrayReader(unit.source.content, !settings.nouescape.value, syntaxError) - init + init() def error (pos: Int, msg: String) = unit. error(pos, msg) def incompleteInputError(pos: Int, msg: String) = unit.incompleteInputError(pos, msg) def deprecationWarning(pos: Int, msg: String) = unit.deprecationWarning(pos, msg) diff --git a/src/compiler/scala/tools/nsc/plugins/Plugins.scala b/src/compiler/scala/tools/nsc/plugins/Plugins.scala index bb7d54d8f6..00e5875852 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugins.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugins.scala @@ -41,7 +41,7 @@ trait Plugins { classes map (Plugin.instantiate(_, this)) } - protected lazy val roughPluginsList: List[Plugin] = loadRoughPluginsList + protected lazy val roughPluginsList: List[Plugin] = loadRoughPluginsList() /** Load all available plugins. Skips plugins that * either have the same name as another one, or which @@ -102,7 +102,7 @@ trait Plugins { plugs } - lazy val plugins: List[Plugin] = loadPlugins + lazy val plugins: List[Plugin] = loadPlugins() /** A description of all the plugins that are loaded */ def pluginDescriptions: String = diff --git a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala index 025fc8e068..44670ea578 100644 --- a/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/AbstractReporter.scala @@ -21,8 +21,8 @@ abstract class AbstractReporter extends Reporter { private val positions = new mutable.HashMap[Position, Severity] override def reset() { - super.reset - positions.clear + super.reset() + positions.clear() } private def isVerbose = settings.verbose.value @@ -49,7 +49,7 @@ abstract class AbstractReporter extends Reporter { } if (isPromptSet) - displayPrompt + displayPrompt() } } } diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala index 0e44ef63a1..7a17180724 100644 --- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala @@ -382,7 +382,7 @@ class MutableSettings(val errorFn: String => Unit) def max = range map (_._2) getOrElse IntMax override def value_=(s: Int) = - if (isInputValid(s)) super.value_=(s) else errorMsg + if (isInputValid(s)) super.value_=(s) else errorMsg() // Validate that min and max are consistent assert(min <= max) @@ -414,7 +414,7 @@ class MutableSettings(val errorFn: String => Unit) if (args.isEmpty) errorAndValue("missing argument", None) else parseArgument(args.head) match { case Some(i) => value = i ; Some(args.tail) - case None => errorMsg ; None + case None => errorMsg() ; None } def unparse: List[String] = diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index 129331f435..5b5118a94f 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -178,7 +178,7 @@ abstract class SymbolLoaders { if (!settings.isScaladoc) globalError( if (msg eq null) "i/o error while loading " + root.name - else "error while loading " + root.name + ", " + msg); + else "error while loading " + root.name + ", " + msg) } try { val start = currentTime diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index a5f41dc82b..a7e4006fbe 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -99,7 +99,7 @@ abstract class ClassfileParser { this.staticModule = if (root.isModule) root else root.companionModule this.isScala = false - parseHeader + parseHeader() this.pool = new ConstantPool parseClass() } @@ -540,7 +540,7 @@ abstract class ClassfileParser { val staticInfo = ClassInfoType(List(), staticScope, moduleClass) if (!isScala && !isScalaRaw) - enterOwnInnerClasses + enterOwnInnerClasses() val curbp = in.bp skipMembers() // fields @@ -1128,7 +1128,7 @@ abstract class ClassfileParser { case tpnme.ScalaSignatureATTR => isScala = true val pbuf = new PickleBuffer(in.buf, in.bp, in.bp + attrLen) - pbuf.readNat; pbuf.readNat; + pbuf.readNat(); pbuf.readNat() if (pbuf.readNat == 0) // a scala signature attribute with no entries means that the actual scala signature isScalaAnnot = true // is in a ScalaSignature annotation. in.skip(attrLen) diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index 79b08bcabf..6e99129ee5 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -65,7 +65,7 @@ abstract class ICodeReader extends ClassfileParser { val fieldCount = in.nextChar for (i <- 0 until fieldCount) parseField() val methodCount = in.nextChar - for (i <- 0 until methodCount) parseMethod(); + for (i <- 0 until methodCount) parseMethod() instanceCode.methods = instanceCode.methods.reverse staticCode.methods = staticCode.methods.reverse } @@ -131,13 +131,13 @@ abstract class ICodeReader extends ClassfileParser { val attributeCount = in.nextChar for (i <- 0 until attributeCount) parseAttribute() } else { - debuglog("Skipping non-existent method."); - skipAttributes(); + debuglog("Skipping non-existent method.") + skipAttributes() } } catch { case e: MissingRequirementError => - in.bp = beginning; skipAttributes - debuglog("Skipping non-existent method. " + e.msg); + in.bp = beginning; skipAttributes() + debuglog("Skipping non-existent method. " + e.msg) } } @@ -217,7 +217,7 @@ abstract class ICodeReader extends ClassfileParser { val instr = toUnsignedByte(in.nextByte) instr match { - case JVM.nop => parseInstruction + case JVM.nop => parseInstruction() case JVM.aconst_null => code emit CONSTANT(Constant(null)) case JVM.iconst_m1 => code emit CONSTANT(Constant(-1)) case JVM.iconst_0 => code emit CONSTANT(Constant(0)) @@ -247,9 +247,9 @@ abstract class ICodeReader extends ClassfileParser { case JVM.aload => val local = in.nextByte.toInt; size += 1 if (local == 0 && !method.isStatic) - code.emit(THIS(method.symbol.owner)); + code.emit(THIS(method.symbol.owner)) else - code.emit(LOAD_LOCAL(code.getLocal(local, ObjectReference))); + code.emit(LOAD_LOCAL(code.getLocal(local, ObjectReference))) case JVM.iload_0 => code.emit(LOAD_LOCAL(code.getLocal(0, INT))) case JVM.iload_1 => code.emit(LOAD_LOCAL(code.getLocal(1, INT))) @@ -269,9 +269,9 @@ abstract class ICodeReader extends ClassfileParser { case JVM.dload_3 => code.emit(LOAD_LOCAL(code.getLocal(3, DOUBLE))) case JVM.aload_0 => if (!method.isStatic) - code.emit(THIS(method.symbol.owner)); + code.emit(THIS(method.symbol.owner)) else - code.emit(LOAD_LOCAL(code.getLocal(0, ObjectReference))); + code.emit(LOAD_LOCAL(code.getLocal(0, ObjectReference))) case JVM.aload_1 => code.emit(LOAD_LOCAL(code.getLocal(1, ObjectReference))) case JVM.aload_2 => code.emit(LOAD_LOCAL(code.getLocal(2, ObjectReference))) case JVM.aload_3 => code.emit(LOAD_LOCAL(code.getLocal(3, ObjectReference))) @@ -491,7 +491,7 @@ abstract class ICodeReader extends ClassfileParser { case JVM.invokespecial => val m = pool.getMemberSymbol(in.nextChar, false); size += 2 val style = if (m.name == nme.CONSTRUCTOR || m.isPrivate) Static(true) - else SuperCall(m.owner.name); + else SuperCall(m.owner.name) code.emit(CALL_METHOD(m, style)) case JVM.invokestatic => val m = pool.getMemberSymbol(in.nextChar, true); size += 2 @@ -581,7 +581,7 @@ abstract class ICodeReader extends ClassfileParser { } pc = 0 - while (pc < codeLength) parseInstruction + while (pc < codeLength) parseInstruction() val exceptionEntries = in.nextChar.toInt code.containsEHs = (exceptionEntries != 0) @@ -671,7 +671,7 @@ abstract class ICodeReader extends ClassfileParser { otherBlock = blocks(pc) if (!bb.closed && otherBlock != bb) { bb.emit(JUMP(otherBlock)) - bb.close + bb.close() // Console.println("\t> closing bb: " + bb) } bb = otherBlock @@ -722,36 +722,36 @@ abstract class ICodeReader extends ClassfileParser { i match { case DUP_X1 => val (one, two) = stack.pop2 - push(one); push(two); push(one); + push(one); push(two); push(one) case DUP_X2 => val (one, two, three) = stack.pop3 - push(one); push(three); push(two); push(one); + push(one); push(three); push(two); push(one) case DUP2_X1 => val (one, two) = stack.pop2 if (one.isWideType) { - push(one); push(two); push(one); + push(one); push(two); push(one) } else { val three = stack.pop - push(two); push(one); push(three); push(two); push(one); + push(two); push(one); push(three); push(two); push(one) } case DUP2_X2 => val (one, two) = stack.pop2 if (one.isWideType && two.isWideType) { - push(one); push(two); push(one); + push(one); push(two); push(one) } else if (one.isWideType) { val three = stack.pop assert(!three.isWideType, "Impossible") - push(one); push(three); push(two); push(one); + push(one); push(three); push(two); push(one) } else { val three = stack.pop if (three.isWideType) { - push(two); push(one); push(one); push(three); push(two); push(one); + push(two); push(one); push(one); push(three); push(two); push(one) } else { val four = stack.pop - push(two); push(one); push(four); push(one); push(three); push(two); push(one); + push(two); push(one); push(four); push(one); push(three); push(two); push(one) } } @@ -764,7 +764,7 @@ abstract class ICodeReader extends ClassfileParser { // method.dump tfa.init(method) - tfa.run + tfa.run() for (bb <- linearizer.linearize(method)) { var info = tfa.in(bb) for (i <- bb.toList) { @@ -779,7 +779,7 @@ abstract class ICodeReader extends ClassfileParser { STORE_LOCAL(tmp2), LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) case DUP_X2 => val one = info.stack.types(0) @@ -792,30 +792,30 @@ abstract class ICodeReader extends ClassfileParser { STORE_LOCAL(tmp2), LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) else { - val tmp3 = freshLocal(info.stack.types(2)); + val tmp3 = freshLocal(info.stack.types(2)) bb.replaceInstruction(i, List(STORE_LOCAL(tmp1), STORE_LOCAL(tmp2), STORE_LOCAL(tmp3), LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp3), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) } case DUP2_X1 => val one = info.stack.types(0) val two = info.stack.types(1) - val tmp1 = freshLocal(one); - val tmp2 = freshLocal(two); + val tmp1 = freshLocal(one) + val tmp2 = freshLocal(two) if (one.isWideType) { assert(!two.isWideType, "Impossible") bb.replaceInstruction(i, List(STORE_LOCAL(tmp1), STORE_LOCAL(tmp2), LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) } else { val tmp3 = freshLocal(info.stack.types(2)) bb.replaceInstruction(i, List(STORE_LOCAL(tmp1), @@ -824,7 +824,7 @@ abstract class ICodeReader extends ClassfileParser { LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp3), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) } case DUP2_X2 => @@ -837,21 +837,21 @@ abstract class ICodeReader extends ClassfileParser { STORE_LOCAL(tmp2), LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) } else if (one.isWideType) { val three = info.stack.types(2) assert(!two.isWideType && !three.isWideType, "Impossible") - val tmp3 = freshLocal(three); + val tmp3 = freshLocal(three) bb.replaceInstruction(i, List(STORE_LOCAL(tmp1), STORE_LOCAL(tmp2), STORE_LOCAL(tmp3), LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp3), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) } else { val three = info.stack.types(2) - val tmp3 = freshLocal(three); + val tmp3 = freshLocal(three) if (three.isWideType) { bb.replaceInstruction(i, List(STORE_LOCAL(tmp1), STORE_LOCAL(tmp2), @@ -860,10 +860,10 @@ abstract class ICodeReader extends ClassfileParser { LOAD_LOCAL(tmp1), LOAD_LOCAL(tmp3), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) } else { val four = info.stack.types(3) - val tmp4 = freshLocal(three); + val tmp4 = freshLocal(three) assert(!four.isWideType, "Impossible") bb.replaceInstruction(i, List(STORE_LOCAL(tmp1), STORE_LOCAL(tmp2), @@ -874,7 +874,7 @@ abstract class ICodeReader extends ClassfileParser { LOAD_LOCAL(tmp4), LOAD_LOCAL(tmp3), LOAD_LOCAL(tmp2), - LOAD_LOCAL(tmp1))); + LOAD_LOCAL(tmp1))) } } case _ => @@ -889,7 +889,7 @@ abstract class ICodeReader extends ClassfileParser { import opcodes._ val rdef = new reachingDefinitions.ReachingDefinitionsAnalysis rdef.init(method) - rdef.run + rdef.run() for (bb <- method.code.blocks ; (i, idx) <- bb.toList.zipWithIndex) i match { case cm @ CALL_METHOD(m, Static(true)) if m.isClassConstructor => @@ -941,7 +941,7 @@ abstract class ICodeReader extends ClassfileParser { l } case None => - checkValidIndex + checkValidIndex() val l = freshLocal(idx, kind, false) debuglog("Added new local for idx " + idx + ": " + kind) locals += (idx -> List((l, kind))) @@ -954,7 +954,7 @@ abstract class ICodeReader extends ClassfileParser { /** Return a fresh Local variable for the given index. */ private def freshLocal(idx: Int, kind: TypeKind, isArg: Boolean) = { - val sym = method.symbol.newVariable(newTermName("loc" + idx)).setInfo(kind.toType); + val sym = method.symbol.newVariable(newTermName("loc" + idx)).setInfo(kind.toType) val l = new Local(sym, kind, isArg) method.addLocal(l) l @@ -984,7 +984,8 @@ abstract class ICodeReader extends ClassfileParser { jmpTargets += pc } - case class LJUMP(pc: Int) extends LazyJump(pc); + case class LJUMP(pc: Int) extends LazyJump(pc) + case class LCJUMP(success: Int, failure: Int, cond: TestOp, kind: TypeKind) extends LazyJump(success) { override def toString(): String = "LCJUMP (" + kind + ") " + success + " : " + failure diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala index c8b7fcee8f..79d0df5a29 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala @@ -179,7 +179,7 @@ abstract class Pickler extends SubComponent { putSymbol(sym.privateWithin) putType(sym.info) if (sym.thisSym.tpeHK != sym.tpeHK) - putType(sym.typeOfThis); + putType(sym.typeOfThis) putSymbol(sym.alias) if (!sym.children.isEmpty) { val (locals, globals) = sym.children partition (_.isLocalClass) @@ -246,8 +246,8 @@ abstract class Pickler extends SubComponent { // val savedBoundSyms = boundSyms // boundSyms are known to be local based on the EXISTENTIAL flag (see isLocal) // boundSyms = tparams ::: boundSyms // try { - putType(restpe); -// } finally { + putType(restpe) + // } finally { // boundSyms = savedBoundSyms // } putSymbols(tparams) diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index f5c8907991..a871c72fc2 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -127,7 +127,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { ArrayValue(TypeTree(ClassClass.tpe), paramTypes map LIT) /* ... */ - def reflectiveMethodCache(method: String, paramTypes: List[Type]): Symbol = dispatchType match { + def reflectiveMethodCache(method: String, paramTypes: List[Type]): Symbol = dispatchType() match { case NO_CACHE => /* Implementation of the cache is as follows for method "def xyz(a: A, b: B)": @@ -356,7 +356,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL { // reflective method call machinery val invokeName = MethodClass.tpe member nme.invoke_ // scala.reflect.Method.invoke(...) def cache = REF(reflectiveMethodCache(ad.symbol.name.toString, paramTypes)) // cache Symbol - def lookup = Apply(cache, List(qual1() GETCLASS)) // get Method object from cache + def lookup = Apply(cache, List(qual1() GETCLASS())) // get Method object from cache def invokeArgs = ArrayValue(TypeTree(ObjectClass.tpe), params) // args for invocation def invocation = (lookup DOT invokeName)(qual1(), invokeArgs) // .invoke(qual1, ...) diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index e99b42a402..a4a6c3ff31 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -24,8 +24,8 @@ abstract class Constructors extends Transform with ast.TreeDSL { protected def newTransformer(unit: CompilationUnit): Transformer = new ConstructorTransformer(unit) - private val guardedCtorStats: mutable.Map[Symbol, List[Tree]] = perRunCaches.newMap[Symbol, List[Tree]] - private val ctorParams: mutable.Map[Symbol, List[Symbol]] = perRunCaches.newMap[Symbol, List[Symbol]] + private val guardedCtorStats: mutable.Map[Symbol, List[Tree]] = perRunCaches.newMap[Symbol, List[Tree]]() + private val ctorParams: mutable.Map[Symbol, List[Symbol]] = perRunCaches.newMap[Symbol, List[Symbol]]() class ConstructorTransformer(unit: CompilationUnit) extends Transformer { @@ -188,7 +188,7 @@ abstract class Constructors extends Transform with ast.TreeDSL { // Lazy vals don't get the assignment in the constructor. if (!stat.symbol.tpe.isInstanceOf[ConstantType]) { if (rhs != EmptyTree && !stat.symbol.isLazy) { - val rhs1 = intoConstructor(stat.symbol, rhs); + val rhs1 = intoConstructor(stat.symbol, rhs) (if (canBeMoved(stat)) constrPrefixBuf else constrStatBuf) += mkAssign( stat.symbol, rhs1) } diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 8287c1f631..141a63d36e 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -389,7 +389,7 @@ abstract class Erasure extends AddInterfaces if (enteringExplicitOuter(!member.isDeferred)) checkPair(member, other) - opc.next + opc.next() } (bridges, toBeRemoved) } @@ -745,7 +745,7 @@ abstract class Erasure extends AddInterfaces tree.symbol = NoSymbol selectFrom(qual1) } else if (isMethodTypeWithEmptyParams(qual1.tpe)) { - assert(qual1.symbol.isStable, qual1.symbol); + assert(qual1.symbol.isStable, qual1.symbol) val applied = Apply(qual1, List()) setPos qual1.pos setType qual1.tpe.resultType adaptMember(selectFrom(applied)) } else if (!(qual1.isInstanceOf[Super] || (qual1.tpe.typeSymbol isSubClass tree.symbol.owner))) { @@ -806,7 +806,7 @@ abstract class Erasure extends AddInterfaces newCdef setType newCdef.body.tpe } def adaptBranch(branch: Tree): Tree = - if (branch == EmptyTree) branch else adaptToType(branch, tree1.tpe); + if (branch == EmptyTree) branch else adaptToType(branch, tree1.tpe) tree1 match { case If(cond, thenp, elsep) => @@ -900,7 +900,7 @@ abstract class Erasure extends AddInterfaces opc.overridden.infosString) doubleDefError(opc.overriding, opc.overridden) } - opc.next + opc.next() } } diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala index 965612f926..124dd6c995 100644 --- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala +++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala @@ -481,14 +481,14 @@ abstract class ExplicitOuter extends InfoTransform // at least don't crash... this duplicates maybeOmittable from constructors (acc.owner.isEffectivelyFinal && !acc.isOverridingSymbol)) { unit.uncheckedWarning(tree.pos, "The outer reference in this type test cannot be checked at run time.") - return transform(TRUE) // urgh... drop condition if there's no accessor (or if it may disappear after constructors) + transform(TRUE) // urgh... drop condition if there's no accessor (or if it may disappear after constructors) } else { // println("(base, acc)= "+(base, acc)) val outerSelect = localTyper typed Apply(Select(base, acc), Nil) // achieves the same as: localTyper typed atPos(tree.pos)(outerPath(base, base.tpe.typeSymbol, outerFor.outerClass)) // println("(b, tpsym, outerForI, outerFor, outerClass)= "+ (base, base.tpe.typeSymbol, outerFor, sel.symbol.owner, outerFor.outerClass)) // println("outerSelect = "+ outerSelect) - return transform(treeCopy.Apply(tree, treeCopy.Select(eqsel, outerSelect, eq), args)) + transform(treeCopy.Apply(tree, treeCopy.Select(eqsel, outerSelect, eq), args)) } case _ => diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala index a370b45be0..44d39de205 100644 --- a/src/compiler/scala/tools/nsc/transform/Flatten.scala +++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala @@ -85,7 +85,7 @@ abstract class Flatten extends InfoTransform { val restp1 = apply(restp) if (restp1 eq restp) tp else copyMethodType(tp, params, restp1) case PolyType(tparams, restp) => - val restp1 = apply(restp); + val restp1 = apply(restp) if (restp1 eq restp) tp else PolyType(tparams, restp1) case _ => mapOver(tp) diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index a4b725d313..60815da967 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -143,7 +143,7 @@ abstract class LambdaLift extends InfoTransform { ss addEntry sym renamable addEntry sym changedFreeVars = true - debuglog("" + sym + " is free in " + enclosure); + debuglog("" + sym + " is free in " + enclosure) if (sym.isVariable) sym setFlag CAPTURED } !enclosure.isClass @@ -161,7 +161,7 @@ abstract class LambdaLift extends InfoTransform { private val freeVarTraverser = new Traverser { override def traverse(tree: Tree) { try { //debug - val sym = tree.symbol; + val sym = tree.symbol tree match { case ClassDef(_, _, _, _) => liftedDefs(tree.symbol) = Nil diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala index 3e5ac6922e..74459efc92 100644 --- a/src/compiler/scala/tools/nsc/transform/Mixin.scala +++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala @@ -27,7 +27,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { private val treatedClassInfos = perRunCaches.newMap[Symbol, Type]() withDefaultValue NoType /** Map a lazy, mixedin field accessor to it's trait member accessor */ - private val initializer = perRunCaches.newMap[Symbol, Symbol] + private val initializer = perRunCaches.newMap[Symbol, Symbol]() // --------- helper functions ----------------------------------------------- @@ -126,7 +126,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { " " + mixinClass + " " + base.info.baseClasses + "/" + bcs) while (!bcs.isEmpty && sym == NoSymbol) { if (settings.debug.value) { - val other = bcs.head.info.nonPrivateDecl(member.name); + val other = bcs.head.info.nonPrivateDecl(member.name) debuglog("rebindsuper " + bcs.head + " " + other + " " + other.tpe + " " + other.isDeferred) } @@ -242,7 +242,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { } } } - debuglog("new defs of " + clazz + " = " + clazz.info.decls); + debuglog("new defs of " + clazz + " = " + clazz.info.decls) } } @@ -821,8 +821,8 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL { * Private fields used only in this initializer are subsequently set to null. * * @param clazz The class symbol + * @param lzyVal The symbol of this lazy field * @param init The tree which initializes the field ( f = <rhs> ) - * @param fieldSym The symbol of this lazy field * @param offset The offset of this field in the flags bitmap * * The result will be a tree of the form diff --git a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala index 28e6e3be26..2610679542 100644 --- a/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala +++ b/src/compiler/scala/tools/nsc/transform/OverridingPairs.scala @@ -86,10 +86,10 @@ abstract class OverridingPairs { { def fillDecls(bcs: List[Symbol], deferredflag: Int) { if (!bcs.isEmpty) { fillDecls(bcs.tail, deferredflag) - var e = bcs.head.info.decls.elems; + var e = bcs.head.info.decls.elems while (e ne null) { if (e.sym.getFlag(DEFERRED) == deferredflag.toLong && !exclude(e.sym)) - decls enter e.sym; + decls enter e.sym e = e.next } } @@ -134,7 +134,7 @@ abstract class OverridingPairs { private val subParents = new Array[BitSet](size) { for (i <- List.range(0, size)) - subParents(i) = new BitSet(size); + subParents(i) = new BitSet(size) for (p <- parents) { val pIndex = index(p.typeSymbol) if (pIndex >= 0) @@ -190,7 +190,7 @@ abstract class OverridingPairs { if (nextEntry ne null) { do { do { - nextEntry = decls.lookupNextEntry(nextEntry); + nextEntry = decls.lookupNextEntry(nextEntry) /* DEBUG if ((nextEntry ne null) && !(nextEntry.sym hasFlag PRIVATE) && @@ -208,19 +208,19 @@ abstract class OverridingPairs { // overriding and nextEntry.sym } while ((nextEntry ne null) && (hasCommonParentAsSubclass(overriding, nextEntry.sym))) if (nextEntry ne null) { - overridden = nextEntry.sym; + overridden = nextEntry.sym //Console.println("yield: " + overriding + overriding.locationString + " / " + overridden + overridden.locationString);//DEBUG } else { do { curEntry = curEntry.next - } while ((curEntry ne null) && (visited contains curEntry)); + } while ((curEntry ne null) && (visited contains curEntry)) nextEntry = curEntry - next + next() } } } } - next + next() } } diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala index c375bc4362..b2d05f98b1 100644 --- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala +++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala @@ -31,7 +31,7 @@ abstract class TailCalls extends Transform { class Phase(prev: scala.tools.nsc.Phase) extends StdPhase(prev) { def apply(unit: global.CompilationUnit) { if (!(settings.debuginfo.value == "notailcalls")) { - newTransformer(unit).transformUnit(unit); + newTransformer(unit).transformUnit(unit) } } } diff --git a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala index 9af4800a70..499bf1b022 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/Logic.scala @@ -113,7 +113,7 @@ trait Logic extends Debugging { case object False extends Prop // symbols are propositions - abstract case class Sym(val variable: Var, val const: Const) extends Prop { + abstract case class Sym(variable: Var, const: Const) extends Prop { private[this] val id = Sym.nextSymId override def toString = variable +"="+ const +"#"+ id @@ -212,7 +212,7 @@ trait Logic extends Debugging { } props foreach gatherEqualities.apply - if (modelNull) vars foreach (_.registerNull) + if (modelNull) vars foreach (_.registerNull()) val pure = props map (p => eqFreePropToSolvable(rewriteEqualsToProp(p))) @@ -548,7 +548,7 @@ trait ScalaLogic extends Logic { self: PatternMatching => val staticTpCheckable: Type = checkableType(staticTp) private[this] var _mayBeNull = false - def registerNull(): Unit = { ensureCanModify; if (NullTp <:< staticTpCheckable) _mayBeNull = true } + def registerNull(): Unit = { ensureCanModify(); if (NullTp <:< staticTpCheckable) _mayBeNull = true } def mayBeNull: Boolean = _mayBeNull // case None => domain is unknown, @@ -572,16 +572,16 @@ trait ScalaLogic extends Logic { self: PatternMatching => } else subConsts - observed; allConsts + observed(); allConsts } // populate equalitySyms // don't care about the result, but want only one fresh symbol per distinct constant c - def registerEquality(c: Const): Unit = {ensureCanModify; symForEqualsTo getOrElseUpdate(c, Sym(this, c))} + def registerEquality(c: Const): Unit = {ensureCanModify(); symForEqualsTo getOrElseUpdate(c, Sym(this, c))} // return the symbol that represents this variable being equal to the constant `c`, if it exists, otherwise False (for robustness) // (registerEquality(c) must have been called prior, either when constructing the domain or from outside) - def propForEqualsTo(c: Const): Prop = {observed; symForEqualsTo.getOrElse(c, False)} + def propForEqualsTo(c: Const): Prop = {observed(); symForEqualsTo.getOrElse(c, False)} // [implementation NOTE: don't access until all potential equalities have been registered using registerEquality]p /** the information needed to construct the boolean proposition that encods the equality proposition (V = C) @@ -689,7 +689,7 @@ trait ScalaLogic extends Logic { self: PatternMatching => lazy val symForStaticTp: Option[Sym] = symForEqualsTo.get(TypeConst(staticTpCheckable)) // don't access until all potential equalities have been registered using registerEquality - private lazy val equalitySyms = {observed; symForEqualsTo.values.toList} + private lazy val equalitySyms = {observed(); symForEqualsTo.values.toList} // don't call until all equalities have been registered and registerNull has been called (if needed) def describe = { diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala index 82f13d9777..3ee9009116 100644 --- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala +++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala @@ -71,7 +71,7 @@ trait MatchTranslation { self: PatternMatching => } while (it.hasNext) { - val cdef = it.next + val cdef = it.next() // If a default case has been seen, then every succeeding case is unreachable. if (vpat != null) context.unit./*error*/warning(cdef.body.pos, "unreachable code due to " + vpat + addendum(cdef.pat)) @@ -173,7 +173,7 @@ trait MatchTranslation { self: PatternMatching => (caseScrutSym, propagateSubstitution(translateCase(caseScrutSym, pt)(caseDef), EmptySubstitution)) } - for(cases <- emitTypeSwitch(bindersAndCases, pt).toList; + for(cases <- emitTypeSwitch(bindersAndCases, pt).toList if cases forall treeInfo.isCatchCase; // must check again, since it's not guaranteed -- TODO: can we eliminate this? e.g., a type test could test for a trait or a non-trivial prefix, which are not handled by the back-end cse <- cases) yield fixerUpper(matchOwner, pos)(cse).asInstanceOf[CaseDef] } diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index b070bd1b49..eb91251930 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -590,7 +590,7 @@ trait Contexts { self: Analyzer => def restoreTypeBounds(tp: Type): Type = { var current = tp for ((sym, info) <- savedTypeBounds) { - debuglog("resetting " + sym + " to " + info); + debuglog("resetting " + sym + " to " + info) sym.info match { case TypeBounds(lo, hi) if (hi <:< lo && lo <:< hi) => current = current.instantiateTypeParams(List(sym), List(lo)) diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala index face149b9f..ad45fc0354 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala @@ -28,7 +28,7 @@ abstract class Duplicators extends Analyzer { if (oldThis ne newThis) { oldClassOwner = oldThis newClassOwner = newThis - } else resetClassOwners + } else resetClassOwners() envSubstitution = new SubstSkolemsTypeMap(env.keysIterator.toList, env.valuesIterator.toList) debuglog("retyped with env: " + env) diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 788825a6b6..c0391448d1 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1113,7 +1113,7 @@ trait Implicits { case ThisType(thisSym) => gen.mkAttributedThis(thisSym) case _ => - // if ``pre'' is not a PDT, e.g. if someone wrote + // if `pre` is not a PDT, e.g. if someone wrote // implicitly[scala.reflect.macros.Context#TypeTag[Int]] // then we need to fail, because we don't know the prefix to use during type reification // upd. we also need to fail silently, because this is a very common situation diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 0207c841d2..db3759d65f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -607,7 +607,7 @@ trait Infer extends Checkable { ) )) } - buf.result + buf.result() } /** Return inferred type arguments, given type parameters, formal parameters, @@ -618,7 +618,7 @@ trait Infer extends Checkable { * * @param tparams the type parameters of the method * @param formals the value parameter types of the method - * @param restp the result type of the method + * @param restpe the result type of the method * @param argtpes the argument types of the application * @param pt the expected return type of the application * @return @see adjustTypeArgs @@ -830,14 +830,11 @@ trait Infer extends Checkable { * such that function type `ftpe` is applicable to * `argtpes` and its result conform to `pt`? * - * @param undetparams ... * @param ftpe the type of the function (often a MethodType) - * @param argtpes the argument types; a NamedType(name, tp) for named + * @param argtpes0 the argument types; a NamedType(name, tp) for named * arguments. For each NamedType, if `name` does not exist in `ftpe`, that * type is set to `Unit`, i.e. the corresponding argument is treated as * an assignment expression (@see checkNames). - * @param pt ... - * @return ... */ private def isApplicable(undetparams: List[Symbol], ftpe: Type, argtpes0: List[Type], pt: Type): Boolean = @@ -1192,7 +1189,7 @@ trait Infer extends Checkable { * @param fn fn: the function that needs to be instantiated. * @param undetparams the parameters that need to be determined * @param args the actual arguments supplied in the call. - * @param pt the expected type of the function application + * @param pt0 the expected type of the function application * @return The type parameters that remain uninstantiated, * and that thus have not been substituted. */ @@ -1243,7 +1240,7 @@ trait Infer extends Checkable { * * @param tree the constuctor that needs to be instantiated * @param undetparams the undetermined type parameters - * @param pt the expected result type of the instance + * @param pt0 the expected result type of the instance */ def inferConstructorInstance(tree: Tree, undetparams: List[Symbol], pt0: Type) { val pt = abstractTypesToBounds(pt0) @@ -1600,7 +1597,7 @@ trait Infer extends Checkable { * with pt = WildcardType. * Otherwise, if there is no best alternative, error. * - * @param argtpes contains the argument types. If an argument is named, as + * @param argtpes0 contains the argument types. If an argument is named, as * "a = 3", the corresponding type is `NamedType("a", Int)'. If the name * of some NamedType does not exist in an alternative's parameter names, * the type is replaces by `Unit`, i.e. the argument is treated as an diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala index 8829a9a92e..1693bdbc8c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala @@ -70,19 +70,19 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { private case class MacroImplBinding( // Java class name of the class that contains the macro implementation // is used to load the corresponding object with Java reflection - val className: String, + className: String, // method name of the macro implementation // `className` and `methName` are all we need to reflectively invoke a macro implementation // because macro implementations cannot be overloaded - val methName: String, + methName: String, // flattens the macro impl's parameter lists having symbols replaced with metadata // currently metadata is an index of the type parameter corresponding to that type tag (if applicable) // f.ex. for: def impl[T: WeakTypeTag, U: WeakTypeTag, V](c: Context)(x: c.Expr[T]): (U, V) = ??? // `signature` will be equal to List(-1, -1, 0, 1) - val signature: List[Int], + signature: List[Int], // type arguments part of a macro impl ref (the right-hand side of a macro definition) // these trees don't refer to a macro impl, so we can pickle them as is - val targs: List[Tree]) + targs: List[Tree]) /** Macro def -> macro impl bindings are serialized into a `macroImpl` annotation * with synthetic content that carries the payload described in `MacroImplBinding`. @@ -481,7 +481,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { // a heuristic to detect the REPL if (global.settings.exposeEmptyPackage.value) { - macroLogVerbose("macro classloader: initializing from a REPL classloader".format(global.classPath.asURLs)) + macroLogVerbose("macro classloader: initializing from a REPL classloader: %s".format(global.classPath.asURLs)) import scala.tools.nsc.interpreter._ val virtualDirectory = global.settings.outputDirs.getSingleOutput.get new AbstractFileClassLoader(virtualDirectory, loader) {} @@ -500,7 +500,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { * `null` otherwise. */ type MacroRuntime = MacroArgs => Any - private val macroRuntimesCache = perRunCaches.newWeakMap[Symbol, MacroRuntime] + private val macroRuntimesCache = perRunCaches.newWeakMap[Symbol, MacroRuntime]() private def macroRuntime(macroDef: Symbol): MacroRuntime = { macroTraceVerbose("looking for macro implementation: ")(macroDef) if (fastTrack contains macroDef) { @@ -909,7 +909,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { * 2) undetparams (sym.isTypeParameter && !sym.isSkolem) */ var hasPendingMacroExpansions = false - private val delayed = perRunCaches.newWeakMap[Tree, scala.collection.mutable.Set[Int]] + private val delayed = perRunCaches.newWeakMap[Tree, scala.collection.mutable.Set[Int]]() private def isDelayed(expandee: Tree) = delayed contains expandee private def calculateUndetparams(expandee: Tree): scala.collection.mutable.Set[Int] = delayed.get(expandee).getOrElse { @@ -922,7 +922,7 @@ trait Macros extends scala.tools.reflect.FastTrack with Traces { macroLogVerbose("calculateUndetparams: %s".format(calculated)) calculated map (_.id) } - private val undetparams = perRunCaches.newSet[Int] + private val undetparams = perRunCaches.newSet[Int]() def notifyUndetparamsAdded(newUndets: List[Symbol]): Unit = { undetparams ++= newUndets map (_.id) if (macroDebugVerbose) newUndets foreach (sym => println("undetParam added: %s".format(sym))) diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index dd16e9de30..b7221a78ec 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -95,7 +95,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans class RefCheckTransformer(unit: CompilationUnit) extends Transformer { - var localTyper: analyzer.Typer = typer; + var localTyper: analyzer.Typer = typer var currentApplication: Tree = EmptyTree var inPattern: Boolean = false var checkedCombinations = Set[List[Type]]() @@ -386,11 +386,11 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans if (!isOverrideAccessOK) { overrideAccessError() } else if (other.isClass) { - overrideError("cannot be used here - class definitions cannot be overridden"); + overrideError("cannot be used here - class definitions cannot be overridden") } else if (!other.isDeferred && member.isClass) { - overrideError("cannot be used here - classes can only override abstract types"); + overrideError("cannot be used here - classes can only override abstract types") } else if (other.isEffectivelyFinal) { // (1.2) - overrideError("cannot override final member"); + overrideError("cannot override final member") } else if (!other.isDeferred && !member.isAnyOverride && !member.isSynthetic) { // (*) // (*) Synthetic exclusion for (at least) default getters, fixes SI-5178. We cannot assign the OVERRIDE flag to // the default getter: one default getter might sometimes override, sometimes not. Example in comment on ticket. @@ -449,7 +449,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans // @M: substSym if( !(sameLength(member.typeParams, other.typeParams) && (memberTp.substSym(member.typeParams, other.typeParams) =:= otherTp)) ) // (1.6) - overrideTypeError(); + overrideTypeError() } else if (other.isAbstractType) { //if (!member.typeParams.isEmpty) // (1.7) @MAT @@ -502,7 +502,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans case rt: RefinedType if !(rt =:= otherTp) && !(checkedCombinations contains rt.parents) => // might mask some inconsistencies -- check overrides checkedCombinations += rt.parents - val tsym = rt.typeSymbol; + val tsym = rt.typeSymbol if (tsym.pos == NoPosition) tsym setPos member.pos checkAllOverrides(tsym, typesOnly = true) case _ => @@ -523,9 +523,9 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans val opc = new overridingPairs.Cursor(clazz) while (opc.hasNext) { //Console.println(opc.overriding/* + ":" + opc.overriding.tpe*/ + " in "+opc.overriding.fullName + " overrides " + opc.overridden/* + ":" + opc.overridden.tpe*/ + " in "+opc.overridden.fullName + "/"+ opc.overridden.hasFlag(DEFERRED));//debug - if (!opc.overridden.isClass) checkOverride(opc.overriding, opc.overridden); + if (!opc.overridden.isClass) checkOverride(opc.overriding, opc.overridden) - opc.next + opc.next() } printMixinOverrideErrors() @@ -785,7 +785,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans // for (bc <- clazz.info.baseClasses.tail) Console.println("" + bc + " has " + bc.info.decl(member.name) + ":" + bc.info.decl(member.name).tpe);//DEBUG val nonMatching: List[Symbol] = clazz.info.member(member.name).alternatives.filterNot(_.owner == clazz).filterNot(_.isFinal) - def issueError(suffix: String) = unit.error(member.pos, member.toString() + " overrides nothing" + suffix); + def issueError(suffix: String) = unit.error(member.pos, member.toString() + " overrides nothing" + suffix) nonMatching match { case Nil => issueError("") @@ -840,7 +840,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans case tp1 :: tp2 :: _ => unit.error(clazz.pos, "illegal inheritance;\n " + clazz + " inherits different type instances of " + baseClass + - ":\n" + tp1 + " and " + tp2); + ":\n" + tp1 + " and " + tp2) explainTypes(tp1, tp2) explainTypes(tp2, tp1) } @@ -905,7 +905,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans val e = currentLevel.scope.lookupEntry(sym.name) if ((e ne null) && sym == e.sym) { var l = currentLevel - while (l.scope != e.owner) l = l.outer; + while (l.scope != e.owner) l = l.outer val symindex = symIndex(sym) if (l.maxindex < symindex) { l.refpos = pos @@ -1093,7 +1093,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans /* Convert a reference to a case factory of type `tpe` to a new of the class it produces. */ def toConstructor(pos: Position, tpe: Type): Tree = { val rtpe = tpe.finalResultType - assert(rtpe.typeSymbol hasFlag CASE, tpe); + assert(rtpe.typeSymbol hasFlag CASE, tpe) localTyper.typedOperator { atPos(pos) { Select(New(TypeTree(rtpe)), rtpe.typeSymbol.primaryConstructor) diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index f2129992e5..d8cedd119b 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -129,11 +129,11 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT val clazz = sup.symbol if (sym.isDeferred) { - val member = sym.overridingSymbol(clazz); + val member = sym.overridingSymbol(clazz) if (mix != tpnme.EMPTY || member == NoSymbol || !(member.isAbstractOverride && member.isIncompleteIn(clazz))) unit.error(sel.pos, ""+sym.fullLocationString+" is accessed from super. It may not be abstract "+ - "unless it is overridden by a member declared `abstract' and `override'"); + "unless it is overridden by a member declared `abstract' and `override'") } else if (mix == tpnme.EMPTY && !sym.owner.isTrait){ // SI-4989 Check if an intermediate class between `clazz` and `sym.owner` redeclares the method as abstract. val intermediateClasses = clazz.info.baseClasses.tail.takeWhile(_ != sym.owner) @@ -332,8 +332,8 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT lhs.symbol.isJavaDefined && needsProtectedAccessor(lhs.symbol, tree.pos)) { debuglog("Adding protected setter for " + tree) - val setter = makeSetter(lhs); - debuglog("Replaced " + tree + " with " + setter); + val setter = makeSetter(lhs) + debuglog("Replaced " + tree + " with " + setter) transform(localTyper.typed(Apply(setter, List(qual, rhs)))) } else super.transform(tree) diff --git a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala index 52497411d1..5c863469e4 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala @@ -148,7 +148,7 @@ abstract class TreeCheckers extends Analyzer { val unit0 = currentUnit currentRun.currentUnit = unit body - currentRun.advanceUnit + currentRun.advanceUnit() assertFn(currentUnit == unit, "currentUnit is " + currentUnit + ", but unit is " + unit) currentRun.currentUnit = unit0 } @@ -156,7 +156,7 @@ abstract class TreeCheckers extends Analyzer { informProgress("checking "+unit) val context = rootContext(unit) context.checking = true - tpeOfTree.clear + tpeOfTree.clear() SymbolTracker.check(phase, unit) val checker = new TreeChecker(context) runWithUnit(unit) { diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index 81ea5630d0..71470222bf 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -574,7 +574,7 @@ trait TypeDiagnostics { /** Report a type error. * - * @param pos0 The position where to report the error + * @param pos The position where to report the error * @param ex The exception that caused the error */ def reportTypeError(context0: Context, pos: Position, ex: TypeError) { diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 561ca7f382..c40b69bc7a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -181,7 +181,7 @@ trait Typers extends Adaptations with Tags { def inferView(tree: Tree, from: Type, to: Type, reportAmbiguous: Boolean): Tree = inferView(tree, from, to, reportAmbiguous, true) - /** Infer an implicit conversion (``view'') between two types. + /** Infer an implicit conversion (`view`) between two types. * @param tree The tree which needs to be converted. * @param from The source type of the conversion * @param to The target type of the conversion @@ -1893,7 +1893,7 @@ trait Typers extends Adaptations with Tags { */ def typedTemplate(templ: Template, parents1: List[Tree]): Template = { val clazz = context.owner - clazz.annotations.map(_.completeInfo) + clazz.annotations.map(_.completeInfo()) if (templ.symbol == NoSymbol) templ setSymbol clazz.newLocalDummy(templ.pos) val self1 = templ.self match { @@ -1964,14 +1964,14 @@ trait Typers extends Adaptations with Tags { } /** Remove definition annotations from modifiers (they have been saved - * into the symbol's ``annotations'' in the type completer / namer) + * into the symbol's `annotations` in the type completer / namer) * * However reification does need annotation definitions to proceed. * Unfortunately, AnnotationInfo doesn't provide enough info to reify it in general case. * The biggest problem is with the "atp: Type" field, which cannot be reified in some situations * that involve locally defined annotations. See more about that in Reifiers.scala. * - * That's why the original tree gets saved into ``original'' field of AnnotationInfo (happens elsewhere). + * That's why the original tree gets saved into `original` field of AnnotationInfo (happens elsewhere). * The field doesn't get pickled/unpickled and exists only during a single compilation run. * This simultaneously allows us to reify annotations and to preserve backward compatibility. */ @@ -1994,7 +1994,7 @@ trait Typers extends Adaptations with Tags { val sym = vdef.symbol.initialize val typedMods = typedModifiers(vdef.mods) - sym.annotations.map(_.completeInfo) + sym.annotations.map(_.completeInfo()) val tpt1 = checkNoEscaping.privates(sym, typedType(vdef.tpt)) checkNonCyclic(vdef, tpt1) @@ -2209,7 +2209,7 @@ trait Typers extends Adaptations with Tags { val tparams1 = ddef.tparams mapConserve typedTypeDef val vparamss1 = ddef.vparamss mapConserve (_ mapConserve typedValDef) - meth.annotations.map(_.completeInfo) + meth.annotations.map(_.completeInfo()) for (vparams1 <- vparamss1; vparam1 <- vparams1 dropRight 1) if (isRepeatedParamType(vparam1.symbol.tpe)) @@ -2283,7 +2283,7 @@ trait Typers extends Adaptations with Tags { reenterTypeParams(tdef.tparams) val tparams1 = tdef.tparams mapConserve typedTypeDef val typedMods = typedModifiers(tdef.mods) - tdef.symbol.annotations.map(_.completeInfo) + tdef.symbol.annotations.map(_.completeInfo()) // @specialized should not be pickled when compiling with -no-specialize if (settings.nospecialization.value && currentRun.compiles(tdef.symbol)) { @@ -2720,13 +2720,6 @@ trait Typers extends Adaptations with Tags { } } - - /** - * @param fun ... - * @param mode ... - * @param pt ... - * @return ... - */ private def typedFunction(fun: Function, mode: Mode, pt: Type): Tree = { val numVparams = fun.vparams.length if (numVparams > definitions.MaxFunctionArity) diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala index c51fc442dc..f125db3839 100644 --- a/src/compiler/scala/tools/nsc/util/ClassPath.scala +++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala @@ -254,7 +254,7 @@ class SourcePath[T](dir: AbstractFile, val context: ClassPathContext[T]) extends else if (f.isDirectory && validPackage(f.name)) packageBuf += new SourcePath[T](f, context) } - (packageBuf.result, classBuf.result) + (packageBuf.result(), classBuf.result()) } lazy val (packages, classes) = traverse() @@ -281,7 +281,7 @@ class DirectoryClassPath(val dir: AbstractFile, val context: ClassPathContext[Ab else if (f.isDirectory && validPackage(f.name)) packageBuf += new DirectoryClassPath(f, context) } - (packageBuf.result, classBuf.result) + (packageBuf.result(), classBuf.result()) } lazy val (packages, classes) = traverse() diff --git a/src/compiler/scala/tools/nsc/util/DocStrings.scala b/src/compiler/scala/tools/nsc/util/DocStrings.scala index dde53dc640..ba44126df2 100755 --- a/src/compiler/scala/tools/nsc/util/DocStrings.scala +++ b/src/compiler/scala/tools/nsc/util/DocStrings.scala @@ -74,7 +74,7 @@ object DocStrings { else idx :: findAll(str, idx)(p) } - /** Produces a string index, which is a list of ``sections'', i.e + /** Produces a string index, which is a list of `sections`, i.e * pairs of start/end positions of all tagged sections in the string. * Every section starts with an at sign and extends to the next at sign, * or to the end of the comment string, but excluding the final two diff --git a/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala b/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala index fc3dd2bac2..26d19906c2 100644 --- a/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala +++ b/src/compiler/scala/tools/nsc/util/JavaCharArrayReader.scala @@ -35,7 +35,7 @@ class JavaCharArrayReader(buf: IndexedSeq[Char], start: Int, /* startline: int, ch match { case '\t' => case CR => - if (bp < buf.size && buf(bp) == LF) { + if (bp < buf.length && buf(bp) == LF) { ch = LF bp += 1 } @@ -49,13 +49,13 @@ class JavaCharArrayReader(buf: IndexedSeq[Char], start: Int, /* startline: int, def udigit: Int = { val d = digit2int(buf(bp), 16) if (d >= 0) bp += 1 - else error("error in unicode escape"); + else error("error in unicode escape") d } if (buf(bp) == 'u' && decodeUni && evenSlashPrefix) { do { bp += 1 //; nextcol += 1 - } while (buf(bp) == 'u'); + } while (buf(bp) == 'u') val code = udigit << 12 | udigit << 8 | udigit << 4 | udigit ch = code.asInstanceOf[Char] isUnicode = true diff --git a/src/compiler/scala/tools/nsc/util/ShowPickled.scala b/src/compiler/scala/tools/nsc/util/ShowPickled.scala index 759c06dc0f..4bc393bd0b 100644 --- a/src/compiler/scala/tools/nsc/util/ShowPickled.scala +++ b/src/compiler/scala/tools/nsc/util/ShowPickled.scala @@ -250,7 +250,7 @@ object ShowPickled extends Names { case SYMANNOT => printSymbolRef(); printTypeRef(); buf.until(end, printAnnotArgRef) case ANNOTATEDtpe => - printTypeRef(); buf.until(end, printAnnotInfoRef); + printTypeRef(); buf.until(end, printAnnotInfoRef) case ANNOTINFO => printTypeRef(); buf.until(end, printAnnotArgRef) case ANNOTARGARRAY => @@ -271,7 +271,7 @@ object ShowPickled extends Names { for (i <- 0 until index.length) printEntry(i) } - def fromFile(path: String) = fromBytes(io.File(path).toByteArray) + def fromFile(path: String) = fromBytes(io.File(path).toByteArray()) def fromName(name: String) = fromBytes(scalaSigBytesForPath(name) getOrElse Array()) def fromBytes(data: => Array[Byte]): Option[PickleBuffer] = try Some(new PickleBuffer(data, 0, data.length)) diff --git a/src/compiler/scala/tools/reflect/FrontEnd.scala b/src/compiler/scala/tools/reflect/FrontEnd.scala index f0d3d5973d..e3341a451f 100644 --- a/src/compiler/scala/tools/reflect/FrontEnd.scala +++ b/src/compiler/scala/tools/reflect/FrontEnd.scala @@ -21,7 +21,7 @@ trait FrontEnd { def hasErrors = ERROR.count > 0 def hasWarnings = WARNING.count > 0 - case class Info(val pos: Position, val msg: String, val severity: Severity) + case class Info(pos: Position, msg: String, severity: Severity) val infos = new scala.collection.mutable.LinkedHashSet[Info] /** Handles incoming info */ diff --git a/src/compiler/scala/tools/reflect/MacroImplementations.scala b/src/compiler/scala/tools/reflect/MacroImplementations.scala index ab967496c4..002a3fce82 100644 --- a/src/compiler/scala/tools/reflect/MacroImplementations.scala +++ b/src/compiler/scala/tools/reflect/MacroImplementations.scala @@ -26,7 +26,7 @@ abstract class MacroImplementations { "too many arguments for interpolated string") } val stringParts = parts map { - case Literal(Constant(s: String)) => s; + case Literal(Constant(s: String)) => s case _ => throw new IllegalArgumentException("argument parts must be a list of string literals") } @@ -88,7 +88,7 @@ abstract class MacroImplementations { var idx = 0 if (!first) { - val arg = argsStack.pop + val arg = argsStack.pop() if (strIsEmpty || (str charAt 0) != '%') { bldr append "%s" defval(arg, AnyTpe) @@ -141,7 +141,7 @@ abstract class MacroImplementations { Literal(Constant(fstring)), newTermName("format")), List(ids: _* ) - ); + ) Block(evals.toList, atPos(origApplyPos.focus)(expr)) setPos origApplyPos.makeTransparent } diff --git a/src/compiler/scala/tools/reflect/ToolBox.scala b/src/compiler/scala/tools/reflect/ToolBox.scala index ab814b617d..be22003114 100644 --- a/src/compiler/scala/tools/reflect/ToolBox.scala +++ b/src/compiler/scala/tools/reflect/ToolBox.scala @@ -101,4 +101,4 @@ trait ToolBox[U <: scala.reflect.api.Universe] { /** Represents an error during toolboxing */ -case class ToolBoxError(val message: String, val cause: Throwable = null) extends Throwable(message, cause) +case class ToolBoxError(message: String, cause: Throwable = null) extends Throwable(message, cause) diff --git a/src/compiler/scala/tools/reflect/package.scala b/src/compiler/scala/tools/reflect/package.scala index bf533766d0..968b0d0863 100644 --- a/src/compiler/scala/tools/reflect/package.scala +++ b/src/compiler/scala/tools/reflect/package.scala @@ -32,7 +32,7 @@ package object reflect { /** Creates a reporter that prints messages to the console according to the settings. * - * ``minSeverity'' determines minimum severity of the messages to be printed. + * `minSeverity` determines minimum severity of the messages to be printed. * 0 stands for INFO, 1 stands for WARNING and 2 stands for ERROR. */ // todo. untangle warningsAsErrors from Reporters. I don't feel like moving this flag here! diff --git a/src/compiler/scala/tools/util/Javap.scala b/src/compiler/scala/tools/util/Javap.scala index cbfd8fec51..181bbedac5 100644 --- a/src/compiler/scala/tools/util/Javap.scala +++ b/src/compiler/scala/tools/util/Javap.scala @@ -98,7 +98,7 @@ class JavapClass( * it represents. */ def tryFile(path: String): Option[Array[Byte]] = - (Try (File(path.asClassResource)) filter (_.exists) map (_.toByteArray)).toOption + (Try (File(path.asClassResource)) filter (_.exists) map (_.toByteArray())).toOption /** Assume the string is a fully qualified class name and try to * find the class object it represents. @@ -209,7 +209,7 @@ class JavapClass( } filtering } - for (line <- Source.fromString(preamble + written).getLines; if checkFilter(line)) + for (line <- Source.fromString(preamble + written).getLines(); if checkFilter(line)) printWriter write line+lineSeparator printWriter.flush() } @@ -371,7 +371,7 @@ class JavapClass( case x => Failure(x) } } lastly { - reporter.clear + reporter.clear() } override def apply(raw: Boolean, options: Seq[String])(inputs: Seq[Input]): List[JpResult] = (inputs map { case (claas, Success(_)) => applyOne(raw, options, claas, inputs).get diff --git a/src/compiler/scala/tools/util/PathResolver.scala b/src/compiler/scala/tools/util/PathResolver.scala index 5d79a7d6cd..a6c0f0f5c2 100644 --- a/src/compiler/scala/tools/util/PathResolver.scala +++ b/src/compiler/scala/tools/util/PathResolver.scala @@ -139,7 +139,7 @@ object PathResolver { val pr = new PathResolver(settings) println(" COMMAND: 'scala %s'".format(args.mkString(" "))) println("RESIDUAL: 'scala %s'\n".format(rest.mkString(" "))) - pr.result.show + pr.result.show() } } } diff --git a/src/compiler/scala/tools/util/SocketServer.scala b/src/compiler/scala/tools/util/SocketServer.scala index 1b06ce2ff2..7da9479dab 100644 --- a/src/compiler/scala/tools/util/SocketServer.scala +++ b/src/compiler/scala/tools/util/SocketServer.scala @@ -16,8 +16,8 @@ trait CompileOutputCommon { def verbose: Boolean def info(msg: String) = if (verbose) echo(msg) - def echo(msg: String) = {Console println msg; Console.flush} - def warn(msg: String) = {Console.err println msg; Console.flush} + def echo(msg: String) = {Console println msg; Console.flush()} + def warn(msg: String) = {Console.err println msg; Console.flush()} def fatal(msg: String) = { warn(msg) ; sys.exit(1) } } |