vscode-java
vscode-java copied to clipboard
incorrect warning about unused import for import used in permits clause
Incorrect warning about unused import when that import
- references a nested class in the same file
- is used only in a permits clause on the file's top-level class
Environment
- Operating System: Win10
- JDK version: 21
- Visual Studio Code version: 1.85
- Java extension version: v1.26.2023122208
Steps To Reproduce
The following code issues a warning in the IDE about unused imports:
package foo.x;
// these imports are warned against as unused,
// but the permits clause doesn't compile without them
import foo.x.A.B;
import foo.x.A.C;
public sealed interface A permits B, C {
record B(int data) implements A {}
record C(String data) implements A {}
}
Current Result
warning on the import of foo.x.A.B and foo.x.A.C
Expected Result
no warnings
Additional Informations
This is an upstream JDT issue - https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1808