LUCENE-5207: Cleanup JavascriptFunction class to use reflection and type-safe checking (to be extended)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5207@1522805 13f79535-47bb-0310-9956-ffa450edef68