How can I replace what is sent in a stack trace to "hide" internal details of a class library?

John Zukowski

In addition to the typical obfuscation options, you can use the setStackTrace() method of Throwable to replace the StackTraceElement array. If you really want to, you can "move" line numbers and reorder elements to really confuse your library's users.