redhat-developer / redhat-developer/vscode-java
Visual Studio Code's Java Compiler Not Showing Certain Errors
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 547
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用列出的 Java 和扩展版本,在 Visual Studio Code 中通过类成员声明复现 HashMap 泛型类型不匹配。将显示的编译器输出与预期的类型不匹配和方法参数诊断进行比较;当这些错误及其源代码位置都显示出来时即表示完成,包括列出的其他集合情况。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, vscode
- 领域
- developer-experience, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100