I want to customize hashcode of StackTraceElement class . My problem is how to use this new customized class instead of default StackTraceElement class of JVM.
I want to customize hashcode of StackTraceElement class . My problem is how to
Share
StackTraceElement is
finaland hence can not be extended.If you (for whatever reason) want to customize the way a stack trace is printed, you can implement a utility method which takes the
Throwableand then uses the various methods fromStackTraceElementto create your own layout, something likeYou could also use delegation and create a list of
CustomStackTraceElements, and implement additional logic (like differenthashmap()) in theCustomStackTraceElementclass: