You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect that the max depth of m1() equals one. However, the getMaxNestedBlocks() returns zero. Indeed, It happens when the enhanced version of For along with a lambda function is employed.
The text was updated successfully, but these errors were encountered:
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?
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:
shapes.stream() <-- level 0
.filter(s -> s.getColor() == BLUE <inside the lambda level 1>) <-- level 0 again
.forEach(s -> s.setColor(RED) <inside the lambda level 1>); <-- level 0 again
Thank you for your response.
Oh, I see. I think your approach is correct. By the way, I suppose CBO has a problem yet. Consider Box<A> (the CBO should be 2 not 1).
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: