summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2011-05-02 10:18:52 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2011-05-02 10:18:52 +0000
commitcb6a345a2f35f2f85832c9bf2f509c6f98a40d01 (patch)
treede8db551cbe7fd2d89c4885d670ac896f9d1c3dc /src/library
parent960edcd25172b6cc98b573379ef8d4cc960ddec2 (diff)
downloadscala-cb6a345a2f35f2f85832c9bf2f509c6f98a40d01.tar.gz
scala-cb6a345a2f35f2f85832c9bf2f509c6f98a40d01.tar.bz2
scala-cb6a345a2f35f2f85832c9bf2f509c6f98a40d01.zip
Merged revisions 24830-24831,24834-24862 via sv...
Merged revisions 24830-24831,24834-24862 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r24830 | extempore | 2011-04-26 21:00:24 +0200 (Tue, 26 Apr 2011) | 1 line Some solid progress on the pattern matcher, no review. ........ r24831 | odersky | 2011-04-27 12:26:39 +0200 (Wed, 27 Apr 2011) | 1 line More bridges in collections. Review by prokopec. ........ r24834 | extempore | 2011-04-27 20:35:47 +0200 (Wed, 27 Apr 2011) | 1 line Fixed inversion of fsc's exit code, closes #4519 no review. ........ r24835 | extempore | 2011-04-27 20:36:04 +0200 (Wed, 27 Apr 2011) | 2 lines Fixed a booch I made in io.Position's positioning. Closes #4498, no review. ........ r24836 | extempore | 2011-04-27 20:36:16 +0200 (Wed, 27 Apr 2011) | 1 line A little cleanup on a repl command, no review. ........ r24837 | extempore | 2011-04-27 20:36:32 +0200 (Wed, 27 Apr 2011) | 5 lines Trying to fix the pattern matcher took me into the lambda lifter, and I made some changes which seemed sensible to me. I'm going to be a stickler about eliminating mutable maps which hold mutable listbuffers. I could use some confirmation that I didn't somehow break the world: review by dragos. ........ r24838 | extempore | 2011-04-27 20:36:47 +0200 (Wed, 27 Apr 2011) | 4 lines Trying out a different strategy for restoring terminal settings so we don't have a list of hardcoded terminal types. Now it saves the terminal settings on script start and restores those on exit. Closes #4170, review by rytz. ........ r24839 | extempore | 2011-04-28 01:49:27 +0200 (Thu, 28 Apr 2011) | 1 line Cleaned up some hopelessly atrophied documentation, no review. ........ r24840 | extempore | 2011-04-28 03:10:22 +0200 (Thu, 28 Apr 2011) | 4 lines Upgraded -d so you can output classes directly to a jar. Very (very) loosely based on a patch from dmharrah. Like dmharrah before me, I see little if any change in compile times, which I find difficult to explain. Closes #27, review by dmharrah. ........ r24841 | extempore | 2011-04-28 17:12:42 +0200 (Thu, 28 Apr 2011) | 5 lines Improvements to the AST browser contributed by Yuvi Masory. Uses Nimbus LAF when available and improves readability by padding components. Adds menu items and key bindings for expanding and contracting nodes, closing the browser and continuing compilation, and closing the browser and aborting. No review. ........ r24842 | extempore | 2011-04-28 18:23:45 +0200 (Thu, 28 Apr 2011) | 15 lines Improved the error message for another of the most common situations I hear about in newbieland. It could be taken further. If compilation fails due to an unimplemented abstract method, and there is a concrete method of the same name and arity, it will do a pairwise analysis of the parameters and attempt to further explain where you went off the beam if it feels it can do so sensibly. Such as in the test case: % scalac S.scala S.scala:1: error: class S needs to be abstract, since method g in class J of type (y: Int,z: java.util.List)Int is not defined (Note that java.util.List does not match java.util.List[String]. To implement a raw type, use java.util.List[_]) class S extends J { ^ one error found No review. ........ r24843 | extempore | 2011-04-28 18:26:05 +0200 (Thu, 28 Apr 2011) | 11 lines I wrote a warning when nullary methods return Unit. I wimped out of including it in this patch because we had about 200 of them, and that's what is fixed in this patch. I will add the warning to some kind of "-Xlint" feature after 2.9. This is motivated at least partly by the resolution of #4506, which indicates the distinction between "def foo()" and "def foo" will continue to jab its pointy stick into our eyes, so I believe we have a minimal duty of at least following our own advice about what they mean and not making a semirandom choice as to whether a method has parens or not. Review by community. ........ r24844 | odersky | 2011-04-29 13:07:56 +0200 (Fri, 29 Apr 2011) | 1 line Fixes #4525. No review. ........ r24845 | plocinic | 2011-04-29 16:27:35 +0200 (Fri, 29 Apr 2011) | 1 line remove now redundant check (see #4426). review by extempore ........ r24846 | plocinic | 2011-04-29 16:27:40 +0200 (Fri, 29 Apr 2011) | 1 line Closes #4457. Review by odersky ........ r24847 | odersky | 2011-04-29 17:35:37 +0200 (Fri, 29 Apr 2011) | 1 line Ignore type errors raised in later phases that are due to mismatching existentials. Quick fix to address lift build failures. Review by dragos. ........ r24848 | odersky | 2011-04-29 18:02:53 +0200 (Fri, 29 Apr 2011) | 1 line Second version of trying to avoid the lift crasher bug. ........ r24849 | odersky | 2011-04-29 18:13:31 +0200 (Fri, 29 Apr 2011) | 1 line Issuing warnings with detailed info when we encounter the lift crasher case. ........ r24850 | michelou | 2011-04-29 21:41:12 +0200 (Fri, 29 Apr 2011) | 2 lines removed legacy library code (package scala.mobile) ........ r24851 | extempore | 2011-04-29 22:13:10 +0200 (Fri, 29 Apr 2011) | 4 lines Fixing the pattern matcher regression I introduced between rc1 and rc2. Not done with this situation but at least I managed to boil out the big problem and keep my five closed pattern matcher tickets to boot. Closes #4523, no review. ........ r24852 | extempore | 2011-04-30 00:40:03 +0200 (Sat, 30 Apr 2011) | 1 line Making further unapply regressions less likely, no review. ........ r24853 | extempore | 2011-04-30 22:00:39 +0200 (Sat, 30 Apr 2011) | 3 lines After having to update the code for someone else, ran damarau levenshtein on trunk again. Patchwise, I guess correcting spelling errors in comments is about as safe as it gets. No review. ........ r24854 | extempore | 2011-04-30 22:01:00 +0200 (Sat, 30 Apr 2011) | 1 line Don't crash the pickler with erroneous types. Review by odersky. ........ r24855 | extempore | 2011-04-30 22:01:25 +0200 (Sat, 30 Apr 2011) | 4 lines Completely to my surprise, found that fixing all those sequence issues revealed that the pattern matcher can catch a lot more inexhaustive cases than it has been catching. Fixed most of the inexhaustive matches in the compiler, which had become a bit warnier. No review. ........ r24856 | extempore | 2011-04-30 22:01:48 +0200 (Sat, 30 Apr 2011) | 2 lines A few minor cleanups involving logging messages, assertion messages, compiler warnings, and other innocuous matters. No review. ........ r24857 | extempore | 2011-05-01 07:10:09 +0200 (Sun, 01 May 2011) | 2 lines Don't issue a deprecation warning if the deprecated method is being called from a bridge method. No review. ........ r24858 | extempore | 2011-05-01 07:10:58 +0200 (Sun, 01 May 2011) | 4 lines Since I don't want to commit anything "interesting" until we ship 2.9, a few uninteresting cleanups involving how types are printed, getting some debugging code in shape to prepare for the long winter ahead, etc. No review. ........ r24859 | extempore | 2011-05-01 07:43:05 +0200 (Sun, 01 May 2011) | 2 lines Realized how noisy the @deprecated-takes-two-arguments message was and quieted it down. Oh, and documented the arguments. No review. ........ r24860 | extempore | 2011-05-01 20:15:49 +0200 (Sun, 01 May 2011) | 7 lines Reducing the sbt launcher footprint by eliminating val references which go through the scala package object, since they lead to otherwise unnecessary classes becoming required at startup. Mostly this means library files with constructors like "Iterator.empty" or "Stream.continually" receive a direct import of that companion. The one slightly less than cosmetic change was moving the strange xml value "$scope" back into Predef, because otherwise I have to touch the xml code generation. No review. ........ r24861 | extempore | 2011-05-01 21:58:44 +0200 (Sun, 01 May 2011) | 2 lines Added a @bridge'd $scope back to scala package object for binary compat. No review. ........ r24862 | extempore | 2011-05-02 05:28:58 +0200 (Mon, 02 May 2011) | 4 lines Figuring it couldn't hurt if more people had a command of some of our binary compatibility impacting code, I went over the ModuleDef elimination with my clarify stick and made the machinery more transparent, to me anyway. Review by plocinic. ........
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/App.scala2
-rw-r--r--src/library/scala/Array.scala11
-rw-r--r--src/library/scala/Option.scala2
-rw-r--r--src/library/scala/Predef.scala5
-rw-r--r--src/library/scala/annotation/switch.scala43
-rw-r--r--src/library/scala/collection/IterableViewLike.scala1
-rw-r--r--src/library/scala/collection/Iterator.scala3
-rw-r--r--src/library/scala/collection/JavaConversions.scala2
-rwxr-xr-xsrc/library/scala/collection/JavaConverters.scala2
-rw-r--r--src/library/scala/collection/SeqLike.scala7
-rw-r--r--src/library/scala/collection/SeqViewLike.scala5
-rw-r--r--src/library/scala/collection/TraversableProxy.scala2
-rw-r--r--src/library/scala/collection/immutable/List.scala16
-rw-r--r--src/library/scala/collection/immutable/ListMap.scala5
-rw-r--r--src/library/scala/collection/immutable/ListSet.scala4
-rw-r--r--src/library/scala/collection/immutable/MapLike.scala3
-rw-r--r--src/library/scala/collection/immutable/Range.scala10
-rw-r--r--src/library/scala/collection/immutable/SortedMap.scala3
-rw-r--r--src/library/scala/collection/immutable/TreeMap.scala5
-rw-r--r--src/library/scala/collection/immutable/TrieIterator.scala4
-rw-r--r--src/library/scala/collection/immutable/Vector.scala2
-rw-r--r--src/library/scala/collection/mutable/ArrayStack.scala2
-rw-r--r--src/library/scala/collection/mutable/BufferLike.scala2
-rw-r--r--src/library/scala/collection/mutable/FlatHashTable.scala4
-rw-r--r--src/library/scala/collection/mutable/HashTable.scala4
-rw-r--r--src/library/scala/collection/mutable/MapLike.scala6
-rw-r--r--src/library/scala/collection/mutable/ObservableBuffer.scala6
-rw-r--r--src/library/scala/collection/mutable/ObservableMap.scala2
-rw-r--r--src/library/scala/collection/mutable/ObservableSet.scala2
-rw-r--r--src/library/scala/collection/mutable/OpenHashMap.scala4
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala2
-rw-r--r--src/library/scala/collection/mutable/RevertibleHistory.scala2
-rw-r--r--src/library/scala/collection/mutable/SetLike.scala8
-rw-r--r--src/library/scala/collection/mutable/UnrolledBuffer.scala1
-rw-r--r--src/library/scala/collection/package.scala2
-rw-r--r--src/library/scala/collection/parallel/ParIterableLike.scala8
-rw-r--r--src/library/scala/collection/parallel/ParIterableView.scala24
-rw-r--r--src/library/scala/collection/parallel/ParSeqLike.scala44
-rw-r--r--src/library/scala/collection/parallel/ParSeqView.scala30
-rw-r--r--src/library/scala/collection/parallel/ParSeqViewLike.scala31
-rw-r--r--src/library/scala/collection/parallel/Splitter.scala8
-rw-r--r--src/library/scala/collection/parallel/Tasks.scala32
-rw-r--r--src/library/scala/collection/parallel/immutable/ParHashMap.scala2
-rw-r--r--src/library/scala/collection/parallel/immutable/ParRange.scala13
-rw-r--r--src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala2
-rw-r--r--src/library/scala/compat/Platform.scala2
-rw-r--r--src/library/scala/concurrent/Lock.scala4
-rw-r--r--src/library/scala/concurrent/pilib.scala4
-rw-r--r--src/library/scala/deprecated.scala9
-rw-r--r--src/library/scala/io/BufferedSource.scala1
-rw-r--r--src/library/scala/io/Position.scala2
-rw-r--r--src/library/scala/math/Ordered.scala4
-rw-r--r--src/library/scala/mobile/Code.scala234
-rw-r--r--src/library/scala/mobile/Location.scala72
-rw-r--r--src/library/scala/package.scala10
-rw-r--r--src/library/scala/reflect/ScalaBeanInfo.scala2
-rw-r--r--src/library/scala/runtime/RichBoolean.scala4
-rw-r--r--src/library/scala/sys/SystemProperties.scala2
-rw-r--r--src/library/scala/sys/process/BasicIO.scala1
-rw-r--r--src/library/scala/sys/process/Process.scala4
-rw-r--r--src/library/scala/sys/process/ProcessImpl.scala2
-rw-r--r--src/library/scala/testing/Benchmark.scala4
-rw-r--r--src/library/scala/util/MurmurHash.scala1
-rw-r--r--src/library/scala/util/Random.scala9
-rw-r--r--src/library/scala/util/Sorting.scala1
-rw-r--r--src/library/scala/util/control/Breaks.scala2
-rw-r--r--src/library/scala/util/parsing/ast/Binders.scala4
-rw-r--r--src/library/scala/xml/MetaData.scala2
-rw-r--r--src/library/scala/xml/Null.scala1
-rw-r--r--src/library/scala/xml/dtd/ContentModelParser.scala2
-rw-r--r--src/library/scala/xml/dtd/Scanner.scala4
-rw-r--r--src/library/scala/xml/factory/LoggedNodeFactory.scala2
-rw-r--r--src/library/scala/xml/parsing/FactoryAdapter.scala19
-rw-r--r--src/library/scala/xml/parsing/MarkupParserCommon.scala6
-rw-r--r--src/library/scala/xml/persistent/CachedFileStorage.scala14
-rwxr-xr-xsrc/library/scala/xml/pull/XMLEventReader.scala10
76 files changed, 190 insertions, 626 deletions
diff --git a/src/library/scala/App.scala b/src/library/scala/App.scala
index 59c6fccec3..826278ade0 100644
--- a/src/library/scala/App.scala
+++ b/src/library/scala/App.scala
@@ -51,7 +51,7 @@ trait App extends DelayedInit {
/** The main method.
* This stores all argument so that they can be retrieved with `args`
- * and the executes all initialization code segements in the order they were
+ * and the executes all initialization code segments in the order they were
* passed to `delayedInit`
* @param args the arguments passed to the main method
*/
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 66ce9320bd..5ff5778800 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -6,15 +6,14 @@
** |/ **
\* */
-
-
package scala
import scala.collection.generic._
-import scala.collection.mutable.{ArrayBuilder, ArraySeq}
+import scala.collection.{ mutable, immutable }
+import mutable.{ ArrayBuilder, ArraySeq }
import compat.Platform.arraycopy
import scala.reflect.ClassManifest
-import scala.runtime.ScalaRunTime.{array_apply, array_update}
+import scala.runtime.ScalaRunTime.{ array_apply, array_update }
/** Contains a fallback builder for arrays when the element type
* does not have a class manifest. In that case a generic array is built.
@@ -26,7 +25,7 @@ class FallbackArrayBuilding {
* does not have a class manifest. Note that fallbackBuilder factory
* needs an implicit parameter (otherwise it would not be dominated in implicit search
* by Array.canBuildFrom). We make sure that that implicit search is always
- * successfull.
+ * successful.
*/
implicit def fallbackCanBuildFrom[T](implicit m: DummyImplicit): CanBuildFrom[Array[_], T, ArraySeq[T]] =
new CanBuildFrom[Array[_], T, ArraySeq[T]] {
@@ -372,7 +371,7 @@ object Array extends FallbackArrayBuilding {
def range(start: Int, end: Int, step: Int): Array[Int] = {
if (step == 0) throw new IllegalArgumentException("zero step")
val b = newBuilder[Int]
- b.sizeHint(Range.count(start, end, step, false))
+ b.sizeHint(immutable.Range.count(start, end, step, false))
var i = start
while (if (step < 0) end < i else i < end) {
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index c2b1764fdb..bab3a1c759 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -222,7 +222,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
* if it is nonempty, or an empty iterator if the option is empty.
*/
def iterator: Iterator[A] =
- if (isEmpty) Iterator.empty else Iterator.single(this.get)
+ if (isEmpty) collection.Iterator.empty else collection.Iterator.single(this.get)
/** Returns a singleton list containing the $option's value
* if it is nonempty, or the empty list if the $option is empty.
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index e03eab45a2..68fdee8411 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -57,6 +57,9 @@ object Predef extends LowPriorityImplicits {
def implicitly[T](implicit e: T) = e // for summoning implicit values from the nether world
@inline def locally[T](x: T): T = x // to communicate intent and avoid unmoored statements
+ // Apparently needed for the xml library
+ val $scope = scala.xml.TopScope
+
// Deprecated
@deprecated("Use sys.error(message) instead", "2.9.0")
@@ -312,7 +315,7 @@ object Predef extends LowPriorityImplicits {
implicit def stringCanBuildFrom: CanBuildFrom[String, Char, String] =
new CanBuildFrom[String, Char, String] {
def apply(from: String) = apply()
- def apply() = StringBuilder.newBuilder
+ def apply() = mutable.StringBuilder.newBuilder
}
implicit def seqToCharSequence(xs: collection.IndexedSeq[Char]): CharSequence = new CharSequence {
diff --git a/src/library/scala/annotation/switch.scala b/src/library/scala/annotation/switch.scala
index e4cb8c55a2..3734686b27 100644
--- a/src/library/scala/annotation/switch.scala
+++ b/src/library/scala/annotation/switch.scala
@@ -7,32 +7,23 @@
\* */
package scala.annotation
-/** <p>
- * An annotation to be applied to a match expression. If present,
- * the compiler will verify that the match has been compiled to a
- * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc14.html"
- * target="_top"><code>tableswitch</code></a> or
- * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc8.html#lookupswitch"
- * target="_top"><code>lookupswitch</code></a>, and issue an error if it
- * instead compiles into a series of conditional expressions.<br/>
- * Example:
- * </p>
- * <pre>
- * <b>def</b> fetchToken() {
- * (ch: @switch) <b>match</b> {
- * <b>case</b> ' ' | '\t' | CR | LF | FF <b>=&gt;</b>
- * nextChar()
- * fetchToken()
- * <b>case</b> 'A' &#47;*..'Z'*&#47; | '$' | '_' | 'a' &#47;*..'z'*&#47; <b>=&gt;</b>
- * putChar(ch)
- * nextChar()
- * getIdentRest()
- * <b>case</b> ',' <b>=&gt;</b>
- * nextChar(); token = COMMA
- * // more cases
- * }
- * }</pre>
+/** An annotation to be applied to a match expression. If present,
+ * the compiler will verify that the match has been compiled to a
+ * [[http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc14.html tableswitch]]
+ * or [[http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc8.html#lookupswitch lookupswitch]]
+ * and issue an error if it instead compiles into a series of conditional expressions.
+ * Example usage:
+{{{
+ val Constant = 'Q'
+ def tokenMe(ch: Char) = (ch: @switch) match {
+ case ' ' | '\t' | '\n' => 1
+ case 'A' | 'Z' | '$' => 2
+ case '5' | Constant => 3 // a non-literal may prevent switch generation: this would not compile
+ case _ => 4
+ }
+}}}
*
- * @since 2.8
+ * @author Paul Phillips
+ * @since 2.8
*/
final class switch extends annotation.StaticAnnotation
diff --git a/src/library/scala/collection/IterableViewLike.scala b/src/library/scala/collection/IterableViewLike.scala
index e0f1ada2b8..70f4519204 100644
--- a/src/library/scala/collection/IterableViewLike.scala
+++ b/src/library/scala/collection/IterableViewLike.scala
@@ -10,6 +10,7 @@ package scala.collection
import generic._
import TraversableView.NoBuilder
+import immutable.Stream
/** A template trait for non-strict views of iterable collections.
* $iterableViewInfo
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index 39c1d5b07f..f7f8e7a971 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -6,12 +6,11 @@
** |/ **
\* */
-
-
package scala.collection
import mutable.ArrayBuffer
import annotation.{ tailrec, migration }
+import immutable.Stream
/** The `Iterator` object provides various functions for
* creating specialized iterators.
diff --git a/src/library/scala/collection/JavaConversions.scala b/src/library/scala/collection/JavaConversions.scala
index fdb77a48c1..8b98f10875 100644
--- a/src/library/scala/collection/JavaConversions.scala
+++ b/src/library/scala/collection/JavaConversions.scala
@@ -504,7 +504,7 @@ object JavaConversions {
* Scala ConcurrentMap will be returned.
*
* @param m The ConcurrentMap to be converted.
- * @return A Scala mutable ConcurrrentMap view of the argument.
+ * @return A Scala mutable ConcurrentMap view of the argument.
*/
implicit def asScalaConcurrentMap[A, B](m: juc.ConcurrentMap[A, B]): mutable.ConcurrentMap[A, B] = m match {
case cmw: ConcurrentMapWrapper[a, b] => cmw.underlying
diff --git a/src/library/scala/collection/JavaConverters.scala b/src/library/scala/collection/JavaConverters.scala
index 4bb61b960a..0b55f54810 100755
--- a/src/library/scala/collection/JavaConverters.scala
+++ b/src/library/scala/collection/JavaConverters.scala
@@ -454,7 +454,7 @@ object JavaConverters {
* Scala <code>ConcurrentMap</code> will be returned.
*
* @param m The <code>ConcurrentMap</code> to be converted.
- * @return An object with an `asScala` method that returns a Scala mutable <code>ConcurrrentMap</code> view of the argument.
+ * @return An object with an `asScala` method that returns a Scala mutable <code>ConcurrentMap</code> view of the argument.
*/
implicit def asScalaConcurrentMapConverter[A, B](m: juc.ConcurrentMap[A, B]): AsScala[mutable.ConcurrentMap[A, B]] =
new AsScala(asScalaConcurrentMap(m))
diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala
index 0411a2987e..37caf82027 100644
--- a/src/library/scala/collection/SeqLike.scala
+++ b/src/library/scala/collection/SeqLike.scala
@@ -6,15 +6,14 @@
** |/ **
\* */
-
-
package scala.collection
-import mutable.{ListBuffer, HashMap, ArraySeq}
-import immutable.{List, Range}
+import mutable.{ ListBuffer, ArraySeq }
+import immutable.{ List, Range }
import generic._
import parallel.ParSeq
import annotation.bridge
+import scala.math.Ordering
/** A template trait for sequences of type `Seq[A]`
* $seqInfo
diff --git a/src/library/scala/collection/SeqViewLike.scala b/src/library/scala/collection/SeqViewLike.scala
index 77dc15e695..37c66802ef 100644
--- a/src/library/scala/collection/SeqViewLike.scala
+++ b/src/library/scala/collection/SeqViewLike.scala
@@ -13,6 +13,7 @@ package scala.collection
import generic._
import Seq.fill
import TraversableView.NoBuilder
+import annotation.bridge
/** A template trait for non-strict views of sequences.
* $seqViewInfo
@@ -129,9 +130,13 @@ trait SeqViewLike[+A,
override def diff[B >: A](that: GenSeq[B]): This =
newForced(thisSeq diff that).asInstanceOf[This]
+ @bridge def diff[B >: A](that: Seq[B]): This = diff(that: GenSeq[B])
+
override def intersect[B >: A](that: GenSeq[B]): This =
newForced(thisSeq intersect that).asInstanceOf[This]
+ @bridge def intersect[B >: A](that: Seq[B]): This = intersect(that: GenSeq[B])
+
override def sorted[B >: A](implicit ord: Ordering[B]): This =
newForced(thisSeq sorted ord).asInstanceOf[This]
diff --git a/src/library/scala/collection/TraversableProxy.scala b/src/library/scala/collection/TraversableProxy.scala
index e965523ab2..215cf086d9 100644
--- a/src/library/scala/collection/TraversableProxy.scala
+++ b/src/library/scala/collection/TraversableProxy.scala
@@ -10,7 +10,7 @@
package scala.collection
-// Methods could be printed by cat TraverableLike.scala | egrep '^ (override )?def'
+// Methods could be printed by cat TraversableLike.scala | egrep '^ (override )?def'
/** This trait implements a proxy for traversable objects. It forwards
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index d8c8268a2e..ea0bc7523c 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -292,22 +292,6 @@ sealed abstract class List[+A] extends LinearSeq[A]
@deprecated("use `distinct' instead", "2.8.0")
def removeDuplicates: List[A] = distinct
- /** <p>
- * Sort the list according to the comparison function
- * `lt(e1: a, e2: a) =&gt; Boolean`,
- * which should be true iff `e1` precedes
- * `e2` in the desired ordering.
- * !!! todo: move sorting to IterableLike
- * </p>
- *
- * @param lt the comparison function
- * @return a list sorted according to the comparison function
- * `lt(e1: a, e2: a) =&gt; Boolean`.
- * @example <pre>
- * List("Steve", "Tom", "John", "Bob")
- * .sort((e1, e2) => (e1 compareTo e2) &lt; 0) =
- * List("Bob", "John", "Steve", "Tom")</pre>
- */
@deprecated("use `sortWith' instead", "2.8.0")
def sort(lt : (A,A) => Boolean): List[A] = {
/** Merge two already-sorted lists */
diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala
index a0f20c6e96..edee4a9922 100644
--- a/src/library/scala/collection/immutable/ListMap.scala
+++ b/src/library/scala/collection/immutable/ListMap.scala
@@ -12,7 +12,7 @@ package scala.collection
package immutable
import generic._
-import annotation.tailrec
+import annotation.{tailrec, bridge}
/** $factoryInfo
* @since 1
@@ -100,6 +100,9 @@ class ListMap[A, +B] extends Map[A, B] with MapLike[A, B, ListMap[A, B]] with Se
override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): ListMap[A, B1] =
((repr: ListMap[A, B1]) /: xs.seq) (_ + _)
+ @bridge def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): ListMap[A, B1] =
+ ++(xs: GenTraversableOnce[(A, B1)])
+
/** This creates a new mapping without the given <code>key</code>.
* If the map does not contain a mapping for the given key, the
* method returns the same map.
diff --git a/src/library/scala/collection/immutable/ListSet.scala b/src/library/scala/collection/immutable/ListSet.scala
index 057b68d280..a298c629be 100644
--- a/src/library/scala/collection/immutable/ListSet.scala
+++ b/src/library/scala/collection/immutable/ListSet.scala
@@ -12,7 +12,7 @@ package scala.collection
package immutable
import generic._
-import annotation.tailrec
+import annotation.{tailrec, bridge}
import mutable.{ ListBuffer, Builder }
/** $factoryInfo
@@ -103,6 +103,8 @@ class ListSet[A] extends Set[A]
if (xs.isEmpty) this
else new ListSet.ListSetBuilder(this) ++= xs.seq result
+ @bridge def ++(xs: TraversableOnce[A]): ListSet[A] = ++(xs: GenTraversableOnce[A]): ListSet[A]
+
private[ListSet] def unchecked_+(e: A): ListSet[A] = new Node(e)
private[ListSet] def unchecked_outer: ListSet[A] =
throw new NoSuchElementException("Empty ListSet has no outer pointer")
diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala
index d22adc03bc..fb2826b4df 100644
--- a/src/library/scala/collection/immutable/MapLike.scala
+++ b/src/library/scala/collection/immutable/MapLike.scala
@@ -11,6 +11,7 @@ package immutable
import generic._
import parallel.immutable.ParMap
+import annotation.bridge
/**
* A generic template for immutable maps from keys of type `A`
@@ -85,6 +86,8 @@ trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]]
override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): immutable.Map[A, B1] =
((repr: immutable.Map[A, B1]) /: xs.seq) (_ + _)
+ @bridge def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): immutable.Map[A, B1] = ++(xs: GenTraversableOnce[(A, B1)])
+
/** Filters this map by retaining only keys satisfying a predicate.
* @param p the predicate used to test keys
* @return an immutable map consisting only of those key value pairs of this map where the key satisfies
diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala
index 2b1e4bff13..ef0f08bcfb 100644
--- a/src/library/scala/collection/immutable/Range.scala
+++ b/src/library/scala/collection/immutable/Range.scala
@@ -287,7 +287,7 @@ object Range {
// imprecision or surprises might result from anything, although this may
// not yet be fully implemented.
object BigDecimal {
- implicit val bigDecAsIntegral = scala.Numeric.BigDecimalAsIfIntegral
+ implicit val bigDecAsIntegral = scala.math.Numeric.BigDecimalAsIfIntegral
def apply(start: BigDecimal, end: BigDecimal, step: BigDecimal) =
NumericRange(start, end, step)
@@ -302,9 +302,9 @@ object Range {
// is necessary to keep 0.3d at 0.3 as opposed to
// 0.299999999999999988897769753748434595763683319091796875 or so.
object Double {
- implicit val bigDecAsIntegral = scala.Numeric.BigDecimalAsIfIntegral
- implicit val doubleAsIntegral = scala.Numeric.DoubleAsIfIntegral
- def toBD(x: Double): BigDecimal = scala.BigDecimal valueOf x
+ implicit val bigDecAsIntegral = scala.math.Numeric.BigDecimalAsIfIntegral
+ implicit val doubleAsIntegral = scala.math.Numeric.DoubleAsIfIntegral
+ def toBD(x: Double): BigDecimal = scala.math.BigDecimal valueOf x
def apply(start: Double, end: Double, step: Double) =
BigDecimal(toBD(start), toBD(end), toBD(step)) mapRange (_.doubleValue)
@@ -328,7 +328,7 @@ object Range {
def inclusive(start: Int, end: Int, step: Int) = NumericRange.inclusive(start, end, step)
}
- @deprecated("use Range instead")
+ @deprecated("use Range instead", "2.9.0")
trait ByOne extends Range {
@bridge override def foreach[@specialized(Unit) U](f: Int => U) =
super.foreach(f)
diff --git a/src/library/scala/collection/immutable/SortedMap.scala b/src/library/scala/collection/immutable/SortedMap.scala
index 64fa06bf2e..f7e05fef69 100644
--- a/src/library/scala/collection/immutable/SortedMap.scala
+++ b/src/library/scala/collection/immutable/SortedMap.scala
@@ -14,6 +14,7 @@ package immutable
import generic._
import mutable.Builder
import annotation.unchecked.uncheckedVariance
+import annotation.bridge
/** A map whose keys are sorted.
*
@@ -63,6 +64,8 @@ trait SortedMap[A, +B] extends Map[A, B]
*/
override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): SortedMap[A, B1] =
((repr: SortedMap[A, B1]) /: xs.seq) (_ + _)
+
+ @bridge def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): SortedMap[A, B1] = ++(xs: GenTraversableOnce[(A, B1)])
}
/** $factoryInfo
diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala
index 7552e1983c..a46583c541 100644
--- a/src/library/scala/collection/immutable/TreeMap.scala
+++ b/src/library/scala/collection/immutable/TreeMap.scala
@@ -13,6 +13,7 @@ package immutable
import generic._
import mutable.Builder
+import annotation.bridge
/** $factoryInfo
* @define Coll immutable.TreeMap
@@ -110,9 +111,11 @@ class TreeMap[A, +B](override val size: Int, t: RedBlack[A]#Tree[B])(implicit va
*
* @param xs the traversable object.
*/
- override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): TreeMap[A, B1] =
+ override def ++[B1 >: B] (xs: GenTraversableOnce[(A, B1)]): TreeMap[A, B1] =
((repr: TreeMap[A, B1]) /: xs.seq) (_ + _)
+ @bridge def ++[B1 >: B] (xs: TraversableOnce[(A, B1)]): TreeMap[A, B1] = ++(xs: GenTraversableOnce[(A, B1)])
+
/** A new TreeMap with the entry added is returned,
* assuming that key is <em>not</em> in the TreeMap.
*
diff --git a/src/library/scala/collection/immutable/TrieIterator.scala b/src/library/scala/collection/immutable/TrieIterator.scala
index 088b280b8a..c2cd0b2efd 100644
--- a/src/library/scala/collection/immutable/TrieIterator.scala
+++ b/src/library/scala/collection/immutable/TrieIterator.scala
@@ -37,8 +37,8 @@ private[collection] abstract class TrieIterator[+T](elems: Array[Iterable[T]]) e
private[this] var subIter = initSubIter
private[this] def getElems(x: Iterable[T]): Array[Iterable[T]] = (x match {
- case x: HashTrieMap[a, b] => x.elems
- case x: HashTrieSet[T] => x.elems
+ case x: HashTrieMap[_, _] => x.elems
+ case x: HashTrieSet[_] => x.elems
}).asInstanceOf[Array[Iterable[T]]]
private[this] def collisionToArray(x: Iterable[T]): Array[Iterable[T]] = (x match {
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index 7a4a9bb18a..ab44585902 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -704,7 +704,7 @@ final class VectorBuilder[A]() extends Builder[A,Vector[A]] with VectorPointer[A
s
}
- def clear: Unit = {
+ def clear(): Unit = {
display0 = new Array[AnyRef](32)
depth = 1
blockIndex = 0
diff --git a/src/library/scala/collection/mutable/ArrayStack.scala b/src/library/scala/collection/mutable/ArrayStack.scala
index 2323830b7b..012105d7c4 100644
--- a/src/library/scala/collection/mutable/ArrayStack.scala
+++ b/src/library/scala/collection/mutable/ArrayStack.scala
@@ -143,7 +143,7 @@ extends Seq[T]
def dup() = push(top)
/** Empties the stack. */
- def clear {
+ def clear() {
index = 0
table = new Array(1)
}
diff --git a/src/library/scala/collection/mutable/BufferLike.scala b/src/library/scala/collection/mutable/BufferLike.scala
index c48dd5d621..9cab3bd656 100644
--- a/src/library/scala/collection/mutable/BufferLike.scala
+++ b/src/library/scala/collection/mutable/BufferLike.scala
@@ -312,4 +312,6 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]]
"Use --= instead if you intend to remove by side effect from an existing collection.\n"
)
override def --(xs: GenTraversableOnce[A]): This = clone() --= xs.seq
+
+ @bridge def --(xs: TraversableOnce[A]): This = --(xs: GenTraversableOnce[A])
}
diff --git a/src/library/scala/collection/mutable/FlatHashTable.scala b/src/library/scala/collection/mutable/FlatHashTable.scala
index d78c466f69..f2e42f2ca1 100644
--- a/src/library/scala/collection/mutable/FlatHashTable.scala
+++ b/src/library/scala/collection/mutable/FlatHashTable.scala
@@ -241,7 +241,7 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] {
}
// discards the previous sizemap and populates the new one
- protected def sizeMapInitAndRebuild {
+ protected def sizeMapInitAndRebuild() {
// first allocate
sizeMapInit(table.length)
@@ -263,7 +263,7 @@ trait FlatHashTable[A] extends FlatHashTable.HashUtils[A] {
}
}
- private[collection] def printSizeMap {
+ private[collection] def printSizeMap() {
println(sizemap.toList)
}
diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala
index dea1ec7d44..0f6fde0260 100644
--- a/src/library/scala/collection/mutable/HashTable.scala
+++ b/src/library/scala/collection/mutable/HashTable.scala
@@ -265,7 +265,7 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
}
// discards the previous sizemap and populates the new one
- protected def sizeMapInitAndRebuild {
+ protected def sizeMapInitAndRebuild() {
sizeMapInit(table.length)
// go through the buckets, count elements
@@ -291,7 +291,7 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
}
}
- private[collection] def printSizeMap {
+ private[collection] def printSizeMap() {
println(sizemap.toList)
}
diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala
index e737bf5509..92c6e8c162 100644
--- a/src/library/scala/collection/mutable/MapLike.scala
+++ b/src/library/scala/collection/mutable/MapLike.scala
@@ -11,7 +11,7 @@ package scala.collection
package mutable
import generic._
-import annotation.migration
+import annotation.{migration, bridge}
import parallel.mutable.ParMap
/** A template trait for mutable maps.
@@ -128,6 +128,8 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): Map[A, B1] =
clone().asInstanceOf[Map[A, B1]] ++= xs.seq
+ @bridge def ++[B1 >: B](xs: TraversableOnce[(A, B1)]): Map[A, B1] = ++(xs: GenTraversableOnce[(A, B1)])
+
/** Removes a key from this map, returning the value associated previously
* with that key as an option.
* @param key the key to be removed
@@ -247,4 +249,6 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
"side effect to an existing map and return that map itself, use --=."
)
override def --(xs: GenTraversableOnce[A]): This = clone() --= xs.seq
+
+ @bridge def --(xs: TraversableOnce[A]): This = --(xs: GenTraversableOnce[A])
}
diff --git a/src/library/scala/collection/mutable/ObservableBuffer.scala b/src/library/scala/collection/mutable/ObservableBuffer.scala
index aa9bd7ac95..c38bf5fbf3 100644
--- a/src/library/scala/collection/mutable/ObservableBuffer.scala
+++ b/src/library/scala/collection/mutable/ObservableBuffer.scala
@@ -46,7 +46,7 @@ trait ObservableBuffer[A] extends Buffer[A] with Publisher[Message[A] with Undoa
val oldelement = apply(n)
super.update(n, newelement)
publish(new Update(Index(n), newelement) with Undoable {
- def undo { update(n, oldelement) }
+ def undo() { update(n, oldelement) }
})
}
@@ -54,7 +54,7 @@ trait ObservableBuffer[A] extends Buffer[A] with Publisher[Message[A] with Undoa
val oldelement = apply(n)
super.remove(n)
publish(new Remove(Index(n), oldelement) with Undoable {
- def undo { insert(n, oldelement) }
+ def undo() { insert(n, oldelement) }
})
oldelement
}
@@ -62,7 +62,7 @@ trait ObservableBuffer[A] extends Buffer[A] with Publisher[Message[A] with Undoa
abstract override def clear(): Unit = {
super.clear
publish(new Reset with Undoable {
- def undo { throw new UnsupportedOperationException("cannot undo") }
+ def undo() { throw new UnsupportedOperationException("cannot undo") }
})
}
}
diff --git a/src/library/scala/collection/mutable/ObservableMap.scala b/src/library/scala/collection/mutable/ObservableMap.scala
index 00087f8f61..ceb23d25c3 100644
--- a/src/library/scala/collection/mutable/ObservableMap.scala
+++ b/src/library/scala/collection/mutable/ObservableMap.scala
@@ -62,7 +62,7 @@ trait ObservableMap[A, B] extends Map[A, B] with Publisher[Message[(A, B)] with
abstract override def clear(): Unit = {
super.clear
publish(new Reset with Undoable {
- def undo: Unit = throw new UnsupportedOperationException("cannot undo")
+ def undo(): Unit = throw new UnsupportedOperationException("cannot undo")
})
}
}
diff --git a/src/library/scala/collection/mutable/ObservableSet.scala b/src/library/scala/collection/mutable/ObservableSet.scala
index 6bb1e45cec..1b375802a5 100644
--- a/src/library/scala/collection/mutable/ObservableSet.scala
+++ b/src/library/scala/collection/mutable/ObservableSet.scala
@@ -46,7 +46,7 @@ trait ObservableSet[A] extends Set[A] with Publisher[Message[A] with Undoable]
abstract override def clear(): Unit = {
super.clear
publish(new Reset with Undoable {
- def undo: Unit = throw new UnsupportedOperationException("cannot undo")
+ def undo(): Unit = throw new UnsupportedOperationException("cannot undo")
})
}
}
diff --git a/src/library/scala/collection/mutable/OpenHashMap.scala b/src/library/scala/collection/mutable/OpenHashMap.scala
index f558f68159..72e729f370 100644
--- a/src/library/scala/collection/mutable/OpenHashMap.scala
+++ b/src/library/scala/collection/mutable/OpenHashMap.scala
@@ -80,7 +80,7 @@ extends Map[Key, Value]
h ^ (h >>> 7) ^ (h >>> 4);
}
- private[this] def growTable = {
+ private[this] def growTable() = {
val oldSize = mask + 1;
val newSize = 4 * oldSize;
val oldTable = table;
@@ -179,7 +179,7 @@ extends Map[Key, Value]
var index = 0;
val initialModCount = modCount;
- private[this] def advance {
+ private[this] def advance() {
if (initialModCount != modCount) sys.error("Concurrent modification");
while((index <= mask) && (table(index) == null || table(index).value == None)) index+=1;
}
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index 2c03f329a7..31113797dd 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -253,7 +253,7 @@ class PriorityQueue[A](implicit val ord: Ordering[A])
*/
override def clone(): PriorityQueue[A] = new PriorityQueue[A] ++= this.iterator
- // def printstate {
+ // def printstate() {
// println("-----------------------")
// println("Size: " + resarr.p_size0)
// println("Internal array: " + resarr.p_array.toList)
diff --git a/src/library/scala/collection/mutable/RevertibleHistory.scala b/src/library/scala/collection/mutable/RevertibleHistory.scala
index 2c51f70b8b..922824ddf0 100644
--- a/src/library/scala/collection/mutable/RevertibleHistory.scala
+++ b/src/library/scala/collection/mutable/RevertibleHistory.scala
@@ -28,7 +28,7 @@ class RevertibleHistory[Evt <: Undoable, Pub] extends History[Evt, Pub] with Und
/** Rollback the full history.
*/
- def undo: Unit = {
+ def undo(): Unit = {
val old = log.toList.reverse
clear
old.foreach { case (sub, event) => event.undo }
diff --git a/src/library/scala/collection/mutable/SetLike.scala b/src/library/scala/collection/mutable/SetLike.scala
index 855ba74f8c..c3bc106153 100644
--- a/src/library/scala/collection/mutable/SetLike.scala
+++ b/src/library/scala/collection/mutable/SetLike.scala
@@ -13,7 +13,7 @@ package mutable
import generic._
import script._
-import scala.annotation.migration
+import annotation.{migration, bridge}
import parallel.mutable.ParSet
/** A template trait for mutable sets of type `mutable.Set[A]`.
@@ -173,7 +173,7 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]]
* $addDuplicates
*
* @param xs the traversable object.
- * @return a new set cconsisting of elements of this set and those in `xs`.
+ * @return a new set consisting of elements of this set and those in `xs`.
*/
@migration(2, 8,
"As of 2.8, this operation creates a new set. To add the elements as a\n"+
@@ -181,6 +181,8 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]]
)
override def ++(xs: GenTraversableOnce[A]): This = clone() ++= xs.seq
+ @bridge def ++(xs: TraversableOnce[A]): This = ++(xs: GenTraversableOnce[A])
+
/** Creates a new set consisting of all the elements of this set except `elem`.
*
* @param elem the element to remove.
@@ -221,6 +223,8 @@ trait SetLike[A, +This <: SetLike[A, This] with Set[A]]
)
override def --(xs: GenTraversableOnce[A]): This = clone() --= xs.seq
+ @bridge def --(xs: TraversableOnce[A]): This = --(xs: GenTraversableOnce[A])
+
/** Send a message to this scriptable object.
*
* @param cmd the message to send.
diff --git a/src/library/scala/collection/mutable/UnrolledBuffer.scala b/src/library/scala/collection/mutable/UnrolledBuffer.scala
index 0933aeaf69..9e0b313c4b 100644
--- a/src/library/scala/collection/mutable/UnrolledBuffer.scala
+++ b/src/library/scala/collection/mutable/UnrolledBuffer.scala
@@ -1,5 +1,6 @@
package scala.collection.mutable
+import collection.Iterator
import collection.generic._
import annotation.tailrec
diff --git a/src/library/scala/collection/package.scala b/src/library/scala/collection/package.scala
index f951f22057..f0a0c40bcd 100644
--- a/src/library/scala/collection/package.scala
+++ b/src/library/scala/collection/package.scala
@@ -5,7 +5,7 @@ package scala
*
* == Guide ==
*
- * A detailed guide for the collections library is avaialble
+ * A detailed guide for the collections library is available
* at [[http://www.scala-lang.org/docu/files/collections-api]].
*
* == Using Collections ==
diff --git a/src/library/scala/collection/parallel/ParIterableLike.scala b/src/library/scala/collection/parallel/ParIterableLike.scala
index b32ea108f4..7c176eeee4 100644
--- a/src/library/scala/collection/parallel/ParIterableLike.scala
+++ b/src/library/scala/collection/parallel/ParIterableLike.scala
@@ -842,11 +842,11 @@ self: ParIterableLike[T, Repr, Sequential] =>
extends NonDivisibleTask[R, Composite[FR, SR, R, First, Second]] {
def combineResults(fr: FR, sr: SR): R
@volatile var result: R = null.asInstanceOf[R]
- private[parallel] override def signalAbort {
+ private[parallel] override def signalAbort() {
ft.signalAbort
st.signalAbort
}
- protected def mergeSubtasks {
+ protected def mergeSubtasks() {
ft mergeThrowables st
if (throwable eq null) result = combineResults(ft.result, st.result)
}
@@ -883,7 +883,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
def leaf(prevr: Option[R1]) = {
result = map(executeAndWaitResult(inner))
}
- private[parallel] override def signalAbort {
+ private[parallel] override def signalAbort() {
inner.signalAbort
}
override def requiresStrictSplitters = inner.requiresStrictSplitters
@@ -1395,7 +1395,7 @@ self: ParIterableLike[T, Repr, Sequential] =>
}
import collection.DebugUtils._
- private[parallel] def printDebugBuffer = println(buildString {
+ private[parallel] def printDebugBuffer() = println(buildString {
append =>
for (s <- debugBuffer) {
append(s)
diff --git a/src/library/scala/collection/parallel/ParIterableView.scala b/src/library/scala/collection/parallel/ParIterableView.scala
index 50f0e4f869..2b4f24126b 100644
--- a/src/library/scala/collection/parallel/ParIterableView.scala
+++ b/src/library/scala/collection/parallel/ParIterableView.scala
@@ -6,20 +6,11 @@
** |/ **
\* */
-
package scala.collection.parallel
-
-
-
-import scala.collection.Parallel
-import scala.collection.IterableView
-import scala.collection.GenIterableView
+import scala.collection.{ Parallel, IterableView, GenIterableView, Iterator }
import scala.collection.generic.CanCombineFrom
-
-
-
/** A template view of a non-strict view of a parallel iterable collection.
*
* @tparam T the type of elements
@@ -33,8 +24,6 @@ extends ParIterableViewLike[T, Coll, CollSeq, ParIterableView[T, Coll, CollSeq],
with GenIterableView[T, Coll]
-
-
object ParIterableView {
abstract class NoCombiner[T] extends Combiner[T, Nothing] {
// self: EnvironmentPassingCombiner[T, Nothing] =>
@@ -55,14 +44,3 @@ object ParIterableView {
def apply() = new NoCombiner[T] {} // was: with EnvironmentPassingCombiner[T, Nothing]
}
}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/library/scala/collection/parallel/ParSeqLike.scala b/src/library/scala/collection/parallel/ParSeqLike.scala
index c9e6b45bd6..1d4d8a13ad 100644
--- a/src/library/scala/collection/parallel/ParSeqLike.scala
+++ b/src/library/scala/collection/parallel/ParSeqLike.scala
@@ -8,12 +8,7 @@
package scala.collection.parallel
-
-import scala.collection.Parallel
-import scala.collection.SeqLike
-import scala.collection.GenSeqLike
-import scala.collection.GenSeq
-import scala.collection.GenIterable
+import scala.collection.{ Parallel, SeqLike, GenSeqLike, GenSeq, GenIterable, Iterator }
import scala.collection.generic.DefaultSignalling
import scala.collection.generic.AtomicIndexFlag
import scala.collection.generic.CanBuildFrom
@@ -500,41 +495,4 @@ self =>
override def merge(that: Corresponds[S]) = result = result && that.result
override def requiresStrictSplitters = true
}
-
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/library/scala/collection/parallel/ParSeqView.scala b/src/library/scala/collection/parallel/ParSeqView.scala
index 8461390839..a08b9a4acb 100644
--- a/src/library/scala/collection/parallel/ParSeqView.scala
+++ b/src/library/scala/collection/parallel/ParSeqView.scala
@@ -9,18 +9,9 @@
package scala.collection.parallel
-
-
-
-import scala.collection.TraversableView
-import scala.collection.SeqView
-import scala.collection.Parallel
+import scala.collection.{ TraversableView, SeqView, Parallel, Iterator }
import scala.collection.generic.CanCombineFrom
-
-
-
-
/** A template view of a non-strict view of a parallel sequence.
*
* @tparam T the type of elements in this parallel sequence
@@ -33,7 +24,6 @@ trait ParSeqView[+T, +Coll <: Parallel, +CollSeq]
extends ParSeqViewLike[T, Coll, CollSeq, ParSeqView[T, Coll, CollSeq], SeqView[T, CollSeq]]
-
object ParSeqView {
abstract class NoCombiner[T] extends Combiner[T, Nothing] {
// self: EnvironmentPassingCombiner[T, Nothing] =>
@@ -54,21 +44,3 @@ object ParSeqView {
def apply() = new NoCombiner[T] {} // was: with EnvironmentPassingCombiner[T, Nothing]
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/library/scala/collection/parallel/ParSeqViewLike.scala b/src/library/scala/collection/parallel/ParSeqViewLike.scala
index b7ad227f11..0da6f413d9 100644
--- a/src/library/scala/collection/parallel/ParSeqViewLike.scala
+++ b/src/library/scala/collection/parallel/ParSeqViewLike.scala
@@ -8,17 +8,13 @@
package scala.collection.parallel
-import scala.collection.Parallel
-import scala.collection.{ SeqView, SeqViewLike }
-import scala.collection.{ GenSeqView, GenSeqViewLike }
-import scala.collection.GenSeq
-import scala.collection.GenIterable
-import scala.collection.GenTraversable
-import scala.collection.GenTraversableOnce
+import scala.collection.{ Parallel, SeqView, SeqViewLike, GenSeqView, GenSeqViewLike, GenSeq }
+import scala.collection.{ GenIterable, GenTraversable, GenTraversableOnce, Iterator }
import scala.collection.generic.{ CanBuildFrom, SliceInterval }
import scala.collection.generic.CanCombineFrom
import scala.collection.parallel.immutable.ParRange
+
/** A template view of a non-strict view of parallel sequence.
*
* @tparam T the type of the elements in this view
@@ -183,25 +179,4 @@ self =>
protected[this] def newSubtask(p: SuperParIterator) = new Force(cbf, down(p))
override def merge(that: Force[U, That]) = result = result combine that.result
}
-
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/library/scala/collection/parallel/Splitter.scala b/src/library/scala/collection/parallel/Splitter.scala
index 568a7c8e0d..ee10ea77c7 100644
--- a/src/library/scala/collection/parallel/Splitter.scala
+++ b/src/library/scala/collection/parallel/Splitter.scala
@@ -8,9 +8,7 @@
package scala.collection.parallel
-
-import scala.collection.Seq
-
+import scala.collection.{ Seq, Iterator }
/** A splitter (or a split iterator) can be split into more splitters that traverse over
* disjoint subsets of elements.
@@ -49,10 +47,8 @@ trait Splitter[+T] extends Iterator[T] {
* The rationale behind this is best given by the following example:
* try splitting an iterator over a linear hash table.
*/
-
}
-
object Splitter {
def empty[T]: Splitter[T] = new Splitter[T] {
def hasNext = false
@@ -60,5 +56,3 @@ object Splitter {
def split = Seq(this)
}
}
-
-
diff --git a/src/library/scala/collection/parallel/Tasks.scala b/src/library/scala/collection/parallel/Tasks.scala
index 497e0c638a..873291fb2d 100644
--- a/src/library/scala/collection/parallel/Tasks.scala
+++ b/src/library/scala/collection/parallel/Tasks.scala
@@ -57,7 +57,7 @@ trait Tasks {
// exception handling mechanism
@volatile var throwable: Throwable = null
- def forwardThrowable = if (throwable != null) throw throwable
+ def forwardThrowable() = if (throwable != null) throw throwable
// tries to do the leaf computation, storing the possible exception
private[parallel] def tryLeaf(lastres: Option[R]) {
@@ -101,7 +101,7 @@ trait Tasks {
}
// override in concrete task implementations to signal abort to other tasks
- private[parallel] def signalAbort {}
+ private[parallel] def signalAbort() {}
}
trait TaskImpl[R, +Tp] {
@@ -110,11 +110,11 @@ trait Tasks {
def split: Seq[TaskImpl[R, Tp]]
/** Code that gets called after the task gets started - it may spawn other tasks instead of calling `leaf`. */
- def compute
+ def compute()
/** Start task. */
- def start
+ def start()
/** Wait for task to finish. */
- def sync
+ def sync()
/** Try to cancel the task.
* @return `true` if cancellation is successful.
*/
@@ -126,7 +126,7 @@ trait Tasks {
*
* This method may be overridden.
*/
- def release {}
+ def release() {}
}
protected def newTaskImpl[R, Tp](b: Task[R, Tp]): TaskImpl[R, Tp]
@@ -161,9 +161,9 @@ trait AdaptiveWorkStealingTasks extends Tasks {
def split: Seq[TaskImpl[R, Tp]]
- def compute = if (body.shouldSplitFurther) internal else body.tryLeaf(None)
+ def compute() = if (body.shouldSplitFurther) internal else body.tryLeaf(None)
- def internal = {
+ def internal() = {
var last = spawnSubtasks()
last.body.tryLeaf(None)
@@ -231,7 +231,7 @@ trait ThreadPoolTasks extends Tasks {
@volatile var owned = false
@volatile var completed = false
- def start = synchronized {
+ def start() = synchronized {
// debuglog("Starting " + body)
// utb: future = executor.submit(this)
executor.synchronized {
@@ -239,7 +239,7 @@ trait ThreadPoolTasks extends Tasks {
executor.submit(this)
}
}
- def sync = synchronized {
+ def sync() = synchronized {
// debuglog("Syncing on " + body)
// utb: future.get()
executor.synchronized {
@@ -293,11 +293,11 @@ trait ThreadPoolTasks extends Tasks {
def queue = executor.getQueue.asInstanceOf[LinkedBlockingQueue[Runnable]]
@volatile var totaltasks = 0
- private def incrTasks = synchronized {
+ private def incrTasks() = synchronized {
totaltasks += 1
}
- private def decrTasks = synchronized {
+ private def decrTasks() = synchronized {
totaltasks -= 1
}
@@ -361,12 +361,12 @@ trait FutureThreadPoolTasks extends Tasks {
trait TaskImpl[R, +Tp] extends Runnable with super.TaskImpl[R, Tp] {
@volatile var future: Future[_] = null
- def start = {
+ def start() = {
executor.synchronized {
future = executor.submit(this)
}
}
- def sync = future.get
+ def sync() = future.get
def tryCancel = false
def run = {
compute
@@ -435,8 +435,8 @@ trait HavingForkJoinPool {
trait ForkJoinTasks extends Tasks with HavingForkJoinPool {
trait TaskImpl[R, +Tp] extends RecursiveAction with super.TaskImpl[R, Tp] {
- def start = fork
- def sync = join
+ def start() = fork
+ def sync() = join
def tryCancel = tryUnfork
}
diff --git a/src/library/scala/collection/parallel/immutable/ParHashMap.scala b/src/library/scala/collection/parallel/immutable/ParHashMap.scala
index b9b7cbd69d..85084a945f 100644
--- a/src/library/scala/collection/parallel/immutable/ParHashMap.scala
+++ b/src/library/scala/collection/parallel/immutable/ParHashMap.scala
@@ -115,7 +115,7 @@ self =>
override def toString = "HashTrieIterator(" + sz + ")"
}
- private[parallel] def printDebugInfo {
+ private[parallel] def printDebugInfo() {
println("Parallel hash trie")
println("Top level inner trie type: " + trie.getClass)
trie match {
diff --git a/src/library/scala/collection/parallel/immutable/ParRange.scala b/src/library/scala/collection/parallel/immutable/ParRange.scala
index 198274f4e2..2a10458457 100644
--- a/src/library/scala/collection/parallel/immutable/ParRange.scala
+++ b/src/library/scala/collection/parallel/immutable/ParRange.scala
@@ -6,17 +6,13 @@
** |/ **
\* */
-
package scala.collection.parallel.immutable
-
-
import scala.collection.immutable.Range
import scala.collection.parallel.Combiner
import scala.collection.generic.CanCombineFrom
import scala.collection.parallel.IterableSplitter
-
-
+import scala.collection.Iterator
/** Parallel ranges.
*
@@ -111,18 +107,11 @@ self =>
cb
}
}
-
}
-
object ParRange {
def apply(start: Int, end: Int, step: Int, inclusive: Boolean) = new ParRange(
if (inclusive) new Range.Inclusive(start, end, step)
else new Range(start, end, step)
)
}
-
-
-
-
-
diff --git a/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala b/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala
index a4dc9b4a14..dc583fb4e7 100644
--- a/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala
+++ b/src/library/scala/collection/parallel/mutable/UnrolledParArrayCombiner.scala
@@ -56,7 +56,7 @@ extends Combiner[T, ParArray[T]] {
new ParArray(arrayseq)
}
- def clear {
+ def clear() {
buff.clear
}
diff --git a/src/library/scala/compat/Platform.scala b/src/library/scala/compat/Platform.scala
index b1c6c69145..8ee356e95f 100644
--- a/src/library/scala/compat/Platform.scala
+++ b/src/library/scala/compat/Platform.scala
@@ -67,7 +67,7 @@ object Platform {
def currentTime: Long = System.currentTimeMillis()
@inline
- def collectGarbage: Unit = System.gc()
+ def collectGarbage(): Unit = System.gc()
/** The name of the default character set encoding as a string */
@inline
diff --git a/src/library/scala/concurrent/Lock.scala b/src/library/scala/concurrent/Lock.scala
index 5494ff8c68..08c9f6cd63 100644
--- a/src/library/scala/concurrent/Lock.scala
+++ b/src/library/scala/concurrent/Lock.scala
@@ -18,12 +18,12 @@ package scala.concurrent
class Lock {
var available = true
- def acquire = synchronized {
+ def acquire() = synchronized {
while (!available) wait()
available = false
}
- def release = synchronized {
+ def release() = synchronized {
available = true
notify()
}
diff --git a/src/library/scala/concurrent/pilib.scala b/src/library/scala/concurrent/pilib.scala
index cad8aecf86..7a3758b9c6 100644
--- a/src/library/scala/concurrent/pilib.scala
+++ b/src/library/scala/concurrent/pilib.scala
@@ -43,13 +43,13 @@ object pilib {
abstract class Spawn {
def <(p: => Unit): Spawn
def |(p: => Unit): Spawn
- def > : Unit
+ def > (): Unit
}
val spawn = new Spawn {
//object spawn extends Spawn { // BUG !
def <(p: => Unit): Spawn = { scala.concurrent.ops.spawn(p); this }
def |(p: => Unit): Spawn = { scala.concurrent.ops.spawn(p); this }
- def > : Unit = ()
+ def > (): Unit = ()
}
/////////////////////////// GUARDED PROCESSES //////////////////////////
diff --git a/src/library/scala/deprecated.scala b/src/library/scala/deprecated.scala
index f64e34a5ac..53f5c456c2 100644
--- a/src/library/scala/deprecated.scala
+++ b/src/library/scala/deprecated.scala
@@ -10,11 +10,12 @@ package scala
import annotation.target._
-/**
- * An annotation that designates the definition to which it is applied as deprecated.
- * Access to the member then generates a deprecated warning.
+/** An annotation that designates that a definition is deprecated.
+ * Access to the member then generates a deprecated warning.
*
- * @since 2.3
+ * @param message the message to print during compilation if the definition is accessed
+ * @param since a string identifying the first version in which the definition was deprecated
+ * @since 2.3
*/
@getter @setter @beanGetter @beanSetter
class deprecated(message: String = "", since: String = "") extends annotation.StaticAnnotation
diff --git a/src/library/scala/io/BufferedSource.scala b/src/library/scala/io/BufferedSource.scala
index 5df52d45e3..fafb57da55 100644
--- a/src/library/scala/io/BufferedSource.scala
+++ b/src/library/scala/io/BufferedSource.scala
@@ -10,6 +10,7 @@ package scala.io
import java.io.{ InputStream, BufferedReader, InputStreamReader }
import Source.DefaultBufSize
+import scala.collection.Iterator
/** This object provides convenience methods to create an iterable
* representation of a source file.
diff --git a/src/library/scala/io/Position.scala b/src/library/scala/io/Position.scala
index 5b6accfea3..917d61ec25 100644
--- a/src/library/scala/io/Position.scala
+++ b/src/library/scala/io/Position.scala
@@ -51,7 +51,7 @@ abstract class Position {
if (line >= LINE_MASK)
LINE_MASK << COLUMN_BITS
else
- (line << COLUMN_BITS) | math.min(LINE_MASK, line)
+ (line << COLUMN_BITS) | math.min(COLUMN_MASK, column)
}
/** Returns the line number of the encoded position. */
diff --git a/src/library/scala/math/Ordered.scala b/src/library/scala/math/Ordered.scala
index 5a07451f4a..64cbd5e8f2 100644
--- a/src/library/scala/math/Ordered.scala
+++ b/src/library/scala/math/Ordered.scala
@@ -20,14 +20,14 @@ package scala.math
* there is no reasonable way to provide a default implementation
* of equality for instances of Ordered[A]. Therefore, if you need
* to be able to use equality on an instance of Ordered[A] you must
- * provide it yourself either when inheiriting or instantiating.
+ * provide it yourself either when inheriting or instantiating.
*
* It is important that the hashCode method for an instance of
* Ordered[A] be consistent with the compare method. However,
* it is not possible to provide a sensible default implementation.
* Therefore, if you need to be able compute the hash of an
* instance of Ordered[A] you must provide it yourself either when
- * inheiriting or instantiating.
+ * inheriting or instantiating.
*
* @author Martin Odersky
* @version 1.1, 2006-07-24
diff --git a/src/library/scala/mobile/Code.scala b/src/library/scala/mobile/Code.scala
deleted file mode 100644
index b25a36a04f..0000000000
--- a/src/library/scala/mobile/Code.scala
+++ /dev/null
@@ -1,234 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.mobile
-
-
-import java.lang.reflect.{Constructor, Method, Modifier}
-import java.lang.NoSuchMethodException
-
-/** The class <code>Code</code> provides <code>apply</code> methods
- * with different arities (actually up to 9 parameters) to invoke
- * a function simply by specifying its name and argument types.<p/>
- *
- * Example:<pre>
- * <b>val</b> url = <b>new</b> URL("http://scala-lang.org/classes/examples.jar");
- * <b>val</b> obj = <b>new</b> Location(url) create "examples.sort";
- * <b>val</b> ar = Array(6, 2, 8, 5, 1);
- * obj[Array[Int], Unit]("println")(ar);
- * obj[Array[Int], Unit]("sort")(ar);
- * obj[Array[Int], Unit]("println")(ar);</pre>
- *
- * @see <a href="Location.html">Location</a>
- *
- * @author Stephane Micheloud
- * @version 1.0, 04/05/2004
- */
-class Code(clazz: java.lang.Class[_]) {
-
- private type JObject = java.lang.Object
-
- private var instance: JObject = _
-
- ///////////////////////////// apply methods ///////////////////////////////
-
- type AnyClass = Class[T] forSome { type T }
-
- def apply[R](funName: String) =
- () => {
- val args = Array[JObject]()
- val types = Array[AnyClass]()
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, R](funName: String) =
- (_0: A0) => {
- val p = boxValue(_0)
- val args = Array(p._1)
- val types = Array[AnyClass](p._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, R](funName: String) =
- (_0: A0, _1: A1) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val args = Array(p0._1, p1._1)
- val types = Array[AnyClass](p0._2, p1._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, A2, R](funName: String) =
- (_0: A0, _1: A1, _2: A2) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val p2 = boxValue(_2)
- val args = Array(p0._1, p1._1, p2._1)
- val types = Array[AnyClass](p0._2, p1._2, p2._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, A2, A3, R](funName: String) =
- (_0: A0, _1: A1, _2: A2, _3: A3) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val p2 = boxValue(_2)
- val p3 = boxValue(_3)
- val args = Array(p0._1, p1._1, p2._1, p3._1)
- val types = Array[AnyClass](p0._2, p1._2, p2._2, p3._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, A2, A3, A4, R](funName: String) =
- (_0: A0, _1: A1, _2: A2, _3: A3, _4: A4) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val p2 = boxValue(_2)
- val p3 = boxValue(_3)
- val p4 = boxValue(_4)
- val args = Array(p0._1, p1._1, p2._1, p3._1, p4._1)
- val types = Array[AnyClass](p0._2, p1._2, p2._2, p3._2, p4._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, A2, A3, A4, A5, R](funName: String) =
- (_0: A0, _1: A1, _2: A2, _3: A3, _4: A4, _5: A5) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val p2 = boxValue(_2)
- val p3 = boxValue(_3)
- val p4 = boxValue(_4)
- val p5 = boxValue(_5)
- val args = Array(p0._1, p1._1, p2._1, p3._1, p4._1, p5._1)
- val types = Array[AnyClass](p0._2, p1._2, p2._2, p3._2, p4._2, p5._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, A2, A3, A4, A5, A6, R](funName: String) =
- (_0: A0, _1: A1, _2: A2, _3: A3, _4: A4, _5: A5, _6: A6) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val p2 = boxValue(_2)
- val p3 = boxValue(_3)
- val p4 = boxValue(_4)
- val p5 = boxValue(_5)
- val p6 = boxValue(_6)
- val args = Array(p0._1, p1._1, p2._1, p3._1, p4._1, p5._1, p6._1)
- val types = Array[AnyClass](p0._2, p1._2, p2._2, p3._2, p4._2, p5._2, p6._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, A2, A3, A4, A5, A6, A7, R](funName: String) =
- (_0: A0, _1: A1, _2: A2, _3: A3, _4: A4, _5: A5, _6: A6, _7: A7) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val p2 = boxValue(_2)
- val p3 = boxValue(_3)
- val p4 = boxValue(_4)
- val p5 = boxValue(_5)
- val p6 = boxValue(_6)
- val p7 = boxValue(_7)
- val args = Array(p0._1, p1._1, p2._1, p3._1, p4._1, p5._1, p6._1, p7._1)
- val types = Array[AnyClass](p0._2, p1._2, p2._2, p3._2, p4._2, p5._2, p6._2, p7._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- def apply[A0, A1, A2, A3, A4, A5, A6, A7, A8, R](funName: String) =
- (_0: A0, _1: A1, _2: A2, _3: A3, _4: A4, _5: A5, _6: A6, _7: A7, _8: A8) => {
- val p0 = boxValue(_0)
- val p1 = boxValue(_1)
- val p2 = boxValue(_2)
- val p3 = boxValue(_3)
- val p4 = boxValue(_4)
- val p5 = boxValue(_5)
- val p6 = boxValue(_6)
- val p7 = boxValue(_7)
- val p8 = boxValue(_8)
- val args = Array(p0._1, p1._1, p2._1, p3._1, p4._1, p5._1, p6._1, p7._1, p8._1)
- val types = Array[AnyClass](p0._2, p1._2, p2._2, p3._2, p4._2, p5._2, p6._2, p7._2, p8._2)
- applyFun(funName, args, types).asInstanceOf[R]
- }
-
- ////////////////////// private functions ///////////////////////
-
- private def boxValue(value: Any) = value match {
- case x: Byte => (java.lang.Byte.valueOf(x), java.lang.Byte.TYPE)
- case x: Boolean => (java.lang.Boolean.valueOf(x), java.lang.Boolean.TYPE)
- case x: Char => (java.lang.Character.valueOf(x), java.lang.Character.TYPE)
- case x: Short => (java.lang.Short.valueOf(x), java.lang.Short.TYPE)
- case x: Int => (java.lang.Integer.valueOf(x), java.lang.Integer.TYPE)
- case x: Long => (java.lang.Long.valueOf(x), java.lang.Long.TYPE)
- case x: Float => (java.lang.Float.valueOf(x), java.lang.Float.TYPE)
- case x: Double => (java.lang.Double.valueOf(x), java.lang.Double.TYPE)
- case _ =>
- val x = value.asInstanceOf[JObject]
- (x, x.getClass())
- }
-
- private def isConstructorName(methName: String) = {
- var className = clazz.getName()
- val classInx = className.lastIndexOf(".")
- val methInx = methName.lastIndexOf(".")
- if (classInx > 0 && methInx < 0)
- className = className.substring(classInx + 1, className.length())
- methName.equals(className)
- }
-
- private def applyFun(methName: String, args: Array[JObject],
- argTypes: Array[Class[T] forSome { type T }]): JObject = {
- try {
- val method = clazz.getMethod(methName, argTypes : _*)
- var obj: JObject = null
- if (! Modifier.isStatic(method.getModifiers())) {
- if (instance eq null) {
- instance = try {
- clazz.newInstance().asInstanceOf[AnyRef]
- } catch { case _ =>
- val cs = clazz.getConstructors()
-//Console.println("cs.length=" + cs.length);
- if (cs.length > 0) {
- cs(0).newInstance("").asInstanceOf[AnyRef]
- } else {
- sys.error("class " + clazz.getName() + " has no public constructor")
- }
- }
- }
- obj = instance
- }
- val result = method.invoke(obj, args : _*)
- if (result eq null) ().asInstanceOf[JObject] else result
- }
- catch {
- case me: NoSuchMethodException =>
- if (isConstructorName(methName)) {
- try {
- val cstr = clazz.getConstructor(argTypes : _*)
- instance = cstr.newInstance(args : _*).asInstanceOf[AnyRef]
- instance
- }
- catch {
- case e: Exception =>
- Console.println(e.getMessage())
- e.printStackTrace()
- }
- }
- else {
- Console.println(me.getMessage())
- me.printStackTrace()
- }
- null
- case e: Exception =>
- Console.println(e.getMessage())
- e.printStackTrace()
- null
- }
- }
-
-}
diff --git a/src/library/scala/mobile/Location.scala b/src/library/scala/mobile/Location.scala
deleted file mode 100644
index 159bf11141..0000000000
--- a/src/library/scala/mobile/Location.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-package scala.mobile
-
-import java.net._
-import scala.collection.mutable
-
-/** The class <code>Location</code> provides a <code>create</code>
- * method to instantiate objects from a network location by
- * specifying the URL address of the jar/class file.<p/>
- *
- * An update of the jar/class file should not break your code as far
- * as the used class names and method signatures are the same.<p/>
- *
- * Example:<pre>
- * <b>val</b> url = <b>new</b> URL("http://scala-lang.org/classes/examples.jar");
- * <b>val</b> obj = <b>new</b> Location(url) create "examples.sort";</pre>
- *
- * @see <a href="Code.html">Code</a>
- *
- * @author Stephane Micheloud
- * @version 1.0, 04/05/2004
- */
-class Location(url: URL) {
- /** A cache containing all class loaders of this location.
- */
- private val lcache = new mutable.HashMap[URL, ClassLoader]
-
- /** The class loader associated with this location.
- */
- private val loader =
- if (url eq null) ClassLoader.getSystemClassLoader()
- else lcache.getOrElseUpdate(url, new URLClassLoader(Array(url)))
-
- /** A cache containing all classes of this location.
- */
- private val ccache = new mutable.HashMap[String, java.lang.Class[_]]
-
- /** Return the code description for the string <code>className</code>
- * at this location.
- *
- * @param classname the name of the class
- * @return the code description corresponding to `className`.
- */
- def create(className: String) = new Code(
- ccache.getOrElseUpdate(className, {
- // source 'class A { ... }' becomes in bytecode: interface A.class + class A$class.class
- // source 'object A { ... }' becomes in bytecode: interface A.class + class A$.class
- val append = if (loader.loadClass(className).isInterface) "$class" else "$"
- loader loadClass (className + append)
- })
- )
-}
-
-/** The object <code>Location</code> can be used to instantiate
- * objects on the same Java VM. It is just provided to illustrate
- * the special case where resources are available locally.<p/>
- *
- * Example:<pre>
- * <b>val</b> obj = Location.create("xcode.Math");
- * <b>val</b> x = obj[Int, Int]("square")(5);</pre>
- *
- * @author Stephane Micheloud
- * @version 1.0, 04/05/2004
- */
-object Location extends Location(null)
diff --git a/src/library/scala/package.scala b/src/library/scala/package.scala
index 0e966acd6b..264fd18406 100644
--- a/src/library/scala/package.scala
+++ b/src/library/scala/package.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-
+import annotation.bridge
/**
* Core Scala types. They are always available without an explicit import.
@@ -72,12 +72,14 @@ package object scala {
val Range = scala.collection.immutable.Range
// Migrated from Predef
-
- val $scope = scala.xml.TopScope
-
@deprecated("Use Thread.currentThread instead", "2.9.0")
def currentThread = java.lang.Thread.currentThread()
+ // Moved back into Predef to avoid unnecessary indirection by
+ // way of the scala package object within the standard library,
+ // but bridged for compatibility.
+ @bridge def $scope = scala.xml.TopScope
+
// Numeric types which were moved into scala.math.*
type BigDecimal = scala.math.BigDecimal
diff --git a/src/library/scala/reflect/ScalaBeanInfo.scala b/src/library/scala/reflect/ScalaBeanInfo.scala
index 6b026907f4..bcb76c38bc 100644
--- a/src/library/scala/reflect/ScalaBeanInfo.scala
+++ b/src/library/scala/reflect/ScalaBeanInfo.scala
@@ -34,7 +34,7 @@ abstract class ScalaBeanInfo(clazz: java.lang.Class[_],
// override def getAdditionalBeanInfo() = Array(Introspector getBeanInfo clazz.getSuperclass)
- private def init {
+ private def init() {
var i = 0;
while (i < props.length) {
pd(i/3) = new PropertyDescriptor(props(i), clazz, props(i+1), props(i+2))
diff --git a/src/library/scala/runtime/RichBoolean.scala b/src/library/scala/runtime/RichBoolean.scala
index 5be4e07f2f..d44868708d 100644
--- a/src/library/scala/runtime/RichBoolean.scala
+++ b/src/library/scala/runtime/RichBoolean.scala
@@ -6,10 +6,8 @@
** |/ **
\* */
-
-
package scala.runtime
final class RichBoolean(val self: Boolean) extends OrderedProxy[Boolean] {
- protected val ord = Ordering[Boolean]
+ protected val ord = math.Ordering[Boolean]
}
diff --git a/src/library/scala/sys/SystemProperties.scala b/src/library/scala/sys/SystemProperties.scala
index 296db9e469..25fd6e53a8 100644
--- a/src/library/scala/sys/SystemProperties.scala
+++ b/src/library/scala/sys/SystemProperties.scala
@@ -8,7 +8,7 @@
package scala.sys
-import scala.collection.mutable
+import scala.collection.{ mutable, Iterator }
import scala.collection.JavaConverters._
import java.security.AccessControlException
diff --git a/src/library/scala/sys/process/BasicIO.scala b/src/library/scala/sys/process/BasicIO.scala
index 88e66afc91..6adce06f36 100644
--- a/src/library/scala/sys/process/BasicIO.scala
+++ b/src/library/scala/sys/process/BasicIO.scala
@@ -12,6 +12,7 @@ package process
import processInternal._
import java.io.{ BufferedReader, InputStreamReader, FilterInputStream, FilterOutputStream }
import java.util.concurrent.LinkedBlockingQueue
+import scala.collection.immutable.Stream
object BasicIO {
final val BufferSize = 8192
diff --git a/src/library/scala/sys/process/Process.scala b/src/library/scala/sys/process/Process.scala
index 983fc8309c..01fbaf19e3 100644
--- a/src/library/scala/sys/process/Process.scala
+++ b/src/library/scala/sys/process/Process.scala
@@ -38,7 +38,7 @@ trait ProcessCreation {
def apply(command: Seq[String], cwd: File, extraEnv: (String, String)*): ProcessBuilder =
apply(command, Some(cwd), extraEnv: _*)
- /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
+ /** create ProcessBuilder with working dir optionally set to File and extra environment variables */
def apply(command: String, cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
apply(command.split("""\s+"""), cwd, extraEnv : _*)
// not smart to use this on windows, because CommandParser uses \ to escape ".
@@ -48,7 +48,7 @@ trait ProcessCreation {
}*/
}
- /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */
+ /** create ProcessBuilder with working dir optionally set to File and extra environment variables */
def apply(command: Seq[String], cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = {
val jpb = new JProcessBuilder(command.toArray: _*)
cwd foreach (jpb directory _)
diff --git a/src/library/scala/sys/process/ProcessImpl.scala b/src/library/scala/sys/process/ProcessImpl.scala
index 857c1af15e..b7549eeb06 100644
--- a/src/library/scala/sys/process/ProcessImpl.scala
+++ b/src/library/scala/sys/process/ProcessImpl.scala
@@ -28,7 +28,7 @@ private[process] trait ProcessImpl {
private[process] object Future {
def apply[T](f: => T): () => T = {
val result = new SyncVar[Either[Throwable, T]]
- def run: Unit =
+ def run(): Unit =
try result set Right(f)
catch { case e: Exception => result set Left(e) }
diff --git a/src/library/scala/testing/Benchmark.scala b/src/library/scala/testing/Benchmark.scala
index 34f769be11..c6ab992306 100644
--- a/src/library/scala/testing/Benchmark.scala
+++ b/src/library/scala/testing/Benchmark.scala
@@ -75,7 +75,7 @@ trait Benchmark {
* should not be measured. This method is run before each call to the
* benchmark payload, 'run'.
*/
- def setUp {
+ def setUp() {
}
/** Perform cleanup operations after each 'run'. For micro benchmarks,
@@ -84,7 +84,7 @@ trait Benchmark {
* write the results to a file. The execution time of this method is not
* measured.
*/
- def tearDown {
+ def tearDown() {
}
/** a string that is written at the beginning of the output line
diff --git a/src/library/scala/util/MurmurHash.scala b/src/library/scala/util/MurmurHash.scala
index f1f6e08254..71db2536be 100644
--- a/src/library/scala/util/MurmurHash.scala
+++ b/src/library/scala/util/MurmurHash.scala
@@ -20,6 +20,7 @@ package scala.util
*/
import java.lang.Integer.{ rotateLeft => rotl }
+import scala.collection.Iterator
/** A class designed to generate well-distributed non-cryptographic
* hashes. It is designed to be passed to a collection's foreach method,
diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala
index f3d1397075..cfd6154874 100644
--- a/src/library/scala/util/Random.scala
+++ b/src/library/scala/util/Random.scala
@@ -6,20 +6,17 @@
** |/ **
\* */
-
-
package scala.util
-import collection.immutable.List
+import collection.mutable.ArrayBuffer
+import collection.generic.CanBuildFrom
+import scala.collection.immutable.{ List, Stream }
/**
* @author Stephane Micheloud
*
*/
class Random(val self: java.util.Random) {
- import collection.mutable.ArrayBuffer
- import collection.generic.CanBuildFrom
-
/** Creates a new random number generator using a single long seed. */
def this(seed: Long) = this(new java.util.Random(seed))
diff --git a/src/library/scala/util/Sorting.scala b/src/library/scala/util/Sorting.scala
index e687335b65..f286670f25 100644
--- a/src/library/scala/util/Sorting.scala
+++ b/src/library/scala/util/Sorting.scala
@@ -9,6 +9,7 @@
package scala.util
import scala.reflect.ClassManifest
+import scala.math.Ordering
/** The Sorting object provides functions that can sort various kinds of
* objects. You can provide a comparison function, or you can request a sort
diff --git a/src/library/scala/util/control/Breaks.scala b/src/library/scala/util/control/Breaks.scala
index 139fcc0bd6..c436df9f8f 100644
--- a/src/library/scala/util/control/Breaks.scala
+++ b/src/library/scala/util/control/Breaks.scala
@@ -57,7 +57,7 @@ class Breaks {
* @note this might be different than the statically closest enclosing
* block!
*/
- def break { throw breakException }
+ def break() { throw breakException }
}
/** An object that can be used for the break control abstraction.
diff --git a/src/library/scala/util/parsing/ast/Binders.scala b/src/library/scala/util/parsing/ast/Binders.scala
index 494cb04166..a4f457e1bf 100644
--- a/src/library/scala/util/parsing/ast/Binders.scala
+++ b/src/library/scala/util/parsing/ast/Binders.scala
@@ -172,8 +172,8 @@ trait Binders extends AbstractSyntax with Mappable {
* the binding in the returned scope also does, and thus the check that all variables are bound is deferred until this scope is left **/
def nested: Scope[binderType] = this // TODO
- def onEnter {}
- def onLeft {}
+ def onEnter() {}
+ def onLeft() {}
}
diff --git a/src/library/scala/xml/MetaData.scala b/src/library/scala/xml/MetaData.scala
index 2e55a9d67e..e3e025cf59 100644
--- a/src/library/scala/xml/MetaData.scala
+++ b/src/library/scala/xml/MetaData.scala
@@ -11,7 +11,7 @@ package scala.xml
import Utility.sbToString
import annotation.tailrec
-
+import scala.collection.Iterator
/**
* Copyright 2008 Google Inc. All Rights Reserved.
diff --git a/src/library/scala/xml/Null.scala b/src/library/scala/xml/Null.scala
index 7769ddf0df..0b527c91bd 100644
--- a/src/library/scala/xml/Null.scala
+++ b/src/library/scala/xml/Null.scala
@@ -11,6 +11,7 @@
package scala.xml
import Utility.{ isNameStart }
+import scala.collection.Iterator
/** Essentially, every method in here is a dummy, returning Zero[T].
* It provides a backstop for the unusual collection defined by MetaData,
diff --git a/src/library/scala/xml/dtd/ContentModelParser.scala b/src/library/scala/xml/dtd/ContentModelParser.scala
index 90255e966a..2d87bc0764 100644
--- a/src/library/scala/xml/dtd/ContentModelParser.scala
+++ b/src/library/scala/xml/dtd/ContentModelParser.scala
@@ -73,7 +73,7 @@ object ContentModelParser extends Scanner { // a bit too permissive concerning #
sys.error("unexpected token:" + token2string(token) );
}
// sopt ::= S?
- def sOpt = if( token == S ) nextToken;
+ def sOpt() = if( token == S ) nextToken;
// (' S? mixed ::= '#PCDATA' S? ')'
// | '#PCDATA' (S? '|' S? atom)* S? ')*'
diff --git a/src/library/scala/xml/dtd/Scanner.scala b/src/library/scala/xml/dtd/Scanner.scala
index 20c0204e51..82a8d1af2f 100644
--- a/src/library/scala/xml/dtd/Scanner.scala
+++ b/src/library/scala/xml/dtd/Scanner.scala
@@ -33,7 +33,7 @@ class Scanner extends Tokens with parsing.TokenTests {
}
/** scans the next token */
- final def nextToken {
+ final def nextToken() {
if (token != END) token = readToken
}
@@ -41,7 +41,7 @@ class Scanner extends Tokens with parsing.TokenTests {
final def isIdentChar = ( ('a' <= c && c <= 'z')
|| ('A' <= c && c <= 'Z'));
- final def next = if (it.hasNext) c = it.next else c = ENDCH
+ final def next() = if (it.hasNext) c = it.next else c = ENDCH
final def acc(d: Char) {
if (c == d) next else sys.error("expected '"+d+"' found '"+c+"' !");
diff --git a/src/library/scala/xml/factory/LoggedNodeFactory.scala b/src/library/scala/xml/factory/LoggedNodeFactory.scala
index 6a777f4605..c15a9ebe7b 100644
--- a/src/library/scala/xml/factory/LoggedNodeFactory.scala
+++ b/src/library/scala/xml/factory/LoggedNodeFactory.scala
@@ -37,7 +37,7 @@ trait LoggedNodeFactory[A <: Node] extends NodeFactory[A] with scala.util.loggin
final val NONE = 0
final val CACHE = 1
final val FULL = 2
- /** 0 = no loggging, 1 = cache hits, 2 = detail */
+ /** 0 = no logging, 1 = cache hits, 2 = detail */
val logCompressLevel = 1
// methods of NodeFactory
diff --git a/src/library/scala/xml/parsing/FactoryAdapter.scala b/src/library/scala/xml/parsing/FactoryAdapter.scala
index f2dc191063..67e06ff5ca 100644
--- a/src/library/scala/xml/parsing/FactoryAdapter.scala
+++ b/src/library/scala/xml/parsing/FactoryAdapter.scala
@@ -6,20 +6,16 @@
** |/ **
\* */
-
-
package scala.xml
package parsing
import java.io.{ InputStream, Reader, File, FileDescriptor, FileInputStream }
-import collection.mutable.Stack
-
+import scala.collection.{ mutable, Iterator }
import org.xml.sax.Attributes
import org.xml.sax.helpers.DefaultHandler
// can be mixed into FactoryAdapter if desired
-trait ConsoleErrorHandler extends DefaultHandler
-{
+trait ConsoleErrorHandler extends DefaultHandler {
// ignore warning, crimson warns even for entity resolution!
override def warning(ex: SAXParseException): Unit = { }
override def error(ex: SAXParseException): Unit = printError("Error", ex)
@@ -38,15 +34,14 @@ trait ConsoleErrorHandler extends DefaultHandler
* namespace bindings, without relying on namespace handling of the
* underlying SAX parser.
*/
-abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node]
-{
+abstract class FactoryAdapter extends DefaultHandler with factory.XMLLoader[Node] {
var rootElem: Node = null
val buffer = new StringBuilder()
- val attribStack = new Stack[MetaData]
- val hStack = new Stack[Node] // [ element ] contains siblings
- val tagStack = new Stack[String]
- var scopeStack = new Stack[NamespaceBinding]
+ val attribStack = new mutable.Stack[MetaData]
+ val hStack = new mutable.Stack[Node] // [ element ] contains siblings
+ val tagStack = new mutable.Stack[String]
+ var scopeStack = new mutable.Stack[NamespaceBinding]
var curTag : String = null
var capture: Boolean = false
diff --git a/src/library/scala/xml/parsing/MarkupParserCommon.scala b/src/library/scala/xml/parsing/MarkupParserCommon.scala
index d2174c2879..d9729e14e1 100644
--- a/src/library/scala/xml/parsing/MarkupParserCommon.scala
+++ b/src/library/scala/xml/parsing/MarkupParserCommon.scala
@@ -201,13 +201,13 @@ private[scala] trait MarkupParserCommon extends TokenTests {
def xToken(that: Seq[Char]) { that foreach xToken }
/** scan [S] '=' [S]*/
- def xEQ = { xSpaceOpt; xToken('='); xSpaceOpt }
+ def xEQ() = { xSpaceOpt; xToken('='); xSpaceOpt }
/** skip optional space S? */
- def xSpaceOpt = while (isSpace(ch) && !eof) nextch
+ def xSpaceOpt() = while (isSpace(ch) && !eof) nextch
/** scan [3] S ::= (#x20 | #x9 | #xD | #xA)+ */
- def xSpace =
+ def xSpace() =
if (isSpace(ch)) { nextch; xSpaceOpt }
else xHandleError(ch, "whitespace expected")
diff --git a/src/library/scala/xml/persistent/CachedFileStorage.scala b/src/library/scala/xml/persistent/CachedFileStorage.scala
index 7f5b6b6310..bcdd1a3f2d 100644
--- a/src/library/scala/xml/persistent/CachedFileStorage.scala
+++ b/src/library/scala/xml/persistent/CachedFileStorage.scala
@@ -10,9 +10,12 @@
package scala.xml
package persistent
-import java.io.{File, FileOutputStream}
+import java.io.{ File, FileOutputStream }
import java.nio.ByteBuffer
import java.nio.channels.Channels
+import java.lang.Thread
+import scala.util.logging.Logged
+import scala.collection.Iterator
/** <p>
* Mutable storage of immutable xml trees. Everything is kept in memory,
@@ -24,8 +27,7 @@ import java.nio.channels.Channels
*
* @author Burak Emir
*/
-abstract class CachedFileStorage(private val file1: File)
-extends java.lang.Thread with scala.util.logging.Logged {
+abstract class CachedFileStorage(private val file1: File) extends Thread with Logged {
private val file2 = new File(file1.getParent, file1.getName+"$")
@@ -33,7 +35,7 @@ extends java.lang.Thread with scala.util.logging.Logged {
*/
private var theFile: File = null
- private def switch = { theFile = if (theFile == file1) file2 else file1; }
+ private def switch() = { theFile = if (theFile == file1) file2 else file1; }
/** this storage modified since last modification check */
protected var dirty = false
@@ -82,7 +84,7 @@ extends java.lang.Thread with scala.util.logging.Logged {
}
/** saves the XML to file */
- private def save = if (this.dirty) {
+ private def save() = if (this.dirty) {
log("[save]\ndeleting "+theFile);
theFile.delete();
log("creating new "+theFile);
@@ -115,7 +117,7 @@ extends java.lang.Thread with scala.util.logging.Logged {
}
/** forces writing of contents to the file, even if there has not been any update. */
- def flush = {
+ def flush() = {
this.dirty = true;
save
}
diff --git a/src/library/scala/xml/pull/XMLEventReader.scala b/src/library/scala/xml/pull/XMLEventReader.scala
index 3902967626..51a2fda6aa 100755
--- a/src/library/scala/xml/pull/XMLEventReader.scala
+++ b/src/library/scala/xml/pull/XMLEventReader.scala
@@ -6,14 +6,13 @@
** |/ **
\* */
-
package scala.xml
package pull
+import scala.io.Source
+import java.lang.Thread
import java.util.concurrent.LinkedBlockingQueue
import java.nio.channels.ClosedChannelException
-
-import scala.io.Source
import scala.xml.parsing.{ ExternalSources, MarkupHandler, MarkupParser }
/**
@@ -49,7 +48,7 @@ class XMLEventReader(src: Source) extends ProducerConsumerIterator[XMLEvent] {
// fails for whatever reason the iterator correctness is not impacted,
// only performance (because it will finish the entire XML document,
// or at least as much as it can fit in the queue.)
- def stop = {
+ def stop() = {
produce(POISON)
parserThread.interrupt()
}
@@ -104,8 +103,7 @@ class XMLEventReader(src: Source) extends ProducerConsumerIterator[XMLEvent] {
// the next call hasNext is guaranteed not to block.
//
// This is not thread-safe for multiple consumers!
-trait ProducerConsumerIterator[T >: Null] extends Iterator[T]
-{
+trait ProducerConsumerIterator[T >: Null] extends Iterator[T] {
// abstract - iterator-specific distinguished object for marking eos
val EndOfStream: T