Compiler&plugin deprecations cleanup: length, size, indices, tail and other collection operations.

This commit is contained in:
Ilya Gorbunov
2015-06-25 18:49:25 +03:00
parent f3a19ebe11
commit 32144257ec
23 changed files with 46 additions and 45 deletions
@@ -122,7 +122,7 @@ public class JDIEval(
if (!nestedSizes.isEmpty()) {
val nestedElementType = elementType.arrayElementType
val nestedSize = nestedSizes[0]
val tail = nestedSizes.tail
val tail = nestedSizes.drop(1)
for (i in 0..size - 1) {
setArrayElement(arr, int(i), fillArray(nestedElementType, nestedSize, tail))
}
@@ -131,7 +131,7 @@ public class JDIEval(
}
override fun newMultiDimensionalArray(arrayType: Type, dimensionSizes: List<Int>): Value {
return fillArray(arrayType.arrayElementType, dimensionSizes[0], dimensionSizes.tail)
return fillArray(arrayType.arrayElementType, dimensionSizes[0], dimensionSizes.drop(1))
}
private fun Value.array() = jdiObj.checkNull() as jdi.ArrayReference
@@ -83,7 +83,7 @@ fun initFrame(
}
val args = Type.getArgumentTypes(m.desc)
for (i in 0..args.size - 1) {
for (i in 0..args.size() - 1) {
current.setLocal(local++, makeNotInitializedValue(args[i]))
if (args[i].getSize() == 2) {
current.setLocal(local++, NOT_A_VALUE)
@@ -351,7 +351,7 @@ fun Class<Any>.findConstructor(methodDesc: MethodDescription): Constructor<Any?>
fun MethodDescription.matches(ctor: Constructor<*>): Boolean {
val methodParams = ctor.getParameterTypes()!!
if (parameterTypes.size() != methodParams.size) return false
if (parameterTypes.size() != methodParams.size()) return false
for ((i, p) in parameterTypes.withIndices()) {
if (!p.matches(methodParams[i])) return false
}
@@ -363,7 +363,7 @@ fun MethodDescription.matches(method: Method): Boolean {
if (name != method.getName()) return false
val methodParams = method.getParameterTypes()!!
if (parameterTypes.size() != methodParams.size) return false
if (parameterTypes.size() != methodParams.size()) return false
for ((i, p) in parameterTypes.withIndices()) {
if (!p.matches(methodParams[i])) return false
}
@@ -64,7 +64,7 @@ fun buildTestCase(ownerClass: Class<TestData>,
for (method in ownerClass.getDeclaredMethods()) {
if (method.getName() == methodNode.name) {
val isStatic = (method.getModifiers() and Modifier.STATIC) != 0
if (method.getParameterTypes()!!.size > 0) {
if (method.getParameterTypes()!!.size() > 0) {
println("Skipping method with parameters: $method")
}
else if (!isStatic && !method.getName()!!.startsWith("test")) {