Circular references in java are not a problem for GC. This is not a problem because of a concept called “reachability”.
You can consider links to objects as a directed graph, where nodes are objects and edges are links to objects. The graph has a set of nodes called "root nodes" - these are (approximately) objects that are directly accessible to some stream in vm. Things like local variables when calling any function on the stack, static fields in classes, etc.
When performing garbage collection, the virtual machine starts up with these root nodes and marks them as “used”. Then, for each edge leading from these used nodes (i.e., for each object referenced from the used objects), it is also marked as used, and so on, until there is nothing left. And then, any objects that were not marked as “used”, he knows that he can safely collect garbage.
Now, say, for example, you are using some kind of method, and you have the following code:
a = new A(); ab = b; b = new B(); ba = a
You now have a circular link between a and b. And both of these objects are part of the set of roots, because they are a local variable in a method call that is on the stack.
Then, when you exit this method, both a and b will no longer be part of the root set. And until you link to them somewhere else, there is nothing that could contain a link to a or b.
So, now your graph of links to objects will have a small disabled part of the graph containing a and b. Both of them still have references to each other, but nothing else refers to them. Since they are not accessible from the root set, GC knows that they are not used and can garbage collect them even if they have links to each other.
(note that this is a slightly simplified description of garbage collection, but it is still a useful / reasonable mental model of how this works)
So, the short answer is: “Yes, you have a circular link, but that’s not a problem, because both objects will be assembled when both already do not reach”