GrStatement (Project project, GrVariable variable, String modifiers, boolean isTuple) { StringBuilder builder = new StringBuilder(); builder.append(modifiers).append(' '); GrTypeElement typeElement = variable.getTypeElementGroovy(); if (typeElement != null) { builder.append(typeElement.getText()).append(' '); } builder.append(variable.getName()); GrExpression initializer = variable.getInitializerGroovy(); if (initializer != null) { builder.append('=').append(initializer.getText()); } GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(project); GrVariableDeclaration decl = (GrVariableDeclaration)factory.createStatementFromText(builder); if (isTuple && (variable.getDeclaredType() != null || decl.getModifierList().getModifiers().length > 1)) { decl.getModifierList().setModifierProperty(GrModifier.DEF, false); } return decl; }