Skip to content

Extra semicolon when returning lambda #53

@heruan

Description

@heruan

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?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions