Fix ISE in ReflectJavaMember.getValueParameters on Java 6
The exception was incorrectly introduced in 0f0602230a. We should not
fail when `names` is null, only when there's no element at the
corresponding index. On Java 6, `names` is always null. On Java 8,
`names` is never null (it's an empty list if the class was compiled
without "-parameters")
This commit is contained in:
+3
-1
@@ -52,7 +52,9 @@ abstract class ReflectJavaMember : ReflectJavaElement(), ReflectJavaAnnotationOw
|
|||||||
|
|
||||||
for (i in parameterTypes.indices) {
|
for (i in parameterTypes.indices) {
|
||||||
val type = ReflectJavaType.create(parameterTypes[i])
|
val type = ReflectJavaType.create(parameterTypes[i])
|
||||||
val name = names?.getOrNull(i + shift) ?: error("No parameter with index $i+$shift (name=$name type=$type) in $this")
|
val name = names?.run {
|
||||||
|
getOrNull(i + shift) ?: error("No parameter with index $i+$shift (name=$name type=$type) in $this@ReflectJavaMember")
|
||||||
|
}
|
||||||
val isParamVararg = isVararg && i == parameterTypes.lastIndex
|
val isParamVararg = isVararg && i == parameterTypes.lastIndex
|
||||||
result.add(ReflectJavaValueParameter(type, parameterAnnotations[i], name, isParamVararg))
|
result.add(ReflectJavaValueParameter(type, parameterAnnotations[i], name, isParamVararg))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user