estatico / scala-newtype

NewTypes for Scala with no runtime overhead
Apache License 2.0
540 stars 31 forks source link

Warning emitted when using @newtype in package object #43

Closed shinpatsy closed 5 years ago

shinpatsy commented 5 years ago

I have the following code:

package object stuff {
  @newtype case class Thing(underlying: Int)
}

In scala 2.12.x the following warning is issued (making -Xfatal-warning impossible):

[warn] package.scala:10: it is not recommended to define classes/objects inside of package objects.
[warn] If possible, define trait MetricActorRef__Types in package metrics instead.
[warn]   @newtype case class MetricActorRef(underlying: ActorRef)
[warn]    ^

This warning happens if I use any scala-newtype version > 0.2.1 (that's the last version that works without the warning).

I am able to work around the issue by using https://github.com/ghik/silencer with the pathFilters pointing to the file in question (the @silent annotation does not work).