Eclipse-“开放呼叫层次结构"停止在lambda链中搜索 [英] Eclipse - `open call hierarchy` stop searching in lambda chain

查看:108
本文介绍了Eclipse-“开放呼叫层次结构"停止在lambda链中搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的示例Java代码:

Here is my sample java code:

public class Test {

    public static void main(String[] args) {
        methodDepth0(
            ()->
                methodDepth1(
                    ()->
                        methodDepth2()
                )
        );
    }

    static Object methodDepth2() {
        return null;
    }

    interface MyIF {
        void call();
    }

    static void methodDepth0(MyIF myIf){
        myIf.call();
    }

    interface MyIF2 {
        void call();
    }

    static void methodDepth1(MyIF2 myIf2){
        myIf2.call();
    }
}

当我从Eclipse(4.4)打开方法methodDepth2()的调用层次结构时, open call hierarchy停止搜索下一个呼叫者:

When I open call hierarchy of method methodDepth2() from Eclipse(4.4), open call hierarchy stop searching next caller:

我期望的是像打开方法methodDepth1()的调用层次结构一样,显示直到main方法.

What I expect is like opening call hierarchy of method methodDepth1() which show until the main method.

推荐答案

据我所知,缺少调用层次结构深度是由于在运行时对代码进行了重新评估.在 中进行了解释Java语言规范中的15.27.4 Lambda表达式的运行时评估.

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.

在运行时,只要正常完成生成对对象的引用,对lambda表达式的求值就类似于对类实例创建表达式的求值. Lambda表达式的计算与Lambda主体的执行不同.

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.

这篇关于Eclipse-“开放呼叫层次结构"停止在lambda链中搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆