microsoft / microsoft/vscode-java-debug

static variable are not updated in the variable view.

Aberta
#1,344 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

ai-triaged bug enhancement variables
Linguagem predominante
TypeScript
Estrelas
591
Forks
429
Merge médio
1d 9h
PRs com merge (30d)
19

Descrição

The static variables of an instance of a class are not updated in the variable view if another instance is changed.

Environment
  • Operating System: Windows 10
  • JDK version: JDK 1.8.311
  • Visual Studio Code version: 1.78.2
  • Java extension version: Language Support for Java(TM) by Red Hat v1.18.0
  • Java Debugger extension version: 0.50.0
Steps To Reproduce
  1. Create a simple class with a static variable as:
public class Dog {
    private static String name;
    private int age;

    public Dog(String name, int age) {
        Dog.name = name;
        this.age = age;
    }

    public static String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

}
  1. In the main create 3 instance of class Dog :
public class App {
    public static void main(String[] args) throws Exception {
        Dog d1 = new Dog("Medor", 3);
        Dog d2 = new Dog("Rex", 5);
        Dog d3 = new Dog("Fifi", 1);

        System.out.println("Dog 1 name : " + d1.getName());
    }
}
  1. Put a break point on the System.out.println
  2. Run in debug mode and check in the Variables View - Local if all dog have the same name.
  3. Edit the name of d2
Current Result

Only the name of d2 is changed and no possibility to update the name of the other dog. We can see if we add a watch that the name of the other dog changes correctly but not in the Variable view.

Expected Result

In the Variable view the name of all instance of dog should be updated, automatically or with a refresh button

Additional Informations

Very important for teachers to explains what happen with static variables.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Reproduza o problema com os exemplos Dog e App e, em seguida, inspecione como o depurador Java preenche a seção Local de Variables View e trata as edições feitas por meio dela. Compare essa exibição com o watch value depois de alterar d2; considera-se concluído quando todas as instâncias exibirem automaticamente o nome static compartilhado atual ou após uma ação de atualização disponível.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
java, typescript
Domínio
developer-experience, devtools
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.