I have a scala class which defines his package like this
package exporters
The class is under the following directory structure:
src/main/scala/exporters/ExporterManager.scala
When compiling the project with sbt
, I get the following warning:
[warn] /scala/export/src/main/scala/exporters/ExporterManager.scala:1:Unused import
[warn] package exporters
[warn] ^
[warn] one warning found
How can I fix this warning?
EDIT:
Here is an extract of the class code:
package exporters
import java.util.Date
import java.util.concurrent.atomic.AtomicInteger
import akka.actor.SupervisorStrategy.Stop
import akka.actor._
import com.amazonaws.services.cloudwatch.model.{StandardUnit, MetricDatum, PutMetricDataRequest}
...
import scala.collection.JavaConversions._
import scala.collection.mutable.ArrayBuffer
import scala.concurrent.duration._
import scala.pickling.Defaults._
import scala.pickling.json._
import scala.util.Try
class ExporterManager extends Actor with ActorJsonLogging {
def receive = {
....
}
...
}
The missing imports are for our classes but nothing special. It is a basic Akka actor.
In my case I was using the Play Framework. I was using the macros to create play.api.libs.json.Reads (play.api.libs.json.Json.reads)
The warnings disappeared once I replaced the macro with code to manually create the Reads.
Not a solution, but a workaround, in case your issue is related to Play's Json macros. Turns out the bug is associated with the reads
macro, but not in the format
macro, so we can take advantage of the fact that Format[X]
extends Reads[X]
:
implicit val noteReads: Reads[Note] = Json.format[Note]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With