Skip to content

-Xlint:unused false positive with private class in companion object #10583

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

Closed
ruippeixotog opened this issue Nov 3, 2017 · 1 comment
Closed

Comments

@ruippeixotog
Copy link

The following code, when compiled with -Xlint, yields a warning:

import Container._

class Container {
  println(classOf[MyClass])
}

object Container {
  private class MyClass
}
[warn] Main.scala:8: private class MyClass in object Container is never used
[warn]   private class MyClass
[warn]                 ^
[warn] one warning found

In real world projects, this is happening to me because I'm using Java libraries and I need to pass a Class to be instantiated by reflection.

@som-snytt
Copy link

Duplicates #9058

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

No branches or pull requests

2 participants