void (@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement(); if (element instanceof PyReferenceExpression) { final PsiReference reference = element.getReference(); final PsiElement resolved = reference.resolve(); if (resolved instanceof PyTargetExpression target) { final PyClass containingClass = target.getContainingClass(); if (containingClass != null) { final String name = target.getName(); if (name == null) return; String propertyName = StringUtil.trimStart(name, "_"); final Map<String,Property> properties = containingClass.getProperties(); final PyElementGenerator generator = PyElementGenerator.getInstance(project); if (!properties.containsKey(propertyName)) { final PyFunction property = generator.createProperty(LanguageLevel.forElement(containingClass), propertyName, name, AccessDirection.READ); PyPsiRefactoringUtil.addElementToStatementList(property, containingClass.getStatementList(), false); } final PyExpression qualifier = ((PyReferenceExpression)element).getQualifier(); if (qualifier != null) { String newElementText = qualifier.getText() + "." + propertyName; final PyExpression newElement = generator.createExpressionFromText(LanguageLevel.forElement(containingClass), newElementText); element.replace(newElement); } } } } }