Replaced sure() invocation with '!!' operator in Java to Kotlin converter.

This commit is contained in:
Evgeny Gerashchenko
2012-09-14 16:25:13 +04:00
parent 8c823486d7
commit 789c8608e5
9 changed files with 14 additions and 14 deletions
+1 -1
View File
@@ -751,7 +751,7 @@ public class Converter {
boolean containsQuestDot = expressionToExpression(expression).toKotlin().contains("?.");
if (isPrimitiveTypeOrNull && isRef && containsQuestDot) {
conversion += ".sure()";
conversion += "!!";
}
if (actualType != null) {
+2 -2
View File
@@ -13,7 +13,7 @@ open class Test() {
open fun putInt(i : Int) : Unit {
}
open fun test() : Unit {
putInt((One.myContainer?.myInt).sure())
IntContainer((One.myContainer?.myInt).sure())
putInt((One.myContainer?.myInt)!!)
IntContainer((One.myContainer?.myInt)!!)
}
}
@@ -8,5 +8,5 @@ var myContainer : Container? = Container()
}
}
open class Test() {
var b : Byte = One.myContainer?.myInt.sure().toByte()
var b : Byte = One.myContainer?.myInt!!.toByte()
}
@@ -1,7 +1,7 @@
open class Test() {
class object {
public open fun toFileSystemSafeName(name : String?) : String? {
var size : Int = name?.length().sure()
var size : Int = name?.length()!!
return name
}
}
+1 -1
View File
@@ -9,6 +9,6 @@ var myContainer : Container? = Container()
}
open class Test() {
open fun test() : Unit {
var b : Byte = One.myContainer?.myInt.sure().toByte()
var b : Byte = One.myContainer?.myInt!!.toByte()
}
}
@@ -8,7 +8,7 @@ if (parent == null || !parent?.exists())
return false
}
var result : Boolean = true
if (parent?.isDirectory().sure())
if (parent?.isDirectory()!!)
{
return true
}
+4 -4
View File
@@ -9,18 +9,18 @@ var myContainer : Container? = Container()
}
open class Test() {
open fun test() : Unit {
if (One.myContainer?.myBoolean.sure())
if (One.myContainer?.myBoolean!!)
System.out?.println("Ok")
var s : String? = (if (One.myContainer?.myBoolean.sure())
var s : String? = (if (One.myContainer?.myBoolean!!)
"YES"
else
"NO")
while (One.myContainer?.myBoolean.sure())
while (One.myContainer?.myBoolean!!)
System.out?.println("Ok")
do
{
System.out?.println("Ok")
}
while (One.myContainer?.myBoolean.sure())
while (One.myContainer?.myBoolean!!)
}
}
+1 -1
View File
@@ -3,7 +3,7 @@ import java.io.Serializable
public open class Language(code : String?) : Serializable {
protected var code : String? = null
public open fun equals(other : Language?) : Boolean {
return other?.toString()?.equals(this.toString()).sure()
return other?.toString()?.equals(this.toString())!!
}
{
this.code = code
+2 -2
View File
@@ -4,9 +4,9 @@ open fun test() : String? {
var s1 : String? = ""
var s2 : String? = ""
var s3 : String? = ""
if ((s1?.isEmpty()).sure() && (s2?.isEmpty()).sure())
if ((s1?.isEmpty())!! && (s2?.isEmpty())!!)
return "OK"
if ((s1?.isEmpty()).sure() && (s2?.isEmpty()).sure() && (s3?.isEmpty()).sure())
if ((s1?.isEmpty())!! && (s2?.isEmpty())!! && (s3?.isEmpty())!!)
return "OOOK"
return ""
}