Method Exit Point in Java

In Eclipse, is there a way to find the return statement returned by the method without registration flags in each return status?

For instance:

@Override
 public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof ABC)) {
        return false;
    }
    ABC other = (ABC) obj;
    if (var1 == null) {
        if (other.var1 != null) {
            return false;
        }
    } else if (!var1.equals(other.var1)) {
        return false;
    }
    return true;
}

In this case, how do I know at what point my equals method was returning?

+5
source share
3 answers

No, but more understandable and debugging friendly code can be with a logical local variable representing the result.

then you can see with a debugger that assigns a value to it and a return value before returning.

+3
source

No. This is one reason why some people prefer a single exit point: Why should a function have only one exit point?

.

+2

.

+2

All Articles