Leaking this from a Design Standpoint <blockquote> <p>Warning: Leaking "this" in constructor</p> </blockquote> <p>I keep running into this, and I have a nagging feeling that it's because my design is wrong or not optimal.</p> <p>I understand that this warning is bringing to my attention the fact that I am allowing access to an object that is potentially not fully initialized.</p> <p>Let's say that I need a Frame that HAS and requires a List (Frame(List list)). In List, I might want to do something such as add(). In order to make sure Frame knows as little about List as possible (only that it has one), I would want to access the containing Frame from the List (List HAS a Frame?). This seems a little silly, but I have 2+ implementations of List that will use Frame in different ways..</p> <p>To ensure that my code is used properly, I would require a Frame in the constructor of List. I would also require a List in the constructor of Frame, as it MUST have one:</p> <pre><code>public abstract class Frame { private final List list; public Frame(List list) { this.list = list; list.setFrame(this); } } public abstract class List { private Frame frame; protected final void setFrame(Frame frame) { this.frame = frame; } } </code></pre> <p>So, is this bad design, or should I really create some intermediate scaffolding that does this, or even leave the scaffolding to the user?</p> <p>Thanks!</p>