Eclipse - `open call hierarchy` stop searching in lambda chain

谁都会走 提交于 2019-12-02 20:32:36
Voidpaw

From what I can tell the lack of call hierarchy depth is due to (re)evaluation of code at runtime. It is explained in 15.27.4 Run-Time Evaluation of Lambda Expressions in the Java Language Specification.

At run time, evaluation of a lambda expression is similar to evaluation of a class instance creation expression, insofar as normal completion produces a reference to an object. Evaluation of a lambda expression is distinct from execution of the lambda body.

As the second picture clearly shows, Eclipse is able to trace the call hierarchy through the method call myIf.call() inside methodDepth0. This is correct, because the (outer) lambda implements method MyIF.call().

The fact that the same pattern does not work in the next nesting level looks like a bug. Please consider filing a bug for JDT/UI. TIA.

Just note, that for lambdas implementing library types like Consumer<T>, the number of callers into accept(T) in a workspace may easily become unmanageable, similar to any call hierarchy through, e.g, Runnable.run() - but that doesn't question the general usefulness of call hierarchies through lambdas.

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