microsoft / microsoft/vscode-java-debug
static variable are not updated in the variable view.
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 591
- Fork
- 429
- Merge medio
- 1g 9h
- PR unite (30g)
- 19
Descrizione
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
- 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;
}
}
- 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());
}
}
- Put a break point on the System.out.println
- Run in debug mode and check in the Variables View - Local if all dog have the same name.
- 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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci il problema con gli esempi Dog e App, quindi esamina come il debugger Java popola la sezione Local di Variables View e gestisce le modifiche apportate tramite essa. Confronta questa visualizzazione con il watch value dopo aver modificato d2; il lavoro è completato quando tutte le istanze mostrano automaticamente il nome static condiviso corrente o dopo un’azione di aggiornamento disponibile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, typescript
- Ambito
- developer-experience, devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100