diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/List.scala | 4 | ||||
-rw-r--r-- | src/library/scala/Seq.scala | 2 | ||||
-rw-r--r-- | src/library/scala/Stream.scala | 9 | ||||
-rw-r--r-- | src/library/scala/io/Position.scala | 3 | ||||
-rw-r--r-- | src/library/scala/io/Source.scala | 19 | ||||
-rwxr-xr-x | src/library/scala/runtime/RichString.scala | 3 | ||||
-rw-r--r-- | src/library/scala/testing/SUnit.scala | 3 | ||||
-rw-r--r-- | src/library/scala/util/automata/DetWordAutom.scala | 2 | ||||
-rw-r--r-- | src/library/scala/util/automata/NondetWordAutom.scala | 2 | ||||
-rw-r--r-- | src/library/scala/util/parsing/SimpleTokenizer.scala | 3 |
10 files changed, 25 insertions, 25 deletions
diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala index 205ffc75c6..af3ebff450 100644 --- a/src/library/scala/List.scala +++ b/src/library/scala/List.scala @@ -11,7 +11,7 @@ package scala; - +import scala.runtime.compat.StringBuilder import Predef._; import scala.collection.mutable.ListBuffer; @@ -213,7 +213,7 @@ object List { * @return the list in form of a string. */ def toString(xs: List[Char]): String = { - val sb = new StringBuffer(); + val sb = new StringBuilder(); var xc = xs; while (!xc.isEmpty) { sb.append(xc.head); diff --git a/src/library/scala/Seq.scala b/src/library/scala/Seq.scala index b591d5fe1f..d6d164385a 100644 --- a/src/library/scala/Seq.scala +++ b/src/library/scala/Seq.scala @@ -190,7 +190,7 @@ trait Seq[+A] extends AnyRef with PartialFunction[Int, A] with Iterable[A] { * @return a string representation of this sequence. */ def mkString(start: String, sep: String, end: String): String = { - val buf = new StringBuffer() + val buf = new StringBuilder() buf.append(start) val elems = elements if (elems.hasNext) buf.append(elems.next) diff --git a/src/library/scala/Stream.scala b/src/library/scala/Stream.scala index 2319d642fb..f122bdec8d 100644 --- a/src/library/scala/Stream.scala +++ b/src/library/scala/Stream.scala @@ -11,6 +11,7 @@ package scala; +import scala.runtime.compat.StringBuilder; /** * The object <code>Stream</code> provides helper functions @@ -25,7 +26,7 @@ object Stream { def isEmpty = true; def head: Nothing = error("head of empty stream"); def tail: Stream[Nothing] = error("tail of empty stream"); - def printElems(buf: StringBuffer, prefix: String): StringBuffer = buf; + def printElems(buf: StringBuilder, prefix: String): StringBuilder = buf; } def cons[a](hd: a, tl: => Stream[a]) = new Stream[a] { @@ -37,7 +38,7 @@ object Stream { if (!tlDefined) { tlVal = tl; tlDefined = true; } tlVal } - def printElems(buf: StringBuffer, prefix: String): StringBuffer = { + def printElems(buf: StringBuilder, prefix: String): StringBuilder = { val buf1 = buf.append(prefix).append(hd); if (tlDefined) tlVal.printElems(buf1, ", ") else buf1 append ", ?"; } @@ -297,7 +298,7 @@ trait Stream[+a] extends Seq[a] { } override def toString() = - "Stream(" + printElems(new StringBuffer(), "") + ")" + "Stream(" + printElems(new StringBuilder(), "") + ")" - def printElems(buf: StringBuffer, prefix: String): StringBuffer + def printElems(buf: StringBuilder, prefix: String): StringBuilder } diff --git a/src/library/scala/io/Position.scala b/src/library/scala/io/Position.scala index 74a2b62fe8..6cb952d378 100644 --- a/src/library/scala/io/Position.scala +++ b/src/library/scala/io/Position.scala @@ -11,6 +11,7 @@ package scala.io; +import scala.runtime.compat.StringBuilder; /** convenience methods to encode line and column number in one * single integer. The encode line (column) @@ -86,7 +87,7 @@ object Position { /** Returns a string representation of the encoded position. */ def toString(pos: Int): String = { - val sb = new StringBuffer(); + val sb = new StringBuilder(); sb.append(line(pos)); sb.append(':'); sb.append(column(pos)); diff --git a/src/library/scala/io/Source.scala b/src/library/scala/io/Source.scala index fa44200948..f9d1975bc2 100644 --- a/src/library/scala/io/Source.scala +++ b/src/library/scala/io/Source.scala @@ -11,7 +11,7 @@ package scala.io; - +import scala.runtime.compat.StringBuilder; import java.io.{ File, FileInputStream, PrintStream }; /** convenience methods to create an iterable representation of a source @@ -98,10 +98,7 @@ object Source { } def setFileDescriptor(file: File, s: Source): Source = { - s.descr = new StringBuffer() - .append( "file:" ) - .append( file.getAbsolutePath() ) - .toString(); + s.descr = new StringBuilder().append( "file:" ).append( file.getAbsolutePath() ).toString(); s } @@ -177,13 +174,13 @@ abstract class Source extends Iterator[Char] { while( it.hasNext && i < (line-1)) if('\n' == it.next) - i = i + 1; + i = i + 1; - if(!it.hasNext) { // this should not happen + if(!it.hasNext) // this should not happen throw new java.lang.IllegalArgumentException( "line "+line+" does not exist?!" ); - } + var ch = it.next; while(it.hasNext && '\n' != ch) { buf.append( ch ); @@ -193,7 +190,6 @@ abstract class Source extends Iterator[Char] { buf.setLength( 0 ); res } - /** returns true if this source has more characters */ def hasNext = iter.hasNext; @@ -207,7 +203,7 @@ abstract class Source extends Iterator[Char] { ch match { case '\n' => ccol = 1; - cline = cline + 1; + cline = cline + 1; case '\t' => ccol = ccol + tabinc; case _ => @@ -218,9 +214,8 @@ abstract class Source extends Iterator[Char] { /** reports an error message to console */ - def reportError(pos: Int, msg: String): Unit = { + def reportError(pos: Int, msg: String): Unit = report(pos, msg, java.lang.System.out); - } def reportError(pos: Int, msg: String, out: PrintStream): Unit = { nerrors = nerrors + 1; diff --git a/src/library/scala/runtime/RichString.scala b/src/library/scala/runtime/RichString.scala index c1413997ce..8c6087a878 100755 --- a/src/library/scala/runtime/RichString.scala +++ b/src/library/scala/runtime/RichString.scala @@ -8,6 +8,7 @@ // $Id: RichString.scala 7771 2006-06-12 13:22:39Z dubochet $ package scala.runtime +import scala.runtime.compat.StringBuilder final class RichString(s: String) { @@ -71,7 +72,7 @@ final class RichString(s: String) { * `marginChar' from the line. */ def stripMargin(marginChar: Char): String = { - val buf = new StringBuffer() + val buf = new StringBuilder() for (val line <- linesWithSeparators) { val len = line.length var index = 0; diff --git a/src/library/scala/testing/SUnit.scala b/src/library/scala/testing/SUnit.scala index a56b667ca9..1468959929 100644 --- a/src/library/scala/testing/SUnit.scala +++ b/src/library/scala/testing/SUnit.scala @@ -11,6 +11,7 @@ package scala.testing; +import scala.runtime.compat.StringBuilder /** * Unit testing methods in the spirit of JUnit framework. @@ -80,7 +81,7 @@ object SUnit { failedTest.toString()+" failed due to "+thrownException.toString(); def trace(): String = { - val s = new StringBuffer(); + val s = new StringBuilder(); for(val trElem <- thrownException.getStackTrace()) { s.append(trElem.toString()); s.append('\n'); diff --git a/src/library/scala/util/automata/DetWordAutom.scala b/src/library/scala/util/automata/DetWordAutom.scala index d7f07229ba..3b1cf13644 100644 --- a/src/library/scala/util/automata/DetWordAutom.scala +++ b/src/library/scala/util/automata/DetWordAutom.scala @@ -40,7 +40,7 @@ abstract class DetWordAutom[T <: AnyRef] { } override def toString() = { - val sb = new StringBuffer(); + val sb = new scala.runtime.compat.StringBuilder(); sb.append("[DetWordAutom nstates="); sb.append(nstates); sb.append(" finals="); diff --git a/src/library/scala/util/automata/NondetWordAutom.scala b/src/library/scala/util/automata/NondetWordAutom.scala index c359ed672a..64f50df82a 100644 --- a/src/library/scala/util/automata/NondetWordAutom.scala +++ b/src/library/scala/util/automata/NondetWordAutom.scala @@ -86,7 +86,7 @@ abstract class NondetWordAutom[T <: AnyRef] { } override def toString() = { - val sb = new StringBuffer(); + val sb = new scala.runtime.compat.StringBuilder(); sb.append("[NondetWordAutom nstates="); sb.append(nstates); sb.append(" finals="); diff --git a/src/library/scala/util/parsing/SimpleTokenizer.scala b/src/library/scala/util/parsing/SimpleTokenizer.scala index 43d819a336..ca25ac7068 100644 --- a/src/library/scala/util/parsing/SimpleTokenizer.scala +++ b/src/library/scala/util/parsing/SimpleTokenizer.scala @@ -11,6 +11,7 @@ package scala.util.parsing; +import scala.runtime.compat.StringBuilder; class SimpleTokenizer(in: Iterator[char], delimiters: String) extends Iterator[String] { @@ -34,7 +35,7 @@ class SimpleTokenizer(in: Iterator[char], delimiters: String) extends Iterator[S private var ch: int = nextChar; - private val buf = new StringBuffer(); + private val buf = new StringBuilder(); def hasNext: boolean = ch != EOI; |