-
Notifications
You must be signed in to change notification settings - Fork 154
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
Nested Blocks return 0 for enhanced forEach populated with lambda function #42
Comments
Hmm, this one is tricky. Maybe whenever there's a lambda expression, we do a +1 in the current nested block? Would that make sense to all lambdas in a method? |
I don't think so. How about this code? shapes.stream()
.filter(s -> s.getColor() == BLUE)
.forEach(s -> s.setColor(RED)); I think the nested level of this code is one (not 2). |
Yeah, that would be one! With the implementation I have in mind, whenever there's a lambda declaration, we do a +1, whenever it finishes it do a -1 (that's what happens with the other blocks, e.g., for, while, ...). So, in this case:
So, max = 1 |
Thank you for your response. |
Hi @mauricioaniche
I am writing tests for
NumberOfMaxNestedBlock.java
. I have come accross the following issue:I expect that the max depth of
m1()
equals one. However, thegetMaxNestedBlocks()
returns zero. Indeed, It happens when the enhanced version ofFor
along with a lambda function is employed.The text was updated successfully, but these errors were encountered: