GrVariableDeclaration (@NotNull PsiClass targetClass) { final String name = mySettings.getName(); final PsiType type = mySettings.getSelectedType(); final String modifier = mySettings.getVisibilityModifier(); List<String> modifiers = new ArrayList<>(); if (targetClass instanceof GroovyScriptClass) { modifiers.add("@" + GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD); } if (mySettings.isStatic()) modifiers.add(PsiModifier.STATIC); if (!PsiModifier.PACKAGE_LOCAL.equals(modifier)) modifiers.add(modifier); if (mySettings.declareFinal()) modifiers.add(PsiModifier.FINAL); final String[] arr_modifiers = ArrayUtilRt.toStringArray(modifiers); final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(myContext.getProject()); if (targetClass instanceof GroovyScriptClass) { return factory.createVariableDeclaration(arr_modifiers, ((GrExpression)null), type, name); } else { return factory.createFieldDeclaration(arr_modifiers, name, null, type); } }