summaryrefslogtreecommitdiff
path: root/src/library
Commit message (Collapse)AuthorAgeFilesLines
* Inline ArrayRuntime methods in ScalaRunTime.array_clone().Sébastien Doeraene2016-04-132-35/+9
| | | | | | | | | | | | | | Support for Array[T].clone() was introduced in 36ef60e68c03bc1c7fd2e910ae7d70d4ec32d3bf. At the time, all calls to array.clone() were redirected to ScalaRunTime.array_clone(), which meant that array_clone() itself could not be implemented in terms of `x.clone()`. A Java binding was necessary. Now, the rewriting to `array_clone()` is only done for unbounded generic arrays. Since all the calls within `array_clone()` are monomorphic arrays, the rewriting is not applied, and the Java binding is unnecessary.
* Delete unnecessary blank linesh0hei2016-04-071-2/+0
|
* Generate AnyVal source stubs from sbtStefan Zeiger2016-04-069-18/+18
| | | | | | | | | | | | The sbt command `generateSources` now generates both the AnyVal sources and the tuple/function sources (previously done by `genprod`). Source generation is part of the sbt build, the `scala.tools.cmd.gen` package is removed from `scala-compiler`. This simplifies bootstrapping. Generated sources are still in the same location and checked into git. The shell scripts `tools/codegen` and `tools/codegen-anyvals` are also removed. The ant build and the build scripts do not call these. Regenerating sources is a manual step at the moment.
* General cleanups and less warnings during a Scala buildsoc2016-04-048-27/+7
|
* SI-6710 Clarify stub methods in primitive value classesLukas Rytz2016-04-019-27/+36
| | | | | | | | | - Replaces the implementations of box/unbox in AnyVal companions by `???`, the methods are only stubs, and the impls did not correspond to the actual behavior. The doc comment already points to the actual implementation in BoxesRunTime. - Replaces the body of `getClass` from `null` to `???` and clarifies in a comment why the overrides exist.
* Merge pull request #5068 from retronym/topic/jdk8ism2v2.12.0-M4Lukas Rytz2016-04-018-51/+20
|\ | | | | Accomodate and exploit new library, lang features JDK 8
| * Use System.lineSeparator, rather than sys.propsJason Zaugg2016-03-293-4/+3
| |
| * Use Java's highestOneBit, rather than our own versions.Jason Zaugg2016-03-291-21/+2
| | | | | | | | | | | | | | | | | | | | | | The original code came from 2008, (a4ace382), at which point we probably couldn't use JDK 1.5+ methods. I haven't changed `unsignedCompare` yet to use the standard library version, as it our version might have different performance characteristics. Background: http://www.drmaciver.com/2008/08/unsigned-comparison-in-javascala/
| * Note the availability of writableStackTrace in JDK 1.7+Jason Zaugg2016-03-291-0/+2
| |
| * SI-7474 Record extra errors in Throwable#suppressedExceptionsJason Zaugg2016-03-291-7/+4
| | | | | | | | | | | | | | ... in parallel collection operations. Followup to bcbe38d18, which did away with the the approach to use a composite exception when more than one error happened.
| * Delegate more primitive comparison to the Java stdlibJason Zaugg2016-03-291-16/+6
| | | | | | | | The API for doing so efficiently was made regular in Java 1.8.
| * Avoid intermediate boxing in BoxesRuntime.hashCodeFromJason Zaugg2016-03-291-3/+3
| | | | | | | | | | By using newly introduced static methods in the Java standard library.
* | Merge pull request #5070 from markus1189/stream-docsLukas Rytz2016-04-011-1/+1
|\ \ | | | | | | Fix typo in the docs for the ++ method of Stream
| * | Fix typo in the docs for the ++ method of StreamMarkus Hauck2016-03-311-1/+1
| | |
* | | Merge pull request #5071 from janekdb/topic/2.12.x-scaladoc-ExceptionsLukas Rytz2016-04-011-7/+13
|\ \ \ | | | | | | | | Add initial unit test for Catch and augment documentation
| * | | Add initial unit test for Catch and augment documentationJanek Bogucki2016-03-311-7/+13
| |/ / | | | | | | | | | | | | | | | - Add unit test for andFinally - Reduce code duplication in andFinally - Extend documentation
* | | Merge pull request #4971 from adriaanm/genbcode-delambdafyAdriaan Moors2016-03-311-1/+5
|\ \ \ | |/ / |/| | Unify treatment of built-in functions and SAMs
| * | Target FunctionN, not scala/runtime/java8/JFunction.Adriaan Moors2016-03-281-1/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We compile FunctionN to Java 8's idea of a function now, so no need to target the artisanal JFunction and friends, except when the function is specialized, as I don't yet see how we can use LMF with the way specialization handles FunctionN: First, the working status quo -- the hand-crafted specialized versions of JFunction0. Notice how `apply$mcB$sp` is looking pretty SAMmy: ``` @FunctionalInterface public interface JFunction0$mcB$sp extends JFunction0 { @Override public byte apply$mcB$sp(); @Override default public Object apply() { return BoxesRunTime.boxToByte(this.apply$mcB$sp()); } } ``` Contrast this with our specialized standard FunctionN: ``` public interface Function0<R> { public R apply(); default public byte apply$mcB$sp() { return BoxesRunTime.unboxToByte(this.apply()); } } public interface Function0$mcB$sp extends Function0<Object> { } ``` The single abstract method in `Function0$mcB$sp` is `apply`, and the method that would let us avoid boxing, if it were abstract, is `apply$mcB$sp`... TODO (after M4): - do same for specialized functions (issues with boxing?) - remove scala/runtime/java8/JFunction* (need new STARR?)
* | Merge pull request #5033 from szeiger/issue/9623-2.12Adriaan Moors2016-03-301-44/+46
|\ \ | | | | | | Replace JoinIterator & improve ConcatIterator
| * | Replace JoinIterator & improve ConcatIteratorStefan Zeiger2016-03-111-44/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new `ConcatIterator` requires only one extra lightweight wrapper object (cons cell) to be allocated compared to `JoinIterator`. All additional concatenations are then done in place with one cons cell per appended iterator. Running 1000000 iterations of the following benchmark for LHS recursion: ``` def lhs(n: Int) = (1 to n).foldLeft(Iterator.empty: Iterator[Int])((res, _) => res ++ Iterator(1)).sum ``` On 2.12.x before SI-9623 fix: ``` $ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala 1000000: 555ms 1000000: 344ms 1000000: 397ms 1000000: 309ms 1000000: 290ms 1000000: 283ms 1000000: 282ms 1000000: 281ms 1000000: 290ms 1000000: 279ms ``` With SI-9623 fix: ``` $ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala 1000000: 610ms 1000000: 324ms 1000000: 387ms 1000000: 315ms 1000000: 296ms 1000000: 300ms 1000000: 341ms 1000000: 294ms 1000000: 291ms 1000000: 281ms ``` With this version: ``` $ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala 1000000: 362ms 1000000: 162ms 1000000: 140ms 1000000: 150ms 1000000: 110ms 1000000: 57ms 1000000: 79ms 1000000: 109ms 1000000: 120ms 1000000: 49ms ``` And for RHS recursion: ``` def rhs(n: Int) = (1 to n).foldLeft(Iterator.empty: Iterator[Int])((res, _) => Iterator(1) ++ res).sum ``` On 2.12.x before SI-9623 fix: ``` StackOverflowError ``` With SI-9623 fix: ``` StackOverflowError ``` With this version: ``` $ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala 1000000: 3156ms 1000000: 1536ms 1000000: 1240ms 1000000: 1575ms 1000000: 439ms 1000000: 706ms 1000000: 1043ms 1000000: 1211ms 1000000: 515ms 1000000: 314ms ```
* | | Merge pull request #5008 from janekdb/2.12.x-remove-Predef-errorSeth Tisue2016-03-291-7/+1
|\ \ \ | | | | | | | | Remove deprecated Predef.error
| * | | Remove deprecated Predef.errorJanek Bogucki2016-03-261-7/+1
| | |/ | |/| | | | | | | | | | | | | error was deprecated in 2.9.0 but remained to ensure compatibility with sbt. This changes follows on from an update to the latest sbt version (0.13.11).
* | | Merge pull request #5021 from szeiger/wip/remove-deprecationsSeth Tisue2016-03-2917-248/+204
|\ \ \ | |/ / |/| | Seal collection classes that were annotated with deprecatedInheritance in 2.11.0
| * | Make some collection classes final or sealedStefan Zeiger2016-03-2317-248/+204
| | | | | | | | | | | | | | | | | | | | | They were all annotated with `@deprecatedInheritance` in 2.11.0. Some deprecated classes are moved to new source files in order to seal the parent class. The package-private class `DoublingUnrolledBuffer` is moved from `scala.collection.parallel.mutable` to `scala.collection.mutable` in order to seal `UnrolledBuffer`.
* | | Merge pull request #5051 from kmizu/improve-api-docsAdriaan Moors2016-03-231-0/+1
|\ \ \ | | | | | | | | Improve documentation of `GenSeqLike#length`
| * | | Add scaladoc comment about the case when Exception will be thrown by ↵Kota Mizushima2016-03-241-0/+1
| |/ / | | | | | | | | | invocation of length method
* | | Merge pull request #5047 from kmizu/resolve-several-warningsAdriaan Moors2016-03-223-9/+9
|\ \ \ | | | | | | | | Resolve several deprecation warnings
| * | | Resolve warnings related to SyncVar#setKota Mizushima2016-03-183-9/+9
| |/ / | | | | | | | | | Replace it with SyncVar#put
* | | Merge pull request #5034 from janekdb/topic/2.12.x-scaladoc-Predef-method-groupsSeth Tisue2016-03-211-0/+106
|\ \ \ | | | | | | | | Organise Predef methods into Scaladoc groups
| * | | Organise Predef members into Scaladoc groupsJanek Bogucki2016-03-161-0/+106
| |/ / | | | | | | | | | | | | By grouping members and providing descriptions the signal to noise ratio in Predef is usefully enhanced.
* | | Merge pull request #5043 from dongjoon-hyun/fix_typos_in_spec_and_commentsJason Zaugg2016-03-211-1/+1
|\ \ \ | | | | | | | | Fix some typos in `spec` documents and comments.
| * | | Fix some typos in `spec` documents and comments.Dongjoon Hyun2016-03-151-1/+1
| |/ /
* / / Remove manual mixins in JFunctionN.v2.12.0-M3-dc9effeJason Zaugg2016-03-1822-263/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These manual mixins were forwarding to the impl classes have just been removed. We can now rely on default methods instead. Update Tests: - Fix test/files/pos/t1237.scala, we can't have an outer field in an interface, always use the outer method. - Don't crash on meaningless trait early init fields test/files/neg/t2796.scala - Remove impl class relate parts of inner class test - Remove impl class relate parts of elidable test - Remove impl class related reflection test. - Remove test solely about trait impl classes renaming - Update check file with additional stub symbol error - Disable unstable parts of serialization test. - TODO explain, and reset the expectation
* | Merge pull request #5037 from janekdb/topic/2.12.x-scaladoc-fix-Source-linksAdriaan Moors2016-03-141-10/+8
|\ \ | | | | | | Fix Scaladoc links in scala.io.Source
| * | Fix Scaladoc links in scala.io.SourceJanek Bogucki2016-03-131-10/+8
| |/ | | | | | | | | The link to iter will work if the restriction to showing only public members is lifted in the visibility section.
* | Merge pull request #5040 from adriaanm/rebase-5031Jason Zaugg2016-03-151-1/+1
|\ \ | | | | | | Merge 2.11.x into 2.12.x [ci: last-only]
| * \ Merge 2.11.x into 2.12.xAdriaan Moors2016-03-141-1/+1
| |\ \ | | | | | | | | | | | | Resolved conflicts as in b0e05b67c7
| | * \ Merge pull request #4994 from dk14/patch-1Seth Tisue2016-03-041-1/+1
| | |\ \ | | | | | | | | | | explicitly specify insertion-order feature in docs
| | | * | explicitly specify insertion-order feature in docsdk142016-02-231-1/+1
| | | | |
* | | | | Merge pull request #5018 from ↵Seth Tisue2016-03-141-5/+31
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | janekdb/topic/2.12.x-scaladoc-advertise-deprecated-read-methods-less-Predef Remove mention of deprecated I/O methods from Predef main comment
| * | | | | Remove mention of deprecated I/O methods from Predef main commentJanek Bogucki2016-03-141-5/+31
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The read* functions are deprecated so should not be highlighted. Copied Scaladoc from Console on the assumption that few people will tarry for long once they have seen the existence of the print* methods. Linkified print* methods. Added note to printf encouraging use of f interpolator.
* | | | | Merge pull request #5013 from janekdb/2.12.x-Scaladoc-ConversionsSeth Tisue2016-03-143-49/+49
|\ \ \ \ \ | |/ / / / |/| | | | Format collection conversions Scaladoc as code blocks instead of bullets
| * | | | Format collection conversions Scaladoc as code blocks instead of bulletsJanek Bogucki2016-03-093-49/+49
| | |_|/ | |/| | | | | | | | | | | | | | - Makes the list of conversions easier to scan - Makes main comment formatting internally consistent
* | | | Merge pull request #4717 from Ichoran/issue/9347Adriaan Moors2016-03-146-3/+79
|\ \ \ \ | | | | | | | | | | SI-9347 Efficient head/tail, if possible, for immutable maps & sets
| * | | | SI-9347 Efficient head/tail, if possible, for immutable maps & setsRex Kerr2016-02-176-3/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most immutable collections, including sets and maps, have a better-than-O(n) method for removing an element. In those cases, tail and possibly head were overridden so the head/tail pattern can be used with less of a performance penalty. Speed improvements on head/tail pattern are (for sets/maps of size 1024, unless otherwise specified): ``` BitSet 190x HashSet 250x Set 400x Set2 9x Set4 12x HashMap 430x ListMap 2500x // size 128 Map 430x ``` Note: `ListMap` is actually `init`/`last` because it's maintained in reverse order. Altered ListMap docs to explain that reverse traversal is the fast way to do it. All tested sets/maps that were already fast are still fast. Test code is reproduced below, except it does ListSet with head/tail which doesn't show the improvement: ```scala object BenchTailSetMap { val th = new ichi.bench.Thyme val standard = 1 to 1024 val sets = Map[String, Set[Int]]( "Set" -> (Set.empty[Int] ++ standard), "Set4"-> Set(4, 7, 2, 1), "Set2"-> Set(3, 4), "HashSet" -> (collection.immutable.HashSet.empty[Int] ++ standard), "BitSet" -> (collection.immutable.BitSet.empty ++ standard), "SortedSet" -> (collection.immutable.SortedSet.empty[Int] ++ standard), "ListSet" -> (collection.immutable.ListSet.empty[Int] ++ standard) ) val pairs = standard.map(i => i -> i.toString) // ListMap implementation is HORRIBLE, O(n^3) tail! Cut down size. val maps = Map[String, Map[Int, String]]( "Map" -> (Map.empty[Int, String] ++ pairs), "HashMap" -> (collection.immutable.HashMap.empty[Int, String] ++ pairs), "SortedMap" -> (collection.immutable.SortedMap.empty[Int, String] ++ pairs), "ListMap" -> (collection.immutable.ListMap.empty[Int, String] ++ pairs.take(128)) ) def hts(s: Set[Int]) = { var si = s var x = 0 while (si.nonEmpty) { x += si.head si = si.tail } x } def htm(m: Map[Int, String]) = { var mi = m var x = 0 while (mi.nonEmpty) { x += mi.head._2.length mi = mi.tail } x } def run() { sets.toList.sortBy(_._1).foreach{ case (name, s) => th.pbench(hts(s), s.size, name) } maps.toList.sortBy(_._1).foreach{ case (name, m) => th.pbench(htm(m), m.size, name) } } } ```
* | | | | Scaladoc: Fix elidable threshold off-by-one comment and link elidableJanek Bogucki2016-03-091-8/+8
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | When -Xelide-below is 2000 (i.e. at least ASSERTION) the assert methods are not elided. - Fixed the above off-by-one error. - Made elidable a link
* | | | Fix typomathhun2016-03-091-2/+2
| | | |
* | | | Merge pull request #4934 from Shadow53/2.12.xSeth Tisue2016-03-011-0/+2
|\ \ \ \ | | | | | | | | | | Added Properties.isLinux to compliment the isWin and isMac methods
| * | | | Added Properties.isLinux to compliment the isWin and isMac methodsShadow532016-01-301-0/+2
| | | | |
* | | | | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2016-02-2527-39/+49
|\ \ \ \ \ | |_|/ / / |/| | / / | | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20160225 Conflicts: scripts/jobs/integrate/bootstrap src/build/maven/scala-actors-pom.xml test/files/pos/t3420.flags Conflicts were trivial to resolve.