Integer (@NotNull PsiReferenceExpression expression, @NotNull BoxingInfo boxingInfo) { Integer impact = afterBoxingRemovalReferenceImpact(expression, boxingInfo); if (impact == null) return null; final LocalSearchScope scope = tryCast(boxingInfo.myVariable.getUseScope(), LocalSearchScope.class); if (scope == null) return impact; final PsiElement[] scopeElements = scope.getScope(); PsiLoopStatement loop = PsiTreeUtil.getParentOfType(expression, PsiLoopStatement.class, false, PsiClass.class, PsiLambdaExpression.class, PsiMethod.class); if (loop != null && ContainerUtil.or(scopeElements, scopeElement -> PsiTreeUtil.isAncestor(scopeElement, loop, false)) && !PsiTreeUtil.isAncestor(loop, boxingInfo.myVariable, true)) { impact *= IN_LOOP_OPERATION_MULTIPLIER; } return impact; }