microsoft / microsoft/vscode-java-debug

Evaluation failed when the context is generic method

未关闭
#1,169 1 条评论 4 个 reaction 已指派 1 人 在 GitHub 查看

@testforstephen 已经在做这个了。

开始于 2022年5月27日。

ai-triaged bug evaluation
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

Ok, I boiled it down to this:

package vscode_bugged;

public class VSCode_Bugged_Example_3 {

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


static public class Node<T extends Node<T>> {
    public T parent;
}

static public class Tree_Builder<T extends Node<T>> {
    public T current;
}

static public class Element extends Node<Element> {
    public String name;
}

static public Tree_Builder<Element> tree_builder = new Tree_Builder<>();



static public <T extends Node<T>> void foo(Tree_Builder<T> builder) {
    String s = "nope";
    if (builder.current != null) {

    }
    System.out.println(s); // breakpoint here
}

}

It might be possible to boil it down a bit further but my attempts failed so far.
So I think generics might have something to do with it as well.
Place a breakpoint on the last line (see the comment), from there you should be able to see (in the watch window!) tree_builder, builder, s and vscode_bugged.VSCode_Bugged_Example_3.tree_builder but none of them works.

This is not a maven project or the like, just VSCode_Bugged_Example_3.java being located in src/vscode_bugged.

Originally posted by @clankill3r in https://github.com/microsoft/vscode-java-debug/issues/1158#issuecomment-1138320434

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。