void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { if (!(element instanceof GrNewExpression newExpression)) return; GrCodeReferenceElement refElement = newExpression.getReferenceElement(); if (refElement == null) return; PsiElement resolved = refElement.resolve(); if (!(resolved instanceof GrTypeDefinition singleton)) return; PsiAnnotation annotation = AnnotationUtil.findAnnotation(singleton, GROOVY_LANG_SINGLETON); if (annotation == null) return; String qualifiedName = singleton.getQualifiedName(); if (qualifiedName == null) return; String propertyName = getPropertyName(annotation); GrExpression instanceRef = GroovyPsiElementFactory.getInstance(project).createExpressionFromText(qualifiedName + "." + propertyName); final GrExpression replaced = newExpression.replaceWithExpression(instanceRef, true); JavaCodeStyleManager.getInstance(project).shortenClassReferences(replaced); }