I understand from other questions here at SO how leaking `this` can be unsafe if another object ever gets the chance of utilizing the object which is still in construction (the one we leaked), both in single-threaded and multithreaded environments.

My question is, what if I was leaking the object **to itself**?

```
public Category(int id, String name) {
    this.id = id;
    this.name = name;
    this.idPadre = this;
}

```

Notice that in the last line of the constructor I am leaking the object. This would normally still be unsafe since constructor could be inherited and used with a `super()` call with more code following the execution of the constructor of the parent class (this one I've wrote), thus making the leaking line not the last line of the construction process.

However, if the inheriting class is still in its constructor, then even if it is leaking the object being constructed and more lines of code follow the leaking line, would it still be unsafe, considering that the only context that can access the leaked object is that object's constructor (which still hasn't finished executing)?

Question also stands for multithreaded environments. I am quite certain that it would be thread-safe, since the object is being leaked to itself (one of its fields) and the fields can't be accessed before the constructor finishes. As per the constructor being able to access the leaked object, the constructor only runs in one thread, so it should be thread-safe (if it's also safe in the aspect the first part of this questions refers to).

I want to ask this question in a general manner. But here is the context in which I found this occurrence. The class is an entity class which I'm persisting to a relational database using ORMLite. The database table has a column whose value points to the parent of that entry's Category. If the Category has no parent, it itself is it's parent (column idPadre's value is the same as column id's value). When writing the entity class with ORMLite's annotations this means the object has a reference to itself. The usage of ORMLite and my desire to keep all entity classes as simple as possible are the reasons why I'm not first inclined to solve this with a factory method.