SE450: Some advice: How is this method getting called [14/16] Previous pageContentsNext page

You can tell where how a method is being called by setting a
breakpoint in the debugger.

Or you can do:

new Throwable().printStackTrace();

or use a function something like this (from
http://mindprod.com/jgloss/trace.html):

static void imAt (PrintWriter log) {
  Throwable t = new Throwable();
  StackTraceElement[] es = t.getStackTrace();
  StackTraceElement e = es[1];
  log.println( "at " + e.getClassName()
               + "."+ e.getMethodName()
               + " line:" + e.getLineNumber() );

Previous pageContentsNext page