redhat-developer / redhat-developer/vscode-java
Visual Studio Code's Java Compiler Not Showing Certain Errors
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 546
- Merge medio
- 20h 1m
- PR unite (30g)
- 11
Descrizione
Description of the Issue
When running Java code I have noticed that certain compile time errors will not be displayed.
Environment
- Operating System: Windows x64 10
- JDK version: 11.0.4.11
- Visual Studio Code version: 1.41.1
- Java extension version: 0.8.1
- Java Debugger extension version: 0.23.0
Steps To Reproduce
-
Declare the HashMap like,
HashMap<dataTypeA, dataTypeB> name = new HashMap<dataTypeC, dataTypeD>();
Where dataType A - D could be any data type I want it to be. -
The bug only occurs when dataTypeC is different from dataTypeA and or dataTypeD is different from dataTypeB.
Current Result
The compiler displays,
`Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Test.main(Test.java:10)`
Expected Result
The compiler should display,
Unresolved compilation problems:
Type mismatch: cannot convert from HashMap<dataTypeA,dataTypeB> to HashMap<dataTypeC,dataTypeD>
The method put(dataTypeA,dataTypeB) in the type HashMap<dataTypeC,dataTypeD> is not applicable for the arguments (dataTypeA,dataTypeB)
Additional Informations
If I want to see the error message then I have to read the class file in order to determine what the error is and what line it is on. The bug will only occur if the data structure is declared as a class member. I have been able to reproduce this bug with other data structures such as ArrayList, 1D list, and 2D list.
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
Inizia riproducendo l’incompatibilità dei tipi generici di HashMap in Visual Studio Code con una dichiarazione di membro della classe, utilizzando le versioni indicate di Java e dell’estensione. Confronta l’output del compilatore visualizzato con le diagnosi previste per l’incompatibilità dei tipi e degli argomenti dei metodi; l’attività è completata quando vengono mostrati questi errori e le relative posizioni nel codice sorgente, inclusi gli altri casi di collection indicati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, vscode
- Ambito
- developer-experience, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100