小编Jef*_*ght的帖子

为什么在编译时不能注入injects子句中的类时dagger不会失败?

我有这门课:

public class ClassWithoutInject {

}
Run Code Online (Sandbox Code Playgroud)

......和这个模块......

@Module(
        injects={
                ClassWithoutInject.class 
        })
public class SimpleModule {
}
Run Code Online (Sandbox Code Playgroud)

我认为这应该产生编译时错误我错了吗?在运行时,我得到:

  Unable to create binding for com.example.ClassWithoutInject required by class com.example.SimpleModule
Run Code Online (Sandbox Code Playgroud)

(因为该类没有@Inject-annotated构造函数).但是不应该在编译时匕首知道吗?

java module runtime compile-time dagger

6
推荐指数
1
解决办法
1256
查看次数

标签 统计

compile-time ×1

dagger ×1

java ×1

module ×1

runtime ×1