Skip to content

Commit 986246b

Browse files
Fix various scala3 compile issues
1 parent 908abc1 commit 986246b

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

core/src/main/scala/as/core.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.asynchttpclient.handler.resumable._
77
import java.io._
88
import java.nio.charset.Charset
99
import java.io.Closeable
10+
import io.netty.handler.codec.http.HttpHeaders
1011

1112
object Response {
1213
def apply[T](f: asynchttpclient.Response => T) = f
@@ -30,17 +31,20 @@ object Bytes extends (asynchttpclient.Response => Array[Byte]) {
3031
def apply(r: asynchttpclient.Response) = r.getResponseBodyAsBytes
3132
}
3233

33-
object File extends {
34+
abstract class FileApply {
3435
def apply(file: java.io.File) = {
3536
val fileHandler = new RandomAccessFile(file, "rw")
3637

3738
val resumableHandler = new ResumableAsyncHandler
3839
with OkHandler[asynchttpclient.Response]
3940
with CloseResourcesOnThrowableHandler[asynchttpclient.Response] {
4041
override lazy val closeable: Seq[Closeable] = Seq(fileHandler)
42+
override def onTrailingHeadersReceived(headers: HttpHeaders): asynchttpclient.AsyncHandler.State = super[ResumableAsyncHandler].onTrailingHeadersReceived(headers)
4143
}
4244

4345
resumableHandler
4446
.setResumableListener(new ResumableRandomAccessFileListener(fileHandler))
4547
}
4648
}
49+
50+
object File extends FileApply

core/src/main/scala/handlers.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import org.asynchttpclient.{
55
Response, AsyncCompletionHandler, AsyncHandler,
66
HttpResponseStatus
77
}
8+
import io.netty.handler.codec.http.HttpHeaders
89

910
/**
1011
* Builds tuples of (Request, AsyncHandler) for passing to Http#apply.
@@ -28,7 +29,9 @@ class FunctionHandler[T](f: Response => T) extends AsyncCompletionHandler[T] {
2829
}
2930

3031
class OkFunctionHandler[T](f: Response => T)
31-
extends FunctionHandler[T](f) with OkHandler[T]
32+
extends FunctionHandler[T](f) with OkHandler[T] {
33+
override def onTrailingHeadersReceived(headers: HttpHeaders): AsyncHandler.State = super[FunctionHandler].onTrailingHeadersReceived(headers)
34+
}
3235

3336
trait OkHandler[T] extends AsyncHandler[T] {
3437
abstract override def onStatusReceived(status: HttpResponseStatus) = {

json4sjackson/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ description :=
44
"Dispatch module providing json4s support"
55

66
libraryDependencies ++= Seq(
7-
"org.json4s" %% "json4s-jackson" % "3.6.7",
7+
"org.json4s" %% "json4s-jackson" % "4.1.0-M6",
88
"ws.unfiltered" %% "unfiltered-netty-server" % "0.13.0-M2" % "test"
99
)

json4sjackson/src/main/scala/as/json.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import org.asynchttpclient.Response
66

77
object Json extends (Response => JValue) {
88
def apply(r: Response) =
9-
(dispatch.as.String andThen (s => parse(StringInput(s), true)))(r)
9+
(dispatch.as.String andThen (s => parse(s, true)))(r)
1010
}

json4snative/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name := "dispatch-json4s-native"
33
description :=
44
"Dispatch module providing json4s native support"
55

6-
val json4sVersion = "3.6.7"
6+
val json4sVersion = "4.1.0-M6"
77

88
libraryDependencies ++= Seq(
99
"org.json4s" %% "json4s-core" % json4sVersion,

json4snative/src/main/scala/as/json.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import org.asynchttpclient.Response
66

77
object Json extends (Response => JValue) {
88
def apply(r: Response) =
9-
(dispatch.as.String andThen (s => parse(StringInput(s), true)))(r)
9+
(dispatch.as.String andThen (s => parse(s, true)))(r)
1010
}

0 commit comments

Comments
 (0)