Context In this simple code snippet:
public class NewMain1 {
private final ArrayList<Person> myPeople;
public NewMain1() {
myPeople = new ArrayList<>();
Person p = new Person("it");
Person p1 = new Person(this, "it");
p.setNewMain1(this);
myPeople.add(p);
}
In Netbeans, the line with the constructor for Person(this, "it") does not get the leaking this warning, but the p.setNewMain1(this) does get the leaking this warning. Is this just an artifact of NetBeans or is it not also a possible leaking this? Passing 'this' in a constructor should have the same dangers as calling a method, right?