I've written a very simple verticle using vert.x 3.2.2 and celyon 1.2.2 and I get the following error at runtime:
com.redhat.ceylon.model.loader.ModelResolutionException: Failed to load declaration [ReflectionClass: class io.vertx.ceylon.web.RoutingContext]: Failed to load methods in io.vertx.ceylon.web.RoutingContextIn order to reproduce this issue, you can use the following code:
import io.vertx.ceylon.core { Verticle, vertxFactory = vertx }
import io.vertx.ceylon.web { routerFactory = router, RoutingContext }
import io.vertx.ceylon.web.handler { loggerHandler }
import ceylon.language.meta.declaration { Module }
shared class HttpServerVerticle() extends Verticle() {
void requestHandler(RoutingContext routingContext) {
value response = routingContext.response();
response.putHeader("content-type", "text/plain");
response.end("Hello World");
}
shared actual void start() {
value router = routerFactory.router(vertx);
router.get().handler(loggerHandler.create().handle);
router.get("/").handler(requestHandler);
value server = vertx.createHttpServer();
server.requestHandler(router.accept).listen(8080);
}
}
void runModuleVerticle(Module mod) {
value container = vertxFactory.vertx();
container.deployVerticle("ceylon:``mod.name``/``mod.version``", (String|Throwable ar) {
if (is String ar) {
print("Deployed ``mod.name``");
} else {
print("``mod.name`` deploy failure:");
ar.printStackTrace();
}
});
}
shared void run() {
runModuleVerticle(`module`);
}In order to fix this issue, I must inline the request handler definition:
...
router.get("/").handler {
void requestHandler(RoutingContext routingContext) {
value response = routingContext.response();
response.putHeader("content-type", "text/plain");
response.end("Hello World");
}
};
...
The issue 4558 looks very similar to this problem, but this issue has been closed. What am I doing wrong?
I really appreciate any help you can provide.
Lucien