I\'m curious why is method fillInStackTrace
of java.lang.Throwable
public?
This method replaces original stack trace with that from the pl
One possibly legitimate use is creating an exception in a different place from where you are actually throwing. For instance, maybe you have an application where you provide a plugin facility for generating custom exceptions. Since the stacktrace is filled in on construction, the trace of the exception will include possibly misleading information (it will include calls into the custom exception factory). thus, your application would call fillInStackTrace()
on the exception after generation by the custom factory to give a more accurate stack trace to the eventual receiver of the exception.
This rejected bug indicates that you are not the only one confused by the need for this method.