什么是调用动态以及如何使用它? [英] What's invokedynamic and how do I use it?
问题描述
我一直听说所有新的很酷的特性都被添加到 JVM 中,其中一个很酷的特性是调用动态.我想知道它是什么以及它如何使 Java 中的反射式编程更容易或更好?
这是一个新的 JVM 指令,它允许编译器生成代码,这些代码调用比以前可能的规范更宽松的方法——如果你知道什么 I keep hearing about all the new cool features that are being added to the JVM and one of those cool features is invokedynamic. I would like to know what it is and how does it make reflective programming in Java easier or better? It is a new JVM instruction which allows a compiler to generate code which calls methods with a looser specification than was previously possible -- if you know what "duck typing" is, invokedynamic basically allows for duck typing. There's not too much you as a Java programmer can do with it; if you're a tool creator, though, you can use it to build more flexible, more efficient JVM-based languages. Here is a really sweet blog post that gives a lot of detail. 这篇关于什么是调用动态以及如何使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!