Skip to content
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

Extra semicolon when returning lambda #53

Closed
heruan opened this issue May 16, 2017 · 10 comments
Closed

Extra semicolon when returning lambda #53

heruan opened this issue May 16, 2017 · 10 comments
Assignees
Labels
Milestone

Comments

@heruan
Copy link
Contributor

heruan commented May 16, 2017

I don't know if this is a bug or I'm doing something wrong, but I can't find examples for lambdas so this is it:

JMethod method = definedClass.method(...);
JLambdaMethodRef methodLambda = new JLambdaMethodRef(...);
JLambda lambda = new JLambda();
lambda.body().lambdaExpr(
    JExpr._this().invoke("getValueProvider").invoke("andThen").arg(methodLambda)
);
method.body()._return(lambda);

This produces:

public default StringFilter<T> description() {
    return () -> this.getValueProvider().andThen(Category::getDescription);
    ; // <- Unreachable code error!
}

with the extra ; resulting in an "Unreachable code" error in Eclipse. How can I avoid the extra semicolon?

@phax phax self-assigned this May 16, 2017
@phax phax added the bug label May 16, 2017
@phax
Copy link
Owner

phax commented May 16, 2017

You are using version 2.8.6 or 3.0.0 SNAPSHOT?

@heruan
Copy link
Contributor Author

heruan commented May 16, 2017

Thank you for the (impressive) responsiveness! I'm on 2.8.6 from Maven Central, but if you have a snapshot repository I'll try 3.0.0 right away.

@phax
Copy link
Owner

phax commented May 16, 2017

NP. 3.0.0 requires Java 8 - is this a problem?

@heruan
Copy link
Contributor Author

heruan commented May 16, 2017

Absolutely not, the project's 1.8 -> 1.8. Does 3.0.0 already address this?

@phax
Copy link
Owner

phax commented May 16, 2017

I'm not sure :) Just want to know whether I potentially need a backport or whether I can check in the latest only :) - give me a few minutes....

@heruan
Copy link
Contributor Author

heruan commented May 16, 2017

I managed to test it with current 3.0.0 and the output is the same: extra semicolon.

@phax
Copy link
Owner

phax commented May 16, 2017

I saw it. There are multiple issues to address... Stay tuned

@phax
Copy link
Owner

phax commented May 16, 2017

Sorry - no solution today :( I don't have too much time right now, but will address it asap

phax added a commit that referenced this issue May 16, 2017
@phax
Copy link
Owner

phax commented May 16, 2017

Well I proved myself wrong - now working. Please cross check - Travis build should be available soon

@heruan
Copy link
Contributor Author

heruan commented May 17, 2017

Awesome, it works! Hope to see the fix on a Maven release soon. Thank you very much!

@heruan heruan closed this as completed May 17, 2017
@phax phax added this to the 3.0.0 milestone May 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants