Skip to content

Commit

Permalink
Merge branch '2.12' into kotlin-1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dinomite committed Sep 21, 2020
2 parents a75c819 + 787f45d commit 4b90781
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.PropertyName
import com.fasterxml.jackson.databind.cfg.MapperConfig
import com.fasterxml.jackson.databind.introspect.*
import com.fasterxml.jackson.databind.introspect.Annotated
import com.fasterxml.jackson.databind.introspect.AnnotatedConstructor
import com.fasterxml.jackson.databind.introspect.AnnotatedField
import com.fasterxml.jackson.databind.introspect.AnnotatedMember
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter
import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector
import com.fasterxml.jackson.databind.util.BeanUtil
import java.lang.reflect.Constructor
import java.lang.reflect.Method
Expand Down Expand Up @@ -116,10 +121,10 @@ internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val c
}

@Suppress("UNCHECKED_CAST")
protected fun findKotlinParameterName(param: AnnotatedParameter): String? {
if (param.declaringClass.isKotlinClass()) {
val member = param.getOwner().getMember()
val name = if (member is Constructor<*>) {
private fun findKotlinParameterName(param: AnnotatedParameter): String? {
return if (param.declaringClass.isKotlinClass()) {
val member = param.owner.member
if (member is Constructor<*>) {
val ctor = (member as Constructor<Any>)
val ctorParmCount = ctor.parameterTypes.size
val ktorParmCount = try { ctor.kotlinFunction?.parameters?.size ?: 0 }
Expand Down Expand Up @@ -148,9 +153,8 @@ internal class KotlinNamesAnnotationIntrospector(val module: KotlinModule, val c
} else {
null
}
return name
} else {
null
}
return null
}

}
}

0 comments on commit 4b90781

Please sign in to comment.