microsoft / microsoft/vscode-java-debug

Evaluation failed when the context is generic method

Đang mở
#1,169 1 bình luận 4 reaction 1 người được giao Xem trên GitHub

@testforstephen đang làm issue này rồi.

Từ ngày 27/5/2022.

ai-triaged bug evaluation
Ngôn ngữ chính
TypeScript
Star
591
Fork
429
Merge trung bình
1 ngày 9 giờ
Pull request đã merge (30 ngày)
19

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.