Why not provide context accessors (like getFile, getline, getMethod) on AssertionError?
Throwable, so it may be used for all throwables, not just just assertion errors. We enhanced Throwable with the getStackTrace method to provide this functionality. • Why is AssertionError a subclass of Error rather than RuntimeException? This issue was controversial. The expert group discussed it at at length, and came to the conclusion that Error was more appropriate to discourage programmers from attempting to recover from assertion failures. It is, in general, difficult or impossible to localize the source of an assertion failure. Such a failure indicates that the program is operating “outside of known space,” and attempts to continue execution are likely to be harmful. Further, convention dictates that methods specify most runtime exceptions they may throw (with @throws doc comments). It makes little sense to include in a method’s specification the circumstances under which it may generate an assertion failure. Such information may be regarded as an implementation detail, which can