What's invokedynamic and how do I use it?

前端 未结 4 1331
栀梦
栀梦 2020-12-04 06:11

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

4条回答
  •  無奈伤痛
    2020-12-04 06:19

    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.

提交回复
热议问题