private static boolean canBeInitializedOutsideBlock(@NotNull GrIntroduceContext context, @NotNull PsiClass clazz) {
    final StringPartInfo part = context.getStringPart();
    GrExpression expression = context.getExpression();

    if (expression != null) {
      expression = (GrExpression)PsiUtil.skipParentheses(expression, false);
      if (expression == null) return false;

      if (expression instanceof GrReferenceExpression) {
        final PsiElement resolved = ((GrReferenceExpression)expression).resolve();
        if (PsiUtil.isLocalVariable(resolved)) {
          expression = ((GrVariable)resolved).getInitializerGroovy();
          if (expression == null) return false;
        }
      }

      ExpressionChecker visitor = new ExpressionChecker(clazz, expression);
      expression.accept(visitor);
      return visitor.isResult();
    }

    if (part != null) {
      for (GrStringInjection injection : part.getInjections()) {
        GroovyPsiElement scope = injection.getExpression() != null ? injection.getExpression() : injection.getClosableBlock();
        assert scope != null;
        ExpressionChecker visitor = new ExpressionChecker(clazz, scope);
        scope.accept(visitor);
        if (!visitor.isResult()) {
          return false;
        }
      }
      return true;
    }

    else {
      return false;
    }
  }
private static boolean canBeInitializedOutsideBlock(@NotNull GrIntroduceContext context, @NotNull PsiClass clazz)