GrEnumConstant (@NotNull String text) { GroovyFile file = createGroovyFileChecked("enum E{" + text + "}"); final GrEnumTypeDefinition enumClass = (GrEnumTypeDefinition)file.getClasses()[0]; return enumClass.getEnumConstants()[0]; }