本文介绍了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.

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

10-29 09:48