J2K: use of emptyList, emptySet and emptyMap

This commit is contained in:
Valentin Kipyatkov
2015-03-29 19:20:42 +03:00
parent 1465418c2b
commit c57f2b10d6
2 changed files with 6 additions and 6 deletions
@@ -48,17 +48,17 @@ enum class SpecialMethod(val qualifiedClassName: String?, val methodName: String
COLLECTIONS_EMPTY_LIST: SpecialMethod("java.util.Collections", "emptyList", 0) {
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter)
= MethodCallExpression.build(null, "listOf", listOf(), typeArgumentsConverted, false)
= MethodCallExpression.build(null, "emptyList", listOf(), typeArgumentsConverted, false)
}
COLLECTIONS_EMPTY_SET: SpecialMethod("java.util.Collections", "emptySet", 0) {
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter)
= MethodCallExpression.build(null, "setOf", listOf(), typeArgumentsConverted, false)
= MethodCallExpression.build(null, "emptySet", listOf(), typeArgumentsConverted, false)
}
COLLECTIONS_EMPTY_MAP: SpecialMethod("java.util.Collections", "emptyMap", 0) {
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter)
= MethodCallExpression.build(null, "mapOf", listOf(), typeArgumentsConverted, false)
= MethodCallExpression.build(null, "emptyMap", listOf(), typeArgumentsConverted, false)
}
COLLECTIONS_SINGLETON_LIST: SpecialMethod("java.util.Collections", "singletonList", 1) {
@@ -2,10 +2,10 @@ import java.util.*
class A {
fun foo(): Map<String, String> {
val list1 = listOf<String>()
val list1 = emptyList<String>()
val list2 = listOf(1)
val set1 = setOf<String>()
val set1 = emptySet<String>()
val set2 = setOf("a")
return mapOf()
return emptyMap()
}
}