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

Naming conventions for properties in class #358

Open
Gloix opened this issue Oct 29, 2018 · 4 comments
Open

Naming conventions for properties in class #358

Gloix opened this issue Oct 29, 2018 · 4 comments

Comments

@Gloix
Copy link
Contributor

Gloix commented Oct 29, 2018

Hi, I'm getting No corresponding property found for constructor parameter ID and No corresponding property found for constructor parameter isValid for the following Kotlin class:

@Parcel(Parcel.Serialization.BEAN)
data class MyClass @ParcelConstructor constructor(
    var ID: String? = null,
    val isValid: Boolean
)

I discovered that by lowercasing the ID property and removing 'is' from isValid works as expected. Is Parceler sensitive to proper naming conventions? (a.k.a. camel case properties). Why are "is" prefixed properties not valid?

@Gloix Gloix changed the title No corresponding property found for constructor parameter Naming conventions for properties in class Oct 29, 2018
@johncarl81
Copy link
Owner

Sorry @Gloix, I guess I missed this one from a few days ago... do you know what Java is generated from this Kotlin class?

@Gloix
Copy link
Contributor Author

Gloix commented Nov 8, 2018

No worries.
From Java, methods are boolean isValid(), void setID(String s) and String getID().

@johncarl81
Copy link
Owner

Hmm, I bet the isValid name in the constructor is colliding with the valid property name of isValid. Does it work if you change isValid to valid? Or does it work if you clarify the constructor argument with @ParcelProperty("valid") var is Valid: Boolean ?

@johncarl81
Copy link
Owner

... I should just make a KOTLIN specific strategy to handle weird issues with kotlin beans.

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