Reputation: 31235
In a GWT project, I sometimes struggle to understand why/when a method is called. In order to figure it out, I used to throw a dummy exception in order to catch it and access its stacktrace :
StackTraceElement[] stackTrace;
try {
throw new NullPointerException("Dummy");
} catch (NullPointerException e) {
stackTrace = e.getStackTrace();
}
It works but it is a bit tedious to write 6 lines just to get the stacktrace (+ the stacktrace is polluted by the dummy exception). Is there a better way?
Upvotes: 2
Views: 65