GrVariableDeclaration (@NotNull GrIntroduceContext context, @NotNull GroovyIntroduceVariableSettings settings) { final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(context.getProject()); final String[] modifiers = settings.isDeclareFinal() ? new String[]{PsiModifier.FINAL} : null; final GrVariableDeclaration declaration = factory.createVariableDeclaration(modifiers, "foo", settings.getSelectedType(), settings.getName()); generateInitializer(context, declaration.getVariables()[0]); return declaration; }