softwaremill / softwaremill/macwire
Incremental Build Fails - Cannot Find Implementation
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 77
- Avg merge
- 9m
- Merged PRs (30d)
- 4
Description
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]
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the incremental rebuild in the Play application, then inspect InstanceLookup.scala:13 and Wired.scala:10 alongside Global.scala:41. Compare the class loaders at the reported stack frames. Done means adding or removing a controller class resolves without deleting the build output or forcing a complete rebuild.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100