@Override public void visitCodeBlock(@NotNull PsiCodeBlock block) {
        if (block.getParent() instanceof PsiLambdaExpression && block != body) {
          final List<ProblemDescriptor> descriptors = checkCodeBlock(block, manager, onTheFly);
          if (descriptors != null) {
            problems.addAll(descriptors);
          }
          return;
        }
        super.visitCodeBlock(block);
        Set<PsiVariable> declared = getDeclaredVariables(block);
        if (declared.isEmpty()) return;
        PsiElement anchor = block;
        if (block.getParent() instanceof PsiSwitchBlock) {
          anchor = block.getParent();

          //special case: switch legs
          Set<PsiReferenceExpression> writeRefs = 
            SyntaxTraverser.psiTraverser().withRoot(block)
              .filter(PsiReferenceExpression.class)
              .filter(ref -> PsiUtil.isOnAssignmentLeftHand(ref)).toSet();

          for (PsiReferenceExpression ref : writeRefs) {
            PsiElement resolve = ref.resolve();
            if (resolve instanceof PsiVariable && declared.contains(resolve) && ((PsiVariable)resolve).hasInitializer()) {
              declared.remove(resolve);
            }
          }
        }

        int from = flow.getStartOffset(anchor);
        int end = flow.getEndOffset(anchor);
        List<PsiVariable> ssa = ControlFlowUtil.getSSAVariables(flow, from, end, true);
       
        for (PsiVariable psiVariable : ssa) {
          if (declared.contains(psiVariable) && (!psiVariable.hasInitializer() || !VariableAccessUtils.variableIsAssigned(psiVariable, block))) {
            result.add(psiVariable);
          }
        }
      }
@Override public void visitCodeBlock(@NotNull PsiCodeBlock block)