Eliminate IllegalArgumentException caused by possible negative sized ArrayList creation

This commit is contained in:
Sergey Mashkov
2015-10-28 15:45:25 +03:00
parent 63f7f90521
commit 16b6bccd1e
@@ -870,7 +870,7 @@ public abstract class KotlinBuiltIns {
List<TypeProjection> arguments = type.getArguments();
int first = isExtensionFunctionType(type) ? 1 : 0;
int last = arguments.size() - 2;
List<TypeProjection> parameterTypes = new ArrayList<TypeProjection>(last - first + 1);
List<TypeProjection> parameterTypes = new ArrayList<TypeProjection>(Math.max(0, last - first + 1));
for (int i = first; i <= last; i++) {
parameterTypes.add(arguments.get(i));
}