Wouldn't code instrumentation be trivially bypassable using an eval construct? esp. something like
[]["constructor"]["constructor"]("while (true) { }")()
Or does Nashorn have a mechanism for forcing the code static?