Incremental Build Fails - Cannot Find Implementation
MacWire Version: 2.11-2.2.0 Play! Version: 2.11-2.3.10
The incremental compilation fails when adding/removing a class file with:
java.lang.RuntimeException: Cannot find implementations of class class controllers.FooBarGong! at com.softwaremill.macwire.InstanceLookup$class.lookupSingleOrThrow(InstanceLookup.scala:13) ~[util_2.11-2.2.0.jar:2.2.0] at com.softwaremill.macwire.Wired.lookupSingleOrThrow(Wired.scala:10) ~[util_2.11-2.2.0.jar:2.2.0] at Global$.getControllerInstance(Global.scala:41) ~[na:na] ...
Resolution succeeds provided I delete the build output folder do a complete project rebuild.
Upon further investigation, I have learned of an inconsistent classloader state between stack frames as indicated by calling the following from the subject stack frame:
((ClassLoader)this.getClass().getClassLoader()).loadClass("controllers.FooBarGong")
Lookup succeeds from stack frame Global$.getControllerInstance(Global.scala:41) ~[na:na] (class loader ReloadableClassLoader(v1)) but fails to find the class from the deeper stack frame com.softwaremill.macwire.Wired.lookupSingleOrThrow(Wired.scala:10) (class loader PlayDependencyClassLoader)
The call site is fairly simple:
package modules
import play.api.Play
import play.api.libs.ws.WS
import controllers._
import com.softwaremill.macwire._
import services._
object ApplicationModule extends ControllerModule with ServiceModule
trait ControllerModule extends ServiceModule {
import Play.current
lazy val fooBarGongController = wire[FooBarGong]
}
Do I understand correctly that all the errors above are compile-time? I'm not sure if I can do anything on the MacWire side, this looks like a problem in resolving class file dependencies on the compiler level ... in interaction with the macro system