I'm reading the source of XWalkUIClientInternal and I ran into the following code:
switch(type) { case JAVASCRIPT_ALERT: return onJsAlert(view, url, message, result); case JAVASCRIPT_CONFIRM: return onJsConfirm(view, url, message, result); case JAVASCRIPT_PROMPT: return onJsPrompt(view, url, message, defaultValue, result); case JAVASCRIPT_BEFOREUNLOAD: // Reuse onJsConfirm to show the dialog. return onJsConfirm(view, url, message, result); default: break; } assert(false); return false; I've never really seen this technique nor really thought about it before, but I guess this essentially means "this is unreachable code and should not happen ever", and crash the app no matter what. Although technically you can do that with a Throwable, as long as it's not caught.
So my question is, which one is better and why, assert(false) or throwing a RuntimeException, or maybe an Error?