Incremental Build Fails - Cannot Find Implementation

未关闭
#93 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
scala
领域
backend

调研方向

先在 Play 应用中复现增量构建,然后结合 Global.scala:41 检查 InstanceLookup.scala:13 和 Wired.scala:10。比较报告的堆栈帧中的类加载器。完成的标准是:添加或删除一个 controller 类即可解决问题,而无需删除构建输出或强制执行完整重建。

由索引模型根据 Issue 内容生成。

描述

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]
}
主要语言
Scala
星标
1.3k
派生
77
平均合并
9 分钟
30 天内合并 PR
4

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

softwaremill/macwire 的其他 Issue

查看 softwaremill/macwire 的全部 Issue

相似的 Issue

更多 Scala Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。