I am trying to learn unnecessarily complicated source code. There is a method public void passObject(SomeObject someObject)
, and I want to know which class someObject
was instantiated in. The problem is, as we traverse up the call hierarchy, the branching factor is very large. For example, three methods can pass someObject
through passObject
, and three methods before these three methods can pass the same object respectively.
Is there some method that I can insert into passObject
such as:
public void passObject(SomeObject someObject) {
whereDidThisComeFrom(someObject); // Should print the class (perhaps) where someObject was instantiated.
//
//do the other stuff that passObject is supposed to do.
}
I use Eclipse
.