GrVariableDeclaration (@NotNull String text) { final GroovyFile file = createGroovyFileChecked("class X{\n" + text + "\n}"); final PsiClass psiClass = file.getClasses()[0]; return (GrVariableDeclaration)psiClass.getFields()[0].getParent(); }