void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); UCallExpression awtGrayColorConstructor = UastContextKt.toUElement(element, UCallExpression.class); if (awtGrayColorConstructor == null) return; UastCodeGenerationPlugin generationPlugin = UastCodeGenerationPlugin.byLanguage(element.getLanguage()); if (generationPlugin == null) return; UastElementFactory pluginElementFactory = generationPlugin.getElementFactory(project); String grayConstant = Gray.class.getName() + "._" + myGrayValue; UQualifiedReferenceExpression grayConstantReference = pluginElementFactory.createQualifiedReference(grayConstant, element); if (grayConstantReference == null) return; generationPlugin.replace(awtGrayColorConstructor, grayConstantReference, UQualifiedReferenceExpression.class); }