Method Calls (eclipse)

I am in the process of converting some code, however due to the nature of the beast
I need to find out where the method is called from (cycle through all locations?)

Is there an easy way in Eclipse to find out wherever a particular method is called?(in other java/classes/files)(all in my 1 project though) I am having trouble finding a search function for this

I was thinking it had to deal with Call Hierarchy or references or something but always come up short

well, if I understand correctly you want to know where a method call comes from.

When there are exception, this happens naturally -> Exception.printStackTrace();

so there are many ways to do this when there are no exceptions and you just want the StackTrace.

I guess the easiest way is to just use something like new Exception(“Something”).printStackTrace();

I meant I have something like


....//Math.class
public double add(double X, double Y){
    return (x+y)
}
...

I want to find all locations that utilize this method


//MathGame.class
double Ans = add(5.2,2.6);

Right click on the method, and look for “References”

Addictman
That was it, It was that from the beginning, but I was overlooking something stupid :confused: and it wasn’t working before

All good now, thanks!

Easier than Thread.currentThread().getStackTrace() ?

well in most cases(questionable) you want to instantly print the stack trace
Thread.currentThread().getStackTrace() returns a stacktrace array, which you still have to print

just more lines of codes, not harder or anything.

obviously you could just create a method for it, to use every time you need a stack trace…

Unforunantely I can’t run it to call any functions/methods like Thread

I am converting some software from another language so it won’t be compilable/runnable for a while :confused:

Orangy perhaps was thinking of the shorter:

Thread.dumpStack()

?

Of course, Eclipse’s finding references / opening call hierarchy are probably much slicker options.