J2K: replace overloads with optional parameters not only for constructors but for methods too

This commit is contained in:
Valentin Kipyatkov
2015-04-08 16:22:15 +03:00
parent ff4ff78307
commit f6e363abb8
23 changed files with 721 additions and 184 deletions
@@ -0,0 +1,17 @@
class A {
private String s = "";
private int x = 0;
public A() {
}
public A(int p, String s){
this(p, s, 1);
}
public A(int p, String s, int x) {
this();
this.s = s;
this.x = x;
}
}
@@ -0,0 +1,11 @@
// ERROR: Val cannot be reassigned
// ERROR: Val cannot be reassigned
class A() {
private val s = ""
private val x = 0
overloads public constructor(p: Int, s: String, x: Int = 1) : this() {
this.s = s
this.x = x
}
}