Skip to content

False positive UnusedPrivateClass when importing private enum constants directly. #2809

Closed
@TWiStErRob

Description

@TWiStErRob

Expected Behavior

No detection because private class is used via import.

Observed Behavior

> Task :detekt FAILED
style - 5min debt
   UnusedPrivateClass - [E] at /.../com/example/Foo.kt:9:5
Overall debt: 5min

Steps to Reproduce

package com.example
import com.example.Foo.E.C1

class Foo {

    fun f() {
        setOf(C1)
    }
    private enum class E {
        C1,
        C2,
        C3
    }
}

Context

We have a private enum like this and a mapping from a list of enums to strings, i.e.

Your Environment

  • Version of detekt used: 1.10.0-RC1
  • Version of Gradle used (if applicable): 5.6.4
  • Operating System and version: not relevant
  • Link to your project (if it's a public repository): N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions