Eliminate a set of warnings, mostly nullability ones

This commit is contained in:
Mikhail Glukhikh
2017-08-15 11:05:56 +03:00
committed by Mikhail Glukhikh
parent 82fc221470
commit 3623f581b8
52 changed files with 49 additions and 74 deletions
@@ -235,7 +235,7 @@ class ForConverter(
// check if it's iteration through list indices
if (collectionSize is PsiMethodCallExpression && collectionSize.argumentList.expressions.isEmpty()) {
val methodExpr = collectionSize.methodExpression
if (methodExpr is PsiReferenceExpression && methodExpr.referenceName == "size") {
if (methodExpr.referenceName == "size") {
val qualifier = methodExpr.qualifierExpression
if (qualifier is PsiReferenceExpression /* we don't convert to .indices if qualifier is method call or something because of possible side effects */) {
val collectionType = PsiElementFactory.SERVICE.getInstance(project).createTypeByFQClassName(CommonClassNames.JAVA_UTIL_COLLECTION)
@@ -72,7 +72,7 @@ private fun Converter.convertTypeParameter(typeParameter: PsiTypeParameter): Typ
fun Converter.convertTypeParameterList(typeParameterList: PsiTypeParameterList?): TypeParameterList {
return if (typeParameterList != null)
TypeParameterList(typeParameterList.typeParameters!!.toList().map { convertTypeParameter(it) }).assignPrototype(typeParameterList)
TypeParameterList(typeParameterList.typeParameters.toList().map { convertTypeParameter(it) }).assignPrototype(typeParameterList)
else
TypeParameterList.Empty
}