Java to Kotlin converter: do not initialize non-val's in artificial primary constructor - it often produced stupid code
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
public class Test private(private val myName: String, var a: Boolean, var b: Double, var c: Float, var d: Long, var e: Int, protected var f: Short, protected var g: Char) {
|
||||
public class Test private(private val myName: String) {
|
||||
var a: Boolean = false
|
||||
var b: Double = 0.toDouble()
|
||||
var c: Float = 0.toFloat()
|
||||
var d: Long = 0
|
||||
var e: Int = 0
|
||||
protected var f: Short = 0
|
||||
protected var g: Char = ' '
|
||||
|
||||
class object {
|
||||
|
||||
public fun create(): Test {
|
||||
return Test(null, false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')
|
||||
return Test(null)
|
||||
}
|
||||
|
||||
public fun create(name: String): Test {
|
||||
return Test(foo(name), false, 0.toDouble(), 0.toFloat(), 0, 0, 0, ' ')
|
||||
return Test(foo(name))
|
||||
}
|
||||
|
||||
fun foo(n: String): String {
|
||||
|
||||
Reference in New Issue
Block a user