Skip to content

Making Java fully dynamic via invokedynamic and dynamic class creation

nerds-central.blogspot.com
2 pointsnerds-central1 comment
On HN

The op-code thing is a means to an end. The key of the article is how to use this technique to get at the new invokedynamic op-code and use the dynamic language features that provides from Java. Java does not support invokedynamic in syntax, so there are a few hoops to jump through to get to it. One can create a class which has an invokedynamic call site in it. Then link to that class. However, that is not very flexible. So using dynamic class loading from op-codes to create a new class site and then using that from Java (by casting to a know interface) makes a very clean pattern for Java its self to make use of invokedynamic.

Comments

I am personally convinced that invokedynamic (the new BA op-code for Java 7) is not just for dynamic language support. Patterns like the one in this post _will_ let people develop dynamic approaches to Java. This will effect aspect oriented programming, all reflection based system and so on. I can see applications in server environments where objects/beans etc can use invokedynamic to tight bind initially loosely associated business logic.

In short - I believe invokedynamic is a game changer for Java and everything that interoprates with or competes with Java.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.