I was looking at "painless", the new-ish scripting engine for Elasticsearch, and it is horrible. In that it is too verbose, can't infer types well, and really should be Kotlin. So I want to create Kotlin scripting merged with the idea of only allowing white-list access to classes/methods/properties/fields. What is the best approach to apply this whitelist, a compiler plugin can see enough to cause errors when something out of bounds is referenced?