https://kotlinlang.org logo
a

apatrida

09/11/2015, 3:04 PM
From poll, setting all would cause errors as said before in some frameworks, or cause confusion. Yet in other frameworks it would be correct. For example @JsonIgnore should be on getter and setter for example and doesn't hurt if on field. While @JsonProperty should be on getter and setter and parameter (must be on parameter for sure to match), but would cause confusion on field which isn't the property. I'm trying to think of framework that would fail from it on getter / setter (for var) and parameter. Can't think of one that wouldn't work there. Kotlin fields are invisible so keep them that way and never add to backing field without some special indication they want that. So get/set/parm if they match annotation target.