private static void qualifyReferences(PsiElement element, final PsiClass target, final String qualifierText) {
      final PsiElementFactory factory = JavaPsiFacade.getElementFactory(element.getProject());
      element.accept(new JavaRecursiveElementVisitor() {
        @Override
        public void visitReferenceExpression(@NotNull PsiReferenceExpression expression) {
          super.visitReferenceExpression(expression);
          if (expression.getQualifierExpression() != null) {
            return;
          }
          final PsiElement expressionTarget = expression.resolve();
          if (!(expressionTarget instanceof PsiMember member)) {
            return;
          }
          final PsiClass containingClass = member.getContainingClass();
          if (!InheritanceUtil.isInheritorOrSelf(target, containingClass, true)) {
            return;
          }
          final PsiExpression newExpression = factory.createExpressionFromText(qualifierText + '.' + expression.getText(), expression);
          expression.replace(newExpression);
        }
      });
    }
private static void qualifyReferences(PsiElement element, final PsiClass target, final String qualifierText)