java - Is invocation of exception.fillInStacktrace useful? -
i found explicit invocation of e.fillinstacktrace()
directly after creation of exception exception e = new exception()
.
i think redundant, because constructor of throwable
invoke fillinstacktrace()
.
but maybe overlooked , lines useful:
exception e = new exception(); e.fillinstacktrace(); creationinfo = new creationinfo(e.getstacktrace());
(public creationinfo(stacktraceelement[] astacktrace){...}
)
i think
the additional invocation of
e.fillinstacktrace();
directly after creation exception redundant , wast lot of resource, because method expensive.it seams construct needed obtain current stacktrace, therefore:
creationinfo = thread.currentthread().getstacktrace();
is better way.
before filling issue report want ask if have overlooked something?
you correct on both counts: biggest reason why fillinstacktrace
available let override in own exceptions you'd save costs of providing stack trace information, or need hide information location exception may have been thrown. see this answer more details.
Comments
Post a Comment