now we trying to generify constructor only in case when we have two or more constructors in class

This commit is contained in:
Sergey Ignatov
2011-11-16 17:14:43 +04:00
parent 234f98b164
commit 532142d12a
11 changed files with 12 additions and 46 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ public class Converter {
); );
// we create primary constructor from all non final fields and fields without initializers // we create primary constructor from all non final fields and fields without initializers
if (!psiClass.isEnum() && !psiClass.isInterface() && getPrimaryConstructorForThisCase(psiClass) == null) { if (!psiClass.isEnum() && !psiClass.isInterface() && psiClass.getConstructors().length > 1 && getPrimaryConstructorForThisCase(psiClass) == null) {
final List<Field> finalOrWithEmptyInitializer = getFinalOrWithEmptyInitializer(fields); final List<Field> finalOrWithEmptyInitializer = getFinalOrWithEmptyInitializer(fields);
final Map<String, String> initializers = new HashMap<String, String>(); final Map<String, String> initializers = new HashMap<String, String>();
@@ -1,10 +1,7 @@
open class Library(ourOut : PrintStream?) { open class Library() {
class object { class object {
val ourOut : PrintStream? val ourOut : PrintStream?
} }
{
$ourOut = ourOut
}
} }
open class User() { open class User() {
open fun main() : Unit { open fun main() : Unit {
@@ -1,8 +1,5 @@
open class Library(myString : String?) { open class Library() {
public val myString : String? public val myString : String?
{
$myString = myString
}
} }
open class User() { open class User() {
open fun main() : Unit { open fun main() : Unit {
@@ -1,9 +1,5 @@
class T(a : String?, b : String?) { class T() {
var a : String? var a : String?
var b : String? var b : String?
var c : String? = "abc" var c : String? = "abc"
{
$a = a
$b = b
}
} }
@@ -1,12 +1,6 @@
open class Base(myFirst : String?) { open class Base() {
private var myFirst : String? private var myFirst : String?
{
$myFirst = myFirst
} }
} open class Child() : Base() {
open class Child(mySecond : String?) : Base() {
private var mySecond : String? private var mySecond : String?
{
$mySecond = mySecond
}
} }
+1 -4
View File
@@ -1,6 +1,3 @@
open class C(f : Foo?) { open class C() {
var f : Foo? var f : Foo?
{
$f = f
}
} }
+1 -4
View File
@@ -1,6 +1,3 @@
open class C(f : Foo?) { open class C() {
private var f : Foo? private var f : Foo?
{
$f = f
}
} }
+1 -4
View File
@@ -1,6 +1,3 @@
open class C(f : Foo?) { open class C() {
protected var f : Foo? protected var f : Foo?
{
$f = f
}
} }
+1 -4
View File
@@ -1,6 +1,3 @@
open class C(f : Foo?) { open class C() {
public var f : Foo? public var f : Foo?
{
$f = f
}
} }
+1 -4
View File
@@ -1,6 +1,3 @@
open class C(f : Foo?) { open class C() {
val f : Foo? = Foo(1, 2) val f : Foo? = Foo(1, 2)
{
$f = f
}
} }
+1 -4
View File
@@ -1,6 +1,3 @@
open class C(f : Foo?) { open class C() {
var f : Foo? var f : Foo?
{
$f = f
}
} }