Skip to content

Commit

Permalink
Merge pull request swagger-api#538 from junbo/develop
Browse files Browse the repository at this point in the history
Filter synthetic methods and fields.
  • Loading branch information
fehguy committed Apr 22, 2014
2 parents 436681a + d453e38 commit 51b6cb8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im
val ignoredProperties = parseIgnorePropertiesClassAnnotation(hostClass)

for (method <- hostClass.getDeclaredMethods) {
if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers())) {
if (Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers()) && !method.isSynthetic()) {
val (fieldName, getter) = extractGetterProperty(method.getName)

LOGGER.debug("field name for method " + method.getName + " is " + fieldName)
Expand All @@ -53,7 +53,7 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im
}

for (field <- hostClass.getDeclaredFields) {
if (Modifier.isPublic(field.getModifiers()) && !Modifier.isStatic(field.getModifiers()) && !ignoredProperties.contains(field.getName)) {
if (Modifier.isPublic(field.getModifiers()) && !Modifier.isStatic(field.getModifiers()) && !ignoredProperties.contains(field.getName) && !field.isSynthetic()) {
if (ignoredProperties.contains(field.getName)) {
LOGGER.debug("ignoring property " + field.getName)
} else {
Expand Down Expand Up @@ -454,4 +454,4 @@ class ModelPropertyParser(cls: Class[_], t: Map[String, String] = Map.empty) (im
}
validateDatatype(name)
}
}
}

0 comments on commit 51b6cb8

Please sign in to comment.