Repository navigation
[java] Fix for ReturnFromFinallyBlock false-positives - #1503
Merged
Merged
Conversation
Generated by 🚫 Danger |
adangel
reviewed
Dec 5, 2018
adangel
left a comment
Member
There was a problem hiding this comment.
Thanks for your pull request!
You fix looks fine 👍
Just have a look at my comments on the test cases.
Member
|
I'd personally also add 2 test cases:
ie: public class Foo {
void printSomething() {
try {
System.out.println("Integers: ");
} finally {
Arrays.asList(0, 1, 2).map(new Function<Integer, Integer>() {
@Override
public Integer apply(Integer i) {
return i + 1;
}
}).forEach(i -> System.out.println(i));
}
}
}public class Foo {
void printSomething() {
try {
System.out.println("Integers: ");
} finally {
class Incrementer implements Function<Integer, Integer> {
@Override
public Integer apply(Integer i) {
return i + 1;
}
}
Arrays.asList(0, 1, 2).map(new Incrementer()).forEach(i -> System.out.println(i));
}
}
}EDIT: This second case seems to already be addressed, I missed it on my first check |
jsotuyod
approved these changes
Dec 12, 2018
adangel
approved these changes
Dec 13, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting a PR, please check that:
master. The PMD team will merge back to support branches as needed../mvnw clean verifypasses. This will build and test PMD, execute PMD and checkstyle rules. Check this for more infoPR Description:
ReturnFromFinallyBlock was giving wrong results for Lambdas or Class return statements.
Added new Tests also.
Fixes #1035