Eclipse 调用层次结构 lambda

标签 eclipse java-8 java-stream

自 Lambda 为 Java 发布以来,我想已经过去了 5 年了。

public static void main(String[] args) {
    go();
}

private static void go() {
    Set<String> set = new HashSet<>();
    set.stream().forEach((s) -> {
        inner(s);
    });
}

private static void inner(String s) {
    inner1(s);
}

private static void inner1(String s) {

}

当我在 inner1 上按 CTRL-ALT-H -(打开调用层次结构)时方法,我希望看到 inner1 中的整个堆栈跟踪至main方法。相反,我的 staktrace 被修剪为 inner方法。我刚刚下载了最新的 Eclipse,我认为是 2018-12,之前我使用的是 Mars。

enter image description here Intellij 可以向我显示预期的调用层次结构,但我不太明白为什么 Eclipse 仍然无法做到这一点。不确定 2019 年是否还有其他人在使用 Eclipse,但也许您可以建议一个插件或其他东西。

切换到 Intellij 不是一个选择,我尝试了几次,但这个习惯很难克服。

更新

有类似的-SO question

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.

Just note, that for lambdas implementing library types like Consumer, 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.

我并不真正关心 lambda 内部结构,不知何故其他 IDE 能够显示预期的堆栈跟踪

最佳答案

现有 old bug对于 eclipse,2016 年报道,仍处于 NEW 状态

Bug 498498 - [1.8][search][call hierarchy] No usage for lambdas

Call hierarchy on bar method correctly shows usage in accept, and for accept there is no usage shown. This issue was already present in mars.

已有3票修复,可以vote也是

从您编辑的链接中可以看到 another relevant old bug处于新状态

Bug 468561 - [search]Call Hierarchy stops searching in doubly-nested lambda chain

也有 3 票...

关于Eclipse 调用层次结构 lambda,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55087055/

相关文章:

java - 如何在 JSF 应用程序中使用大量静态文本?

java - 不幸的是,应用程序已使用 eclipse 在 webview 中停止

java - 使用 Git 和 Eclipse 管理 Android 项目

java - 根据关键 java 流将 HashMap 列表分组为 HashMap 列表

java - 用于替换嵌套 for 循环的 Lambda 表达式由于某种原因不起作用

java - 状态依赖过滤流

sorting - 根据两个日期(创建日期和更新日期)对记录的对象列表进行排序

java - 使用eclipse将项目转换为maven

java-7 - Java 8 发布时使用基于 Java 7 的学习 Material ?

java - 如何使用并行流将 foreach 更改为 lambda