Java to Kotlin converter: correct code generated for accessing nullable variables
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
//method
|
||||
int foo(String s, boolean b) {
|
||||
if (s == null) System.out.println("null")
|
||||
if (b) return s.length();
|
||||
return 10;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo(s: String?, b: Boolean): Int {
|
||||
if (s == null)
|
||||
System.out.println("null")
|
||||
if (b)
|
||||
return s?.length()!!
|
||||
return 10
|
||||
}
|
||||
Reference in New Issue
Block a user