private static boolean isNecessaryFinal(PsiVariable variable, PsiElement context) {
      return PsiUtil.isConstantExpression(variable.getInitializer()) ||
             !PsiUtil.isAvailable(JavaFeature.EFFECTIVELY_FINAL, variable) && VariableAccessUtils.variableIsUsedInInnerClass(variable, context);
    }
private static boolean isNecessaryFinal(PsiVariable variable, PsiElement context)