Skip to content

Commit 05be2b2

Browse files
authored
Merge pull request #157 from lrytz/scala-java8-compat-13
Integrate 2.13.x branch into master
2 parents 73b3d16 + a30b2fd commit 05be2b2

File tree

60 files changed

+2329
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2329
-29
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: scala
22

33
scala:
4-
# note that 2.13 is on the 2.13.x branch instead
5-
- 2.11.12
4+
- 2.13.0
65
- 2.12.8
6+
- 2.11.12
77

88
env:
99
global:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ as the collection can (in some cases) be built in parallel.
161161

162162
Because the wrappers are invoked based on the static type of the collection, there are also cases where parallelization
163163
is inefficient when interfacing with Java 8 Streams (e.g. when a collection is typed as `Seq[String]` so might have linear
164-
access like `List`, but actually is a `WrappedArray[String]` that can be efficiently parallelized) but can be efficient
164+
access like `List`, but actually is a `WrappedArray[String]` (`ArraySeq` on 2.13) that can be efficiently parallelized) but can be efficient
165165
with Scala parallel collections. The `parStream` method is only available when the static type is known to be compatible
166166
with rapid parallel operation; `seqStream` can be parallelized by using `.parallel`, but may or may not be efficient.
167167

build.sbt

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import ScalaModulePlugin._
22

3-
// no 2.13 for now in cross-build because of
4-
// https://github.com/scala/scala-java8-compat/issues/97
5-
crossScalaVersions in ThisBuild := List("2.12.8", "2.11.12")
3+
crossScalaVersions in ThisBuild := List("2.13.0", "2.12.8", "2.11.12")
64

75
val disableDocs =
86
sys.props("nodocs") == "true" ||
@@ -28,7 +26,27 @@ lazy val commonSettings = Seq(
2826
organization := "org.scala-lang.modules",
2927
version := "0.9.1-SNAPSHOT",
3028

31-
scalacOptions ++= Seq("-feature", "-deprecation", "-unchecked")
29+
scalacOptions ++= Seq("-feature", "-deprecation", "-unchecked"),
30+
31+
unmanagedSourceDirectories in Compile ++= {
32+
(unmanagedSourceDirectories in Compile).value.flatMap { dir =>
33+
CrossVersion.partialVersion(scalaVersion.value) match {
34+
case Some((2, 13)) => Seq(file(dir.getPath ++ "-2.13+"))
35+
case Some((2, 11)) => Seq(file(dir.getPath ++ "-2.13-"), file(dir.getPath ++ "-2.11"))
36+
case _ => Seq(file(dir.getPath ++ "-2.13-"))
37+
}
38+
}
39+
},
40+
41+
unmanagedSourceDirectories in Test ++= {
42+
(unmanagedSourceDirectories in Test).value.flatMap { dir =>
43+
CrossVersion.partialVersion(scalaVersion.value) match {
44+
case Some((2, 13)) => Seq(file(dir.getPath ++ "-2.13+"))
45+
case Some((2, 11)) => Seq(file(dir.getPath ++ "-2.13-"), file(dir.getPath ++ "-2.11"))
46+
case _ => Seq(file(dir.getPath ++ "-2.13-"))
47+
}
48+
}
49+
},
3250
)
3351

3452
lazy val fnGen = (project in file("fnGen")).

fnGen/WrapFnGen.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ object WrapFnGen {
245245
numberedA ++= scalaTargs.map(_.toString).collect{ case An(digits) if (digits.length < 10) => digits.toInt }
246246
val scalafnTnames = (jfn.pTypes :+ jfn.rType).zipWithIndex.map{
247247
case (pt, i) if (i < jfn.pTypes.length && pt.isFinalType) || (!pt.isFinalType && jfn.pTypes.take(i).exists(_ == pt)) =>
248-
val j = Iterator.from(i).dropWhile(numberedA).next
248+
val j = Iterator.from(i).dropWhile(numberedA).next()
249249
val genericName = TypeName(s"A$j")
250250
numberedA += j
251251
evidences += ((genericName, pt.typeSymbol.name.toTypeName))
@@ -309,6 +309,6 @@ object WrapFnGen {
309309

310310
def main(args: Array[String]): Unit = {
311311
val names = args.iterator.map(x => new java.io.File(x))
312-
write(names.next, converterContents)
312+
write(names.next(), converterContents)
313313
}
314314
}

project/CodeGen.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,9 @@ object CodeGen {
519519

520520
val specialized =
521521
List("V", "V,IJFD", "V,IJD,IJD").flatMap(specialize).map { case (i, a, sp) =>
522-
s" public static scala.Function$i<$a> procSpecialized(JFunction$i$sp f) { return f; }" } ++
522+
s" public static scala.Function$i<$a> procSpecialized(JFunction$i$sp f) { return (scala.Function$i<$a>)(Object)f; }" } ++
523523
List("BSIJCFDZ", "ZIFJD,IJFD", "ZIFJD,IJD,IJD").flatMap(specialize).map { case (i, a, sp) =>
524-
s" public static scala.Function$i<$a> funcSpecialized(JFunction$i$sp f) { return f; }" }
524+
s" public static scala.Function$i<$a> funcSpecialized(JFunction$i$sp f) { return (scala.Function$i<$a>)(Object)f; }" }
525525

526526
(blocks.map(_._1) ++ blocks.map(_._2)) :+
527527
( "JFunction",

0 commit comments

Comments
 (0)