I probably should have pointed out, that it uses the new ‘invokedynamic’ instruction from JDK 7. The problem ‘before invokedynamic’ was, that you had to use reflection to call methods and make those methods always rely on the same type: Object. And reflection isn’t very fast compared to a normal method call.
Aye, FWIW, you can “script” in JavaScript in Java 6 and 7 also, just ask for the “javascript” engine instead of “nashorn”. I believe it uses some older Rhino version.