Skip to content

Conversation

@JanKanis
Copy link
Contributor

This is a copy of PR #10404 but against 3.1.x instead of against master.

Make GrailsNameUtils.getPropertyForGetter/Setter do the same checks as .isGetter to decide if a name is a valid getter, and return null otherwise

Make ClassPropertyFetcher also recognize properties of the form "xAge" that have the second letter capitalized, by using the functionality from GrailsNameUtils.getPropertyForGetter instead of using it's own copy of (almost) the same logic.

Fixes #10403

Make ClassPropertyFetcher also recognize properties of the form "xAge" that have the second letter capitalized.

Fixes apache#10403
@graemerocher
Copy link
Contributor

It doesn't compile currently

GrailsClassUtils.getPropertyForGetter/Setter would previously return property names for some method names that were not valid
getters or setters, although the documentation says they return null in those cases. This change improves the detection
and makes sure only valid getters/setters result in a property name.

This commit includes updates in the documentation of related methods to more clearly indicate what is accepted and what not,
and what assumptions are made.

This also includes a bunch of new test cases.
Re-use GrailsNameUtils.getPropertyForGetter from ClassPropertyFetcher instead of having
separate (and wrong) logic.

This commit has a small behavioral change in that the old code would register both
"Property" and "property" for a static property with a getter "getProperty" in
ClassPropertyFetcher. With improved property name derivation that should not be
necessary anymore.
@JanKanis
Copy link
Contributor Author

@graemerocher I noticed. It's fixed now, tests pass.

@graemerocher graemerocher merged commit b942e60 into apache:3.1.x Jan 19, 2017
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

Successfully merging this pull request may close these issues.

2 participants