Use invokedynamic to implement multiple dispatch

你。 提交于 2019-12-03 03:10:09

Since I have no experience with invokedynamic, I do not know how good the performance and type-safety would be, but can only give some pointers:

The instruction invokedynamic is purely a JVM instruction, it does not relate to dynamic dispatch. The dispatch is completed by method handles (method handle graph and method handle tree are also OK.) that comprises multiple method handle instances. A path in the graph (tree) represents one dispatch path.

For your given sample, i would possible construct a graph (Different people might have different graph result ). IN this graph, the traverse of method handles in the graph is the way how disptach completes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!