Closed NIJAVA closed 6 years ago
the same program in groovy works fine
Could you at least provide some information on failure, like a stack trace, expected result vs. observed behavior and so on...
9 Exception in thread "Thread-2" java.lang.NoSuchMethodError: class sun.net.httpserver.HttpExchangeImpl::sendResponseHeade rs at org.eclipse.golo.runtime.MethodInvocationSupport.fallback(MethodInvocationSupport.java:271) at teste.WebServer.__$$_sugar_closure_0(httpgolo.golo:14) at java.lang.invoke.MethodHandleProxies$1.invoke(MethodHandleProxies.java:187) at com.sun.proxy.$Proxy5.handle(Unknown Source) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82) at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647) at sun.net.httpserver.ServerImpl$DefaultExecutor.execute(ServerImpl.java:158) at sun.net.httpserver.ServerImpl$Dispatcher.handle(ServerImpl.java:431) at sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:396) at java.lang.Thread.run(Thread.java:748)
just change that:
exchange: sendResponseHeaders(200, response: length())
by this:
exchange: sendResponseHeaders(intValue(200), response: length())
in Golo unboxing is explicit : http://golo-lang.org/documentation/next/#_number_type_conversions
hei Artpej, your hint do not work too: same error reported.
Add longValue()
on response: length()
too .
Sorry for not be more precise but it is not easy to type with a phone :wink:
ok, thanks Artpeg, now it worked, but then golo does not integrate wel with java, groovy does not need such explicit conversions.
intValue(200) was not necessary, only longValue() needed.
golo samples has a file http-server.golo that do not have those conversions.
It's not an unboxing error, but an implicit upcast one. The method expects a long
but an int
(thus an Integer
) is given. The code in the samples
used to work, but it's indeed no more the case since the big method resolution refactoring.
The module http-server in samples don't work too, the necessity of explicit method parammeters conversions means golo does not seamless integrate with java code as groovy does.
No, it means that we have a regression...
Then it needs a re-evolution, golo is a beautiful engineered little language.