private boolean isAllowedInLambda(PsiReferenceExpression expression, PsiVariable variable) {
      if (myVariableAllowedPredicate.test(variable)) return true;
      if (PsiTreeUtil.isAncestor(myRoot, variable, true)) return true;
      if (variable instanceof PsiField) {
        return !variable.hasModifierProperty(PsiModifier.FINAL) || !PsiUtil.isAccessedForWriting(expression);
      }
      return !PsiUtil.isAccessedForWriting(expression) && HighlightControlFlowUtil.isEffectivelyFinal(variable, myRoot, null);
    }
private boolean isAllowedInLambda(PsiReferenceExpression expression, PsiVariable variable)