JailedBird / ArouterKspCompiler

Arouter KSP annotation processor
Apache License 2.0
77 stars 8 forks source link

Type in a class literal must not be nullable #13

Closed codejoyfun closed 1 year ago

codejoyfun commented 1 year ago

image

JailedBird commented 1 year ago

定位到原因了,navigation应该传递Class类,我搞成了泛型的;修复中

codejoyfun commented 1 year ago

定位到原因了,navigation应该传递Class类,我搞成了待泛型的了;修复中 image

赞 我是这样声明的: @Autowired @JvmField var deviceManagerService: DeviceMgrService? = null

JailedBird commented 1 year ago

FIx:AutowiredSymbolProcessorProvider image

image

Test case:SecondActivtiy

    @Autowired
    lateinit var iProvider1: TestServiceImpl

    @Autowired
    var iProvider2: TestServiceImpl? = null

    @Autowired
    lateinit var iProvider3: TestServiceImplGene<Int>

    @Autowired
    var iProvider4: TestServiceImplGene<Int>? = null

    @Autowired(name = "iProvider5")
    lateinit var iProvider5: TestServiceImpl

    @Autowired(name = "iProvider6")
    var iProvider6: TestServiceImpl? = null

    @Autowired(name = "iProvider7")
    lateinit var iProvider7: TestServiceImplGene<Int>

    @Autowired(name = "iProvider8")
    var iProvider8: TestServiceImplGene<Int>? = null
@Route(path = "/test/service")
class TestServiceImpl: ITestService1, ITestService2 {
  override fun init(context: Context) {
  }
}

@Route(path = "/test/service")
class TestServiceImplGene<T> : ITestService1, ITestService2 {
  override fun init(context: Context) {
  }
}

Result:

    substitute.iProvider1 = ARouter.getInstance().navigation(TestServiceImpl::class.java) as
        TestServiceImpl
    substitute.iProvider2 = ARouter.getInstance().navigation(TestServiceImpl::class.java) as
        TestServiceImpl?
    substitute.iProvider3 = ARouter.getInstance().navigation(TestServiceImplGene::class.java) as
        TestServiceImplGene<Int>
    substitute.iProvider4 = ARouter.getInstance().navigation(TestServiceImplGene::class.java) as
        TestServiceImplGene<Int>?
    substitute.iProvider5 = ARouter.getInstance().build("iProvider5").navigation() as
        TestServiceImpl
    substitute.iProvider6 = ARouter.getInstance().build("iProvider6").navigation() as
        TestServiceImpl?
    substitute.iProvider7 = ARouter.getInstance().build("iProvider7").navigation() as
        TestServiceImplGene<Int>
    substitute.iProvider8 = ARouter.getInstance().build("iProvider8").navigation() as
        TestServiceImplGene<Int>?
JailedBird commented 1 year ago

先用这个 com.github.JailedBird:ArouterKspCompiler:bugfix-IPorvider-inject-SNAPSHOT 版本验证下哈;正式版晚点发;

codejoyfun commented 1 year ago

先用这个 com.github.JailedBird:ArouterKspCompiler:bugfix-IPorvider-inject-SNAPSHOT 版本验证下哈;正式版晚点发;

image image image

JailedBird commented 1 year ago

先用这个 com.github.JailedBird:ArouterKspCompiler:bugfix-IPorvider-inject-SNAPSHOT 版本验证下哈;正式版晚点发;

image image image

我的锅 🤣

JailedBird commented 1 year ago

多谢反馈 又打一个补丁🤣 image

JailedBird commented 1 year ago

临时版本,试一下 com.github.JailedBird:ArouterKspCompiler:main-SNAPSHOT

codejoyfun commented 1 year ago

临时版本,试一下 com.github.JailedBird:ArouterKspCompiler:main-SNAPSHOT

验证通过了,赞

JailedBird commented 1 year ago

已更新见README,请替换到xxx-1.0.7正式版本;