-
Notifications
You must be signed in to change notification settings - Fork 29
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
constructor argument Polymorthism #176
Comments
Oops, yeah that should be possible to fix. I'll try have a fix and a new release in the weekend! |
I just pushed a snapshot if you want to try it out straight away. Just add the snapshot repo and deps: repositories {
maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local/" }
}
dependencies {
compile 'nz.bradcampbell:paperparcel:2.0.2-SNAPSHOT'
compile 'nz.bradcampbell:paperparcel-kotlin:2.0.2-SNAPSHOT'
kapt 'nz.bradcampbell:paperparcel-compiler:2.0.2-SNAPSHOT'
} The working code: sealed class Param : Parcelable
abstract class ParamA : Param()
abstract class ParamB : Param()
sealed class Holder<out T: Param>(val param: T): PaperParcelable
@PaperParcel
class HolderA(param: ParamA) : Holder<ParamA>(param) {
companion object {
@JvmField val CREATOR = PaperParcelHolderA.CREATOR
}
}
@PaperParcel
class HolderB(param: ParamB) : Holder<ParamB>(param) {
companion object {
@JvmField val CREATOR = PaperParcelHolderB.CREATOR
}
} Note: I moved |
@grandstaish Cool, I will check it at the end of day. Thanks for fast reply. |
snapshot works, thanks. |
Fyi, 2.0.2 has just been released with this fix included. Sorry about taking so long! |
does not work:
if rename
paramB
andparamA
intoparam
Creator ofHolderA
andB
will use typeParam
for their's constructor argument.Is it possible to check generic value of current class to find class of constructor argument?
The text was updated successfully, but these errors were encountered: