-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java 8 method reference inference bug #9307
Comments
The issue here is that GWT is not resolving correctly method references. StringBuilder::toString is a reference to AbstractStringBuilder::toString (so using AbstractStringBuilder::toString or Object::toString should work) I'll send up a fix for review shortly. |
Thanks for the quick fix! Can you comment on what will generate the "nicest" (speed/size) output from the compiler, or are all lambdas/references/anon classes created equally in the eyes of gwt? |
I think that lambdas or, references are mostly equal to anon classes wrt And in the future we might even make some of the cases (@JsFunction comes to On Tue, Mar 29, 2016 at 10:45 AM, Colin Alworth notifications@github.com
|
…ences. GwtAstBuilder must resolve the method reference to point to the right declaring class, e.g. class A { public void m() {} } class B extends A { } B:m() needs to be resolved to A::m() at AST building time in order for UnifyAST to stitch compilation units together. Change-Id: I2833e13473bc35945055040d2f318244d012a98d Bug-Link: gwtproject#9307
Found while implementing some aspects of Streams/Collectors, stripped down as simply as I could. It looks like the compiler is getting confused as to what type should be returned from the functional interface (
String[]
instead ofString
), and the actual returned type from the method reference doesn't match that, so it crashes.Built off of https://gwt.googlesource.com/gwt/+/e2a95dc/, but have reproduced this in some way or another for a while.
Expected results, shows a boring alert with an empty string message. Actual result, compiler error:
Workaround: Replace the method reference with a lambda:
The text was updated successfully, but these errors were encountered: