redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 441 forks source link

incorrect warning about unused import for import used in permits clause #3446

Open softwareCobbler opened 10 months ago

softwareCobbler commented 10 months ago

Incorrect warning about unused import when that import

Environment
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
snjeza commented 10 months ago

This is an upstream JDT issue - https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1808