code: public <T> void updateRefs(T oldObject, T newObject) {
      checkNotNull(oldObject);
      checkNotNull(newObject);
      checkArgument(!(newObject instanceof Listener));
      Object previousMapping = mappings.put(oldObject, newObject);
      if (previousMapping != null) {
        if (previousMapping instanceof Listener) {
          @SuppressWarnings("unchecked") // Listener<T> can only be registered with a T
          Listener<T> listener = (Listener<T>) previousMapping;
          listener.newVersion(newObject);
        } else {
          throw new IllegalStateException("found multiple remappings for " + oldObject);
        }
      }
    }
docs: Registers that the old object has been remapped to the new object.
  
  <p>This is useful for auxiliary AST datastructures which may contain back-edges in the AST.
  When being copied, the auxiliary data structure is registered with this method then AST nodes
  which have references to the old copy can register via {@link #registerRefListener} so that
  they can get a reference to the new copy as well.