Skip to content

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

@softwareCobbler

Description

@softwareCobbler

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

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions