Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnusedPrivateClass has false positive behavior for deserialized items #2158

Closed
imanushin opened this issue Dec 2, 2019 · 1 comment · Fixed by #2207
Closed

UnusedPrivateClass has false positive behavior for deserialized items #2158

imanushin opened this issue Dec 2, 2019 · 1 comment · Fixed by #2207
Milestone

Comments

@imanushin
Copy link
Contributor

Code:

   fun readId() = 
       jacksonObjectMapper().readValue<Response>(content).id

  private class Response(
      val id: Int
  )

Expected Behavior

Response class is used, so rule "UnusedPrivateClass" skips it.

Observed Behavior

Rule "UnusedPrivateClass" warns, that Response class is private and is not used.

Context

Private classes for deserialization are very useful to hide interops inside deserialization wrappers.

Your Environment

  • Version of detekt used: 1.2.1
  • Version of Gradle used (if applicable): 6.0.1
  • Operating System and version: Windows 7 x64
  • Link to your project (if it's a public repository): NDA
@schalkms
Copy link
Member

Thanks for reporting this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants