HuolalaTech / hll-wp-therouter-android

A framework for assisting in the renovation of Android componentization(帮助 App 进行组件化改造的动态路由框架)
https://therouter.cn/
Apache License 2.0
1.1k stars 129 forks source link

使用@Autowired获取页面跳转传过来的参数时,解析错误,导致获取到的参数不正确 #174

Closed hust-twj closed 2 months ago

hust-twj commented 3 months ago

原因: 在 KSP 生成的类中,走到了autowiredInject方法的 for 循环中,第一次使用 DefaultUrlParser 解析是正确的: success

但是在下一次循环中,又通过 DefaultServiceParser 解析,返回了一个非空的、但是值都是默认值的 实体: error

第二次会覆盖第一次,最终导致获取不到我传过来的参数。

解决: autowiredInject() 方法中获取到值后是不是可以直接退出循环?

不用 @Autowired,用 intent.extra.getParcelable() 的方式能正常获取。

复现路径: fork 了个工程来复现:https://github.com/hust-twj/hll-wp-therouter-android local.proterty 如下:

app=true
agp=true
business-a=true
business-b=true
business-base=true
plugin=true
router=true

Parcelable 是通过 插件生成的:apply plugin: 'kotlin-parcelize'

kymjs commented 2 months ago

1.2.3-rc1
已解决 https://github.com/HuolalaTech/hll-wp-therouter-android/releases/tag/v1.2.3-rc1