redhat-developer / redhat-developer/vscode-java
Code action for static import doesn't work well in a specific case
Open
Nobody has claimed this yet.
bug
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Environment
- Operating System: Windows
- JDK version: 17.0.8
- Visual Studio Code version: 1.95.0
- Java extension version: 1.36.0
Steps To Reproduce
- Open https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-maven
- Open FirstTest.java file
- Comment out
import static org.junit.jupiter.api.Assertions.assertEquals; - Add
import static org.junit.Assert.*; - Click quick fix before
assertEquals
Current Result
- It shouldn't show the option
Add static import for 'Assert.assertEquals'as it has been included inimport static org.junit.Assert.*;. And this option doesn't work if clicking it. - Without
import static org.junit.Assert.*;, code actionAdd static import for 'Assert.assertEqualsworks only at first time. After first clicking, it still shows this option even the import has been added.
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 quick-fix behavior in FirstTest.java from the junit5-migration-maven sample, using the listed VS Code and Java extension versions if available. Compare the suggestions after adding import static org.junit.Assert.*; and after applying the static-import action once. Done means the action is not offered when the wildcard import already covers assertEquals and no longer remains after the import is added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100