Cleanup: fix some compiler warnings (mostly deprecations, javaClass)

This commit is contained in:
Mikhail Glukhikh
2017-02-21 17:38:43 +03:00
parent d0cc1635db
commit b121bf8802
445 changed files with 773 additions and 949 deletions
@@ -310,7 +310,7 @@ object DynamicOperatorCallCase : FunctionCallCase() {
@Suppress("USELESS_CAST")
(JsPostfixOperation(OperatorTable.getUnaryOperator(operationToken), dispatchReceiver) as JsExpression)
}
else -> unsupported("Unsupported callElement type: ${callElement.javaClass}, callElement: $callElement, callInfo: $this")
else -> unsupported("Unsupported callElement type: ${callElement::class.java}, callElement: $callElement, callInfo: $this")
}
}
}
@@ -201,8 +201,8 @@ private fun ReceiverParameterDescriptor.getNameForCapturedReceiver(): String {
val containingDeclaration = this.containingDeclaration
assert(containingDeclaration is MemberDescriptor) {
"Unsupported descriptor type: ${containingDeclaration.javaClass}, " +
"receiverDescriptor = $this, " +"containingDeclaration = $containingDeclaration"
"Unsupported descriptor type: ${containingDeclaration::class.java}, " +
"receiverDescriptor = $this, " + "containingDeclaration = $containingDeclaration"
}
if (DescriptorUtils.isCompanionObject(containingDeclaration)) {
@@ -255,7 +255,7 @@ private class PropertyTranslator(
is PropertySetterDescriptor, is LocalVariableAccessorDescriptor.Setter ->
"setter"
else ->
throw IllegalArgumentException("Unknown accessor type ${accessorDescriptor.javaClass}")
throw IllegalArgumentException("Unknown accessor type ${accessorDescriptor::class.java}")
}
val name = accessorDescriptor.name.asString()
@@ -36,7 +36,6 @@ import org.jetbrains.kotlin.psi.KtForExpression
import org.jetbrains.kotlin.psi.KtWhileExpressionBase
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.utils.singletonOrEmptyList
fun createWhile(doWhile: Boolean, expression: KtWhileExpressionBase, context: TranslationContext): JsNode {
val conditionExpression = expression.condition ?:
@@ -121,7 +120,7 @@ fun translateForExpression(expression: KtForExpression, context: TranslationCont
destructuringParameter, parameterName, itemValue, context.innerBlock(block))
}
block.statements += currentVarInit
block.statements += if (realBody is JsBlock) realBody.statements else realBody.singletonOrEmptyList()
block.statements += if (realBody is JsBlock) realBody.statements else listOfNotNull(realBody)
return block
}
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.js.translate.context.TranslationContext
import org.jetbrains.kotlin.js.translate.reference.ReferenceTranslator
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
import org.jetbrains.kotlin.utils.singletonOrEmptyList
class RangeToIntrinsic(function: FunctionDescriptor) : FunctionIntrinsicWithReceiverComputed() {
val rangeTypeDescriptor = function.returnType!!.constructor.declarationDescriptor as ClassDescriptor
@@ -37,6 +36,6 @@ class RangeToIntrinsic(function: FunctionDescriptor) : FunctionIntrinsicWithRece
}
val finalClass = (existingClasses.firstOrNull() as? ClassDescriptor) ?: rangeTypeDescriptor
val constructor = ReferenceTranslator.translateAsTypeReference(finalClass, context)
return JsNew(constructor, receiver.singletonOrEmptyList() + arguments)
return JsNew(constructor, listOfNotNull(receiver) + arguments)
}
}
@@ -76,7 +76,7 @@ fun JsExpression.toInvocationWith(
// `A(a, b, c)` -> `A(a, b, c, $this)`
return JsInvocation(qualifier, leadingExtraArgs + padArguments(arguments) + thisExpr)
}
else -> throw IllegalStateException("Unexpected node type: " + javaClass)
else -> throw IllegalStateException("Unexpected node type: " + this::class.java)
}
}