private static void decodeRefs(PsiClass sourceClass, final PsiMember member, final PsiClass targetClass) {
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(sourceClass.getProject());
    member.accept(new JavaRecursiveElementWalkingVisitor() {
      @Override
      public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement referenceElement) {
        decodeRef(sourceClass, referenceElement, factory, targetClass, referenceElement);
        super.visitReferenceElement(referenceElement);
      }

      @Override
      public void visitThisExpression(@NotNull PsiThisExpression expression) {
        decodeRef(sourceClass, expression, factory, targetClass, expression);
        super.visitThisExpression(expression);
      }

      @Override public void visitNewExpression(@NotNull PsiNewExpression expression) {
        final PsiJavaCodeReferenceElement classReference = expression.getClassReference();
        if (classReference != null) decodeRef(sourceClass, classReference, factory, targetClass, expression);
        super.visitNewExpression(expression);
      }

      @Override
      public void visitTypeElement(final @NotNull PsiTypeElement type) {
        final PsiJavaCodeReferenceElement referenceElement = type.getInnermostComponentReferenceElement();
        if (referenceElement != null)  decodeRef(sourceClass, referenceElement, factory, targetClass, type);
        super.visitTypeElement(type);
      }
    });
  }
private static void decodeRefs(PsiClass sourceClass, final PsiMember member, final PsiClass targetClass)