Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more cleanup and refactoring
  • Loading branch information
wu-hui committed Jun 3, 2019
commit a5d91bbd18558f8a49a74727bf659b8fffc58f3b
Original file line number Diff line number Diff line change
Expand Up @@ -661,18 +661,10 @@ private static class BeanMapper<T> {
+ method.getName());
}

// OK to add since existingPropertyName == propertyName.
properties.put(propertyName.toLowerCase(Locale.US), propertyName);

// Handle `setter` update.
Method existingSetter = setters.get(propertyName);
if (existingSetter == null) {
method.setAccessible(true);
setters.put(propertyName, method);
applySetterAnnotations(method);
} else if (!isSetterOverride(method, existingSetter)) {
// We require that setters with conflicting property names are
// overrides from a base class

// Raise exception if a conflict between setters is found.
if (existingSetter != null && !isSetterOverride(method, existingSetter)) {
if (currentClass == clazz) {
// TODO: Should we support overloads?
throw new RuntimeException(
Expand All @@ -692,6 +684,13 @@ private static class BeanMapper<T> {
+ ")");
}
}

// Make it accessible and process annotations if not yet.
if (existingSetter == null) {
method.setAccessible(true);
setters.put(propertyName, method);
applySetterAnnotations(method);
}
}

for (Field field : currentClass.getDeclaredFields()) {
Expand Down