Skip to content

UnusedImports: Lots of false positives #3074

Description

@3flex

Expected Behavior

java.util.HashMap is not reported as unused, since the type is used in the function value parameter:

import java.util.HashMap

fun doesNothing(thing: HashMap<String, String>) {
    // nothing
}

Observed Behavior

java.util.HashMap is reported as unused by UnusedImports rule.

Steps to Reproduce

Run detekt with type resolution enabled on the code provided above.

Context

Lots of false positives in detekt 1.13.x.

Your Environment

  • Version of detekt used: 1.13.1
  • Version of Gradle used (if applicable): 6.6.1
  • Operating System and version: Windows 10
  • Link to your project (if it's a public repository): N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions