invokedynamic

MethodHandle - What is it all about?

一笑奈何 提交于 2019-11-27 04:17:21
问题 I am studying new features of JDK 1.7 and I just can't get it what MethodHandle is designed for? I understand (direct) invocation of the static method (and use of Core Reflection API that is straightforward in this case). I understand also (direct) invocation of the virtual method (non-static, non-final) (and use of Core Reflection API that requires going through Class's hierarchy obj.getClass().getSuperclass() ). Invocation of non-virtual method can be treated as special case of the former

What's invokedynamic and how do I use it?

孤街醉人 提交于 2019-11-26 23:49:31
问题 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? 回答1: 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

How is String concatenation implemented in Java 9?

拟墨画扇 提交于 2019-11-26 08:49:11
问题 As written in JEP 280: Indify String Concatenation: Change the static String -concatenation bytecode sequence generated by javac to use invokedynamic calls to JDK library functions. This will enable future optimizations of String concatenation without requiring further changes to the bytecode emmited by javac . Here I want to understand what the use of invokedynamic calls is and how bytecode concatenation is different from invokedynamic ? 回答1: The "old" way output a bunch of StringBuilder