Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code action for static import doesn't work well in a specific case #3835

Open
yuyully opened this issue Oct 31, 2024 · 1 comment
Open

Code action for static import doesn't work well in a specific case #3835

yuyully opened this issue Oct 31, 2024 · 1 comment
Labels

Comments

@yuyully
Copy link

yuyully commented Oct 31, 2024

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
  1. Open https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-maven
  2. Open FirstTest.java file
  3. Comment out import static org.junit.jupiter.api.Assertions.assertEquals;
  4. Add import static org.junit.Assert.*;
  5. Click quick fix before assertEquals
Current Result
  • It shouldn't show the option Add static import for 'Assert.assertEquals' as it has been included in import static org.junit.Assert.*;. And this option doesn't work if clicking it.
  • Without import static org.junit.Assert.*;, code action Add static import for 'Assert.assertEquals works only at first time. After first clicking, it still shows this option even the import has been added.

image

@fbricon
Copy link
Collaborator

fbricon commented Oct 31, 2024

Looks like the import detection mechanism doesn't consider the method signatures, hence proposes incompatible options

@fbricon fbricon added the bug label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants