summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-02-26 01:38:49 +0000
committerPaul Phillips <paulp@improving.org>2009-02-26 01:38:49 +0000
commit4e52d412b12f785b3518d51d70e034cc67cf807c (patch)
tree2557fd0a40163b39ce438ab013c18a09857f00fb /src/library
parent166afcab412d1fdbcef19de3421effc4e886f417 (diff)
downloadscala-4e52d412b12f785b3518d51d70e034cc67cf807c.tar.gz
scala-4e52d412b12f785b3518d51d70e034cc67cf807c.tar.bz2
scala-4e52d412b12f785b3518d51d70e034cc67cf807c.zip
Fix for #749.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/runtime/RichString.scala10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/library/scala/runtime/RichString.scala b/src/library/scala/runtime/RichString.scala
index ef76ff2a2e..caa0f6f036 100644
--- a/src/library/scala/runtime/RichString.scala
+++ b/src/library/scala/runtime/RichString.scala
@@ -221,7 +221,6 @@ final class RichString(val self: String) extends Proxy with RandomAccessSeq[Char
result
}
-
/** <p>
* Uses the underlying string as a pattern (in a fashion similar to
* printf in C), and uses the supplied arguments to fill in the
@@ -236,12 +235,9 @@ final class RichString(val self: String) extends Proxy with RandomAccessSeq[Char
* @param args the arguments used to instantiating the pattern.
* @throws java.lang.IllegalArgumentException
*/
- def format(args : Any*) : String = {
- val m = classOf[String].getDeclaredMethod("format", classOf[String], classOf[Array[Object]])
- m.invoke(null, self,
- args.asInstanceOf[scala.runtime.BoxedObjectArray[_]].
- unbox(args.getClass).asInstanceOf[Array[Object]]).asInstanceOf[String]
- }
+ def format(args : Any*) : String =
+ // the toList is necessary right now because Array(1,2,3).toArray[Any] throws a CCE
+ java.lang.String.format(self, args.toList.toArray[Any].asInstanceOf[Array[AnyRef]]: _*)
}
object RichString {