Krun options

**please review**

* use JCommander for krun
* clean up krun frontend to be more generic
* fix some hacky behavior in some of the options
But it's not unreachable, it can be reached by passing null to this
function. That's just never done. But throwing NullPointerException when a
method disallows a null argument is standard practice: the JDK does this.
On Jul 16, 2014 6:25 PM, "Ömer Sinan Ağacan" <notifications@github.com>
wrote:

> In
> src/javasources/KTool/src/org/kframework/backend/maude/krun/MaudeKRun.java:
>
> > @@ -426,7 +472,7 @@ private static String getSearchType(SearchType s) {
> >          if (s == SearchType.PLUS) return "+";
> >          if (s == SearchType.STAR) return "*";
> >          if (s == SearchType.FINAL) return "!";
> > -        return null;
> > +        throw new NullPointerException("null SearchType");
>
> This is an unreachable code. Maybe we should use same pattern for every
> unreachable cases in the code base. I just searched in the code base for
> "unreachable" and saw these patterns used:
>
> throw e; //unreachablereturn null; // unreachable codethrow new AssertionError("unreachable");
>
> At least adding a comment or changing the string argument so that a reader
> can know this is supposed to be unreachable would be nice.
>
> Best option would be using exhaustive pattern matching like in typed
> functional languages but I don't know how to do that in Java or if it's
> even possible.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/kframework/k/pull/674/files#r15034231>.
>