assuming you have such data class with default parameters
data class Info(
@DrawableRes
val iconRes: Int = 0,
@StringRes
val stringRes: Int = 0,
@LayoutRes
val layoutRes: Int = 0)
so you can create this data-class like
val data = Info(
iconRes = R.drawable.icon,
stringRes = R.string.text,
layoutRes = R.layout.layout)
in this case there isn't any lint error
But when i try to use default parameters a lint error is occured:
val data = Info(
//here is expected resource of type drawable error
stringRes = R.string.text
layoutRes = R.layout.layout)
Seems that it uses position in parameters, not the exact type & name.
I've tried to use explicit annotation like @param:DrawableRes
, but with the same result.
Can i somehow solve this problem? I use latest Android Studio 3.0.
It was an issue in Android Studio and was fixed in 3.1. Checked on 3.1-beta4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With