Skip to content

Commit 58ce6af

Browse files
committed
Merge pull request #9 from retronym/topic/docs
Workaround bugs in doc tools
2 parents a65b704 + 9be50b3 commit 58ce6af

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

build.sbt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,20 @@ initialize := {
6464

6565
lazy val JavaDoc = config("genjavadoc") extend Compile
6666

67+
sources in (Compile, doc) := {
68+
val orig = (sources in (Compile, doc)).value
69+
orig.filterNot(_.getName.endsWith(".java")) // raw types not cooked by scaladoc: https://issues.scala-lang.org/browse/SI-8449
70+
}
71+
6772
inConfig(JavaDoc)(Defaults.configSettings) ++ Seq(
6873
packageDoc in Compile <<= packageDoc in JavaDoc,
69-
sources in JavaDoc <<= (target, compile in Compile, sources in Compile) map ((t, c, s) =>
70-
(t / "java" ** "*.java").get ++ s.filter(_.getName.endsWith(".java"))
71-
),
74+
sources in JavaDoc <<= (target, compile in Compile, sources in Compile) map {(t, c, s) =>
75+
val allJavaSources = (t / "java" ** "*.java").get ++ s.filter(_.getName.endsWith(".java"))
76+
allJavaSources.filterNot(_.getName.contains("FuturesConvertersImpl.java")) // this file triggers bugs in genjavadoc
77+
},
7278
javacOptions in JavaDoc := Seq(),
7379
artifactName in packageDoc in JavaDoc := ((sv, mod, art) => "" + mod.name + "_" + sv.binary + "-" + mod.revision + "-javadoc.jar"),
74-
libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" % "genjavadoc-plugin_2.10.4" % "0.5"),
80+
libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.5" cross CrossVersion.full),
7581
scalacOptions in Compile <+= target map (t => "-P:genjavadoc:out=" + (t / "java"))
7682
)
7783

src/main/scala/scala/compat/java8/FutureConverters.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ object FutureConverters {
155155
*/
156156
def failedPromise[T](ex: Throwable): Promise[T] = Promise.failed(ex)
157157

158-
implicit class futureToCompletionStage[T](val f: Future[T]) extends AnyVal {
158+
implicit def FutureOps[T](f: Future[T]): FutureOps[T] = new FutureOps[T](f)
159+
final class FutureOps[T](val __self: Future[T]) extends AnyVal {
159160
/**
160161
* Returns a CompletionStage that will be completed with the same value or
161162
* exception as the given Scala Future when that completes. Since the Future is a read-only
@@ -166,25 +167,23 @@ object FutureConverters {
166167
* transformations to their asynchronous counterparts, i.e.
167168
* <code>thenRun</code> will internally call <code>thenRunAsync</code>.
168169
*
169-
* @param f The Scala Future which may eventually supply the completion for
170-
* the returned CompletionStage
171170
* @return a CompletionStage that runs all callbacks asynchronously and does
172171
* not support the CompletableFuture interface
173172
*/
174-
def toJava: CompletionStage[T] = FutureConverters.toJava(f)
173+
def toJava: CompletionStage[T] = FutureConverters.toJava(__self)
175174
}
176175

177-
implicit class completionStageToFuture[T](val cs: CompletionStage[T]) extends AnyVal {
176+
implicit def CompletionStageOps[T](cs: CompletionStage[T]): CompletionStageOps[T] = new CompletionStageOps(cs)
177+
178+
final class CompletionStageOps[T](val __self: CompletionStage[T]) extends AnyVal {
178179
/**
179180
* Returns a Scala Future that will be completed with the same value or
180181
* exception as the given CompletionStage when that completes. Transformations
181182
* of the returned Future are executed asynchronously as specified by the
182183
* ExecutionContext that is given to the combinator methods.
183184
*
184-
* @param cs The CompletionStage which may eventually supply the completion
185-
* for the returned Scala Future
186185
* @return a Scala Future that represents the CompletionStage's completion
187186
*/
188-
def toScala: Future[T] = FutureConverters.toScala(cs)
187+
def toScala: Future[T] = FutureConverters.toScala(__self)
189188
}
190189
}

src/main/scala/scala/concurrent/java8/FutureConvertersImpl.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import java.util.concurrent.{ CompletionStage, Executor, ExecutorService, Comple
77
import scala.util.{ Try, Success, Failure }
88
import java.util.function.{ BiConsumer, Function JF, Consumer, BiFunction }
99

10-
private[scala] object FuturesConvertersImpl {
10+
// TODO: make thie private[scala] when genjavadoc allows for that.
11+
object FuturesConvertersImpl {
1112
def InternalCallbackExecutor = Future.InternalCallbackExecutor
1213

1314
class CF[T] extends CompletableFuture[T] with (Try[T] => Unit) {

0 commit comments

Comments
 (0)