Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin使用Autowired问题 #879

Closed
lantah-1 opened this issue Dec 9, 2020 · 1 comment
Closed

Kotlin使用Autowired问题 #879

lantah-1 opened this issue Dec 9, 2020 · 1 comment

Comments

@lantah-1
Copy link

lantah-1 commented Dec 9, 2020

` @Autowired(name = Constants.INTENT_DATA)
@JvmField
var type: Int = 0

@Autowired(name = Constants.INTENT_DATA1)
@JvmField
var goodId: String? = ""

@Autowired(name = Constants.INTENT_DATA2)
@JvmField
var showTitle: Boolean = true`

目标页面接受参数如上,autowired生成的代码如下:

`/**

  • DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
    public class IVoicePricesFragment$$ARouter$$Autowired implements ISyringe {
    private SerializationService serializationService;

@OverRide
public void inject(Object target) {
serializationService = ARouter.getInstance().navigation(SerializationService.class);
IVoicePricesFragment substitute = (IVoicePricesFragment)target;
substitute.type = substitute.getArguments().getInt("data");
substitute.goodId = substitute.getArguments().getString("data1");
substitute.showTitle = substitute.getArguments().getBoolean("data2");
}
}`

为什么getBoolean方法中没有用目标页面的默认值作为参数呢?不应该是getBoolean("data2",substitute.showTitle);吗???

@zhi1ong
Copy link
Member

zhi1ong commented Jan 4, 2021

默认值问题已经fix过了

@zhi1ong zhi1ong closed this as completed Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants