Refactor converter:

Minor: Fix "deprecated" warnings
This commit is contained in:
Pavel Talanov
2013-12-01 21:24:15 +04:00
committed by Pavel V. Talanov
parent d7e1c1f0a2
commit fabfcb4271
7 changed files with 12 additions and 9 deletions
@@ -45,7 +45,7 @@ public open class ArrayInitializerExpression(val arrayType: ArrayType, val initi
}
private fun explicitConvertIfNeeded(i: Expression): String {
val doubleOrFloatTypes = hashSet("double", "float", "java.lang.double", "java.lang.float")
val doubleOrFloatTypes = setOf("double", "float", "java.lang.double", "java.lang.float")
val afterReplace: String = innerTypeStr().replace(">", "").replace("<", "").replace("?", "")
if (doubleOrFloatTypes.contains(afterReplace))
{
+3 -1
View File
@@ -16,6 +16,8 @@
package org.jetbrains.jet.j2k.ast
import java.util.ArrayList
public open class Block(val statements: List<Element>, val notEmpty: Boolean = false) : Statement() {
public override fun isEmpty(): Boolean {
return !notEmpty && statements.all { it.isEmpty() }
@@ -30,6 +32,6 @@ public open class Block(val statements: List<Element>, val notEmpty: Boolean = f
}
class object {
public val EMPTY_BLOCK: Block = Block(arrayList())
public val EMPTY_BLOCK: Block = Block(ArrayList())
}
}
@@ -39,7 +39,7 @@ public open class Identifier(val name: String,
return "`" + str + "`"
}
public val ONLY_KOTLIN_KEYWORDS: Set<String> = hashSet(
public val ONLY_KOTLIN_KEYWORDS: Set<String> = setOf(
"package", "as", "type", "val", "var", "fun", "is", "in", "object", "when", "trait", "This"
);
}
@@ -17,6 +17,7 @@
package org.jetbrains.jet.j2k.ast
import org.jetbrains.jet.j2k.ast.types.Type
import java.util.ArrayList
public open class MethodCallExpression(val methodCall: Expression,
val arguments: List<Expression>,
@@ -31,10 +32,10 @@ public open class MethodCallExpression(val methodCall: Expression,
}
class object {
fun build(receiver: Expression, methodName: String, arguments: List<Expression> = arrayList()): MethodCallExpression {
fun build(receiver: Expression, methodName: String, arguments: List<Expression> = ArrayList()): MethodCallExpression {
return MethodCallExpression(CallChainExpression(receiver, Identifier(methodName, false)),
arguments,
arrayList(), false)
ArrayList(), false)
}
}
}
@@ -79,7 +79,7 @@ public open class ExpressionVisitor(converter: Converter) : StatementVisitor(con
val lhs = getConverter().convertExpression(expression?.getLOperand()!!, expression?.getType())
val rhs = getConverter().convertExpression(expression?.getROperand(), expression?.getType())
if (expression?.getOperationSign()?.getTokenType() == JavaTokenType.GTGTGT) {
myResult = MethodCallExpression.build(lhs, "ushr", arrayList(rhs))
myResult = MethodCallExpression.build(lhs, "ushr", listOf(rhs))
}
else {
myResult = BinaryExpression(lhs, rhs,
@@ -224,7 +224,7 @@ public open class ExpressionVisitor(converter: Converter) : StatementVisitor(con
val operand = getConverter().convertExpression(expression?.getOperand(), expression?.getOperand()!!.getType())
val token = expression?.getOperationTokenType()!!
if (token == JavaTokenType.TILDE) {
myResult = MethodCallExpression.build(ParenthesizedExpression(operand), "inv", arrayList())
myResult = MethodCallExpression.build(ParenthesizedExpression(operand), "inv", ArrayList())
}
else {
myResult = PrefixOperator(getOperatorString(token), operand)
@@ -27,7 +27,7 @@ public open class ExpressionVisitorForDirectObjectInheritors(converter: Converte
public override fun visitMethodCallExpression(expression: PsiMethodCallExpression?) {
val methodExpression = expression?.getMethodExpression()!!
if (superMethodInvocation(methodExpression, "hashCode")) {
myResult = MethodCallExpression.build(Identifier("System", false), "identityHashCode", arrayList(Identifier("this")))
myResult = MethodCallExpression.build(Identifier("System", false), "identityHashCode", listOf(Identifier("this")))
}
else if (superMethodInvocation(methodExpression, "equals")) {
myResult = MethodCallExpression.build(Identifier("this", false), "identityEquals", getConverter().convertArguments(expression!!))
@@ -20,7 +20,7 @@ import com.intellij.psi.*
import java.util.HashSet
public open class SuperVisitor() : JavaRecursiveElementVisitor() {
public val resolvedSuperCallParameters: HashSet<PsiExpressionList> = hashSet()
public val resolvedSuperCallParameters: HashSet<PsiExpressionList> = HashSet()
public override fun visitMethodCallExpression(expression: PsiMethodCallExpression?) {
if (expression != null && isSuper(expression.getMethodExpression())) {