Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0 Beta 5
-
None
Description
When calling an association property from the object itself, null is associated with the object and this leads to NPE or unwanted results.
For example, if I have a class :
public class Person {
private Long id;
private String firstName;
private String lastName;
private Person parent;
public Person getAncestor() {
if (getParent() == null)
else
{ return getParent().getAncestor(); } }
//Other getters and setters.
}
And a method calls person.getAncestor(), this.getParent() inside getAncestor() method will return null.
But if the method calls person.getParent() and then person.getAncestor(), this.getParent() inside getAncestor() method will return the expected parent.