void (TemplateBuilderImpl builder) { GrVariable variable = getVariable(); assert variable != null && variable.getInitializerGroovy() != null; final PsiType initializerType = variable.getInitializerGroovy().getType(); TypeConstraint[] constraints = initializerType != null && !initializerType.equals(PsiTypes.nullType()) ? new SupertypeConstraint[]{SupertypeConstraint.create(initializerType)} : TypeConstraint.EMPTY_ARRAY; ChooseTypeExpression typeExpression = new ChooseTypeExpression(constraints, variable.getManager(), variable.getResolveScope(), true, GroovyApplicationSettings.getInstance().INTRODUCE_LOCAL_SELECT_DEF); PsiElement element = getTypeELementOrDef(variable); if (element == null) return; builder.replaceElement(element, "Variable_type", typeExpression, true, true); }