redhat-developer / redhat-developer/vscode-java

Java build is failing when trying to import from enum file

未关闭
#1,529 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

content-assist
主要语言
TypeScript
星标
2.3k
派生
547
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

Environment
  • Operating System: Windows 10 (ssh remote to ubuntu)
  • JDK version: Java 8
  • Visual Studio Code version: 1.47.1
  • Java extension version: 0.9.1
Steps To Reproduce

If you have two enum files with the same package structure, vscode can't figure out which one you are trying to import
Say for example, your source code has an enum (MyEnum), and your test code has the same enum but with an additional value (NON_EXISTING_TYPE), vscode will complain the enum value doesn't exist. Intellij does not have this problem however.

Here com.my.example.MyEnum exists both in source and test folder, and this is how I would import the test enum:

import static com.my.example.MyEnum.NON_EXISTING_TYPE;

It will highlighted with red squigly line, with message:
The import com.my.example.MyEnum.NON_EXISTING_TYPE cannot be resolved Java(268435846)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先使用所列出的环境和版本,在源代码和测试文件夹中放置重复的 MyEnum 文件,以复现静态导入。跟踪 Java 扩展如何解析源代码类型和测试类型;当测试枚举的 NON_EXISTING_TYPE 导入能够在没有诊断信息的情况下解析时,工作就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。