Skip to content

[java] Make UnnecessaryImport handle unresolved static imports more gracefully #3748

@oowekyala

Description

@oowekyala

Thanks for the review! I think I'll add additional logic to be more conservative when an import is unresolved. The rule already handles unresolved type imports gracefully, thanks to the unresolved symbols of the symbol API. I think we should also be more intelligent with unresolved static imports.

Originally posted by @oowekyala in #3718 (comment)

Note: one FP caused by this is here: https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/macosx/classes/sun/nio/ch/KQueuePort.java#L36

We should maybe introduce symbols for unresolved fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    an:enhancementAn improvement on existing features / rules

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions