vert-x3 / vertx-lang-scala

Vert.x for Scala
http://vert-x3.github.io/vertx-lang-scala/
122 stars 41 forks source link

Newly g8 generated project doesn't compile: getNowFuture does not exist #90

Closed aesteve closed 1 year ago

aesteve commented 4 years ago

Questions

Fresh g8 installation => compilation fails

[info] Compiling 3 Scala sources to /tmp/sample-g8-vertx-project/target/scala-2.13/test-classes ...
[error] /tmp/sample-g8-vertx-project/src/test/scala/com/github/aesteve/BusVerticleSpec.scala:10:72: type mismatch;
[error]  found   : String("msg")
[error]  required: Option[AnyRef]
[error]     val future = vertx.eventBus().requestFuture[String]("testAddress", "msg")
[error]                                                                        ^
[error] /tmp/sample-g8-vertx-project/src/test/scala/com/github/aesteve/HttpVerticleSpec.scala:16:8: value getNowFuture is not a member of io.vertx.core.http.HttpClient
[error] possible cause: maybe a semicolon is missing before `value getNowFuture`?
[error]       .getNowFuture(8666, "127.0.0.1", "/hello")
[error]        ^
[error] two errors found
[error] (Test / compileIncremental) Compilation failed
[error] Total time: 45 s, completed 25 juin 2020 à 09:02:40

Version

Latest g8 template version, just running sbt test.

Context

cd /tmp
sbt new vert-x3/vertx4-scala.g8
cd sample-g8-vertx-project
sbt test

Do you have a reproducer?

Here's the generated project for reference: https://github.com/aesteve/vertx-scala-g8-reproducer (if I try to makes fixes, I'll do this on other branches, to let the main branch reflect the project as it's been generated)

Steps to reproduce

See above.

Extra

aesteve commented 4 years ago

To fix the compilation issues: https://github.com/aesteve/vertx-scala-g8-reproducer/compare/feat/try-fix-compile

(I'll try to submit a PR here)

aesteve commented 4 years ago

+HttpVerticleSpec is broken (because of changes to the HttpClient futurised API), giving it a look.


EDIT: can't find any way to make it work properly with HttpClient.getFuture, maybe I'm missing something obvious. My expectation would be for this:

httpClient
  .getFuture(...)
  .flatMap(_.bodyFuture())

to work.

Unfortunately, it fails with an "IllegalStateException: body has already been written". I think it already happened to me in Java with Vert.x 4.0.0-milestone4, so I'm guessing the new futurised APIs of this lib are broken, or at least not fully usable at the moment. I've switched the test to using the web client, and it works perfectly.

aesteve commented 4 years ago

Other topics:

aesteve commented 4 years ago
aesteve commented 4 years ago

I can submit a first pull request for the g8 template with the changes listed here. The only annoying thing is the replacement of HttpClient by WebClient, let me know what you think about it @codepitbull . If you agree, I'll do this.

aesteve commented 4 years ago

Dotty version here (with a list of changes needed, work in progress)

aesteve commented 4 years ago

Replacing custom Docker plugin by JIB's plugin: here