-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
-Wunused gives warnings to values used in annotations #16877
Labels
Milestone
Comments
Minimized: import scala.collection.immutable.HashMap
import scala.annotation.StaticAnnotation
class ExampleAnnotation(val a: Object) extends StaticAnnotation
@ExampleAnnotation(new HashMap())
class Test shows: -- Warning: a.scala:1:34 -------------------------------------------------------
1 |import scala.collection.immutable.HashMap
| ^^^^^^^
| unused import |
Not sure if related, but same issue occurs for imports used alongside the import io.circe.generic.semiauto.*
import io.circe.Codec
final case class Foo(foo: String) derives Codec.AsObject |
szymon-rd
added a commit
that referenced
this issue
Feb 18, 2023
@szymon-rd Fixes #16877 - Traverse the tree of annotations - Update test suits The issue is that the annotation was registered but not traversed.
I'm also seeing unused warning when using annotations on 3.3.0-RC3: import zio.*
import zio.temporal.*
// import zio.temporal.{workflowInterface, workflowMethod} // same warning using like this
// This is our workflow interface
@workflowInterface
trait EchoWorkflow {
@workflowMethod
def echo(str: String): String
}
Same happens with no "*" imports for these annotations like comment in code above. |
Kordyjan
added a commit
that referenced
this issue
Apr 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.3.0-RC2
Minimized code
https://scastie.scala-lang.org/W9ZhbHhJTr2zjkBC5FwUXQ
Output
unused imports for singleshot time, throughput, and TimeUnit
Expectation
These are clearly used.
The text was updated successfully, but these errors were encountered: