Incorrect unused dependency found when using underscore import
Opened this issue · 2 comments
anilkumarmyla commented
Given below deps in build.sbt and latest sbt eco-system
libraryDependencies ++= Seq(
"com.github.jknack" % "handlebars" % "4.1.2",
"com.github.jknack" % "handlebars-jackson2" % "4.1.2"
)
this code with underscore import reports handlebars-jackson2
unused, while switching to expanding the import passes the unused dependencies test
package foo.bar
import com.fasterxml.jackson.databind.ObjectMapper
//import com.github.jknack.handlebars.{Context, JsonNodeValueResolver}
import com.github.jknack.handlebars._
import com.github.jknack.handlebars.context.{FieldValueResolver, JavaBeanValueResolver, MapValueResolver, MethodValueResolver}
object ExampleLibrary {
val mapper = new ObjectMapper()
def getContext(jsonStr: String): Context = {
Context
.newBuilder(mapper.readTree(jsonStr))
.resolver(
JsonNodeValueResolver.INSTANCE,
JavaBeanValueResolver.INSTANCE,
FieldValueResolver.INSTANCE,
MapValueResolver.INSTANCE,
MethodValueResolver.INSTANCE
)
.build
}
}
This is likely a bug in sbt/zinc not reporting the Relations highlighted below when using underscore import
[debug] library deps: Relation [
...
[debug] src/main/scala/foo/bar/ExampleLibrary.scala -> /Users/anilkumarmyla/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/jknack/handlebars-jackson2/4.1.2/handlebars-jackson2-4.1.2.jar
...
[debug] library class names: Relation [
[debug] /Users/anilkumarmyla/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/github/jknack/handlebars-jackson2/4.1.2/handlebars-jackson2-4.1.2.jar -> com.github.jknack.handlebars.JsonNodeValueResolver
...
cc @eed3si9n
anilkumarmyla commented
Happens throughout sbt 1.3.x as well as 1.2.x
eed3si9n commented
Feel free to report this to sbt/zinc as well.