Skip to content

Commit becac62

Browse files
committed
Issue checkstyle#13167: Remove lambda optimization
1 parent 37e55bb commit becac62

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,17 +413,11 @@ private static boolean isNonLocalTypeDeclaration(DetailAST typeDeclAst) {
413413
private static DetailAST getBlockContainingLocalAnonInnerClass(DetailAST literalNewAst) {
414414
DetailAST currentAst = literalNewAst;
415415
DetailAST result = null;
416-
DetailAST topMostLambdaAst = null;
417416
while (currentAst != null && !TokenUtil.isOfType(currentAst, CONTAINERS_FOR_ANON_INNERS)) {
418-
if (currentAst.getType() == TokenTypes.LAMBDA) {
419-
topMostLambdaAst = currentAst;
420-
}
421417
currentAst = currentAst.getParent();
422-
result = currentAst;
423-
}
424-
425-
if (currentAst == null) {
426-
result = topMostLambdaAst;
418+
if (currentAst != null) {
419+
result = currentAst;
420+
}
427421
}
428422
return result;
429423
}

0 commit comments

Comments
 (0)