Skip to content

Add Scala 2.12.0-M2 as a cross build #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ env:
script:
- admin/build.sh
scala:
- 2.11.6
- 2.11.7
- 2.12.0-M2
jdk:
- oraclejdk8
notifications:
Expand Down
7 changes: 4 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def jwrite(dir: java.io.File)(name: String, content: String) = {
}

lazy val commonSettings = Seq(
scalaVersion := "2.11.6",
scalaVersion := "2.11.7",
crossScalaVersions := List("2.11.7", "2.12.0-M2"),
organization := "org.scala-lang.modules",
version := "0.6.0-SNAPSHOT",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
Expand Down Expand Up @@ -100,8 +101,8 @@ lazy val root = (project in file(".")).
},
javacOptions in JavaDoc := Seq(),
artifactName in packageDoc in JavaDoc := ((sv, mod, art) => "" + mod.name + "_" + sv.binary + "-" + mod.revision + "-javadoc.jar"),
libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" % "genjavadoc-plugin" % "0.8" cross CrossVersion.full),
scalacOptions in Compile <+= target map (t => "-P:genjavadoc:out=" + (t / "java"))
libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" % "genjavadoc-plugin" % "0.9" cross CrossVersion.full),
scalacOptions in Compile += "-P:genjavadoc:out=" + (target.value / "java")
))): _*
).
settings(
Expand Down
10 changes: 8 additions & 2 deletions src/main/scala/scala/compat/java8/FutureConverters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ object FutureConverters {
* @return a Scala Future that represents the CompletionStage's completion
*/
def toScala[T](cs: CompletionStage[T]): Future[T] = {
val p = new P[T]
cs whenComplete p
val p = Promise[T]()
val bc = new BiConsumer[T, Throwable] {
override def accept(v: T, e: Throwable): Unit = {
if (e == null) p.complete(Success(v))
else p.complete(Failure(e))
}
}
cs whenComplete bc
p.future
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,4 @@ object FuturesConvertersImpl {

override def toString: String = super[CompletableFuture].toString
}

class P[T] extends impl.Promise.DefaultPromise[T] with BiConsumer[T, Throwable] {
override def accept(v: T, e: Throwable): Unit = {
if (e == null) complete(Success(v))
else complete(Failure(e))
}
}
}
Loading