redhat-developer / redhat-developer/vscode-java
Java build is failing when trying to import from enum file
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the static import with duplicate MyEnum files in source and test folders using the environment and versions listed. Trace how the Java extension resolves the source and test types; the work is done when the test enum's NON_EXISTING_TYPE import resolves without a diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100