Java to Kotlin converter: better formatting preserving from original code
#KT-4801 Fixed
This commit is contained in:
@@ -3,9 +3,6 @@ class C() {
|
||||
}
|
||||
|
||||
fun bar(b: Boolean) {
|
||||
foo(if (b)
|
||||
"a"
|
||||
else
|
||||
null)
|
||||
foo(if (b) "a" else null)
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ trait I {
|
||||
class C() {
|
||||
fun foo(i: I, b: Boolean) {
|
||||
val result = i.getString()
|
||||
if (b)
|
||||
result = null
|
||||
if (b) result = null
|
||||
if (result != null) {
|
||||
print(result)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
class C() {
|
||||
fun foo(b: Boolean): String? {
|
||||
return if (b)
|
||||
"abc"
|
||||
else
|
||||
null
|
||||
return if (b) "abc" else null
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
class C() {
|
||||
fun getString(b: Boolean): String? {
|
||||
return if (b)
|
||||
"a"
|
||||
else
|
||||
null
|
||||
return if (b) "a" else null
|
||||
}
|
||||
|
||||
fun foo(): Int {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
fun foo(s: String?, b: Boolean): Int {
|
||||
if (s == null)
|
||||
System.out.println("null")
|
||||
if (b)
|
||||
return s?.length()!!
|
||||
if (s == null) System.out.println("null")
|
||||
if (b) return s?.length()!!
|
||||
return 10
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
// !specifyLocalVariableTypeByDefault: true
|
||||
fun foo(b: Boolean) {
|
||||
val s: String? = (if (b)
|
||||
"abc"
|
||||
else
|
||||
null)
|
||||
val s: String? = (if (b) "abc" else null)
|
||||
}
|
||||
Reference in New Issue
Block a user