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

Remove unnecessary block in lambda expressions after refactoring #166

Open
ketkarameya opened this issue Feb 3, 2022 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@ketkarameya
Copy link
Collaborator

Piranha transforms:

someConsumer.accept((x) -> { 
                                        if(exp.isTreated(STALE_FLAG)){
                                           doSomething(x);
                                        }
                                        else{
                                           domeSomethingElse(x);
                                        }
                                       );

to

someConsumer.accept((x) -> { 
                                           doSomething(x);
                                        }
                                       );

Rather it should:

someConsumer.accept((x) -> doSomething(x););
@ketkarameya ketkarameya changed the title Remove unnecessary block Remove unnecessary block in lambda expressions after refactoring Feb 3, 2022
@ketkarameya ketkarameya added good first issue Good for newcomers legacy-java Issues/PR related to older PiranhaJava implementation labels Feb 3, 2022
@lazaroclapp
Copy link
Contributor

Note: I think the above should be

someConsumer.accept((x) -> doSomething(x));

without the extra semicolon. Also, you don't need the parenthesis around the lambda argument for the single argument case.

@ketkarameya
Copy link
Collaborator Author

Correct. Let me fix this and then i ll update you.

@ketkarameya ketkarameya added this to the java-multipass-analysis milestone Mar 4, 2022
@ketkarameya ketkarameya added piranha polyglot and removed good first issue Good for newcomers legacy-java Issues/PR related to older PiranhaJava implementation labels Aug 7, 2022
@ketkarameya ketkarameya reopened this Aug 7, 2022
@ketkarameya ketkarameya removed this from the java-multipass-analysis milestone Dec 5, 2022
@ketkarameya ketkarameya added legacy-java Issues/PR related to older PiranhaJava implementation enhancement New feature or request and removed polyglot-piranha legacy-java Issues/PR related to older PiranhaJava implementation labels Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants