KT-5287 J2K: Convert class with private constructor and static functions to "object" instead of class with "class object"

#KT-5287 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-03-27 13:55:47 +03:00
parent 6dbb13c32d
commit f19eb20803
63 changed files with 550 additions and 482 deletions
@@ -2,12 +2,10 @@ package pack
class C(arg1: Int, arg2: Int = 0, arg3: Int = 0)
public class User {
companion object {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
public object User {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
}
@@ -18,12 +18,10 @@ class C(val myArg1: Int) {
}
}
public class User {
companion object {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
public object User {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
}
@@ -9,12 +9,10 @@ class C(arg1: Int, arg2: Int, arg3: Int) {
}
}
public class User {
companion object {
public fun main() {
val c1 = C(1, 2, 3)
val c2 = C(5, 6)
val c3 = C(7)
}
public object User {
public fun main() {
val c1 = C(1, 2, 3)
val c2 = C(5, 6)
val c3 = C(7)
}
}
@@ -33,12 +33,10 @@ class CustomerBuilder {
}
}
public class User {
companion object {
public fun main() {
val customer = CustomerBuilder().WithFirstName("Homer").WithLastName("Simpson").Build()
System.out.println(customer.firstName)
System.out.println(customer.lastName)
}
public object User {
public fun main() {
val customer = CustomerBuilder().WithFirstName("Homer").WithLastName("Simpson").Build()
System.out.println(customer.firstName)
System.out.println(customer.lastName)
}
}
@@ -20,12 +20,10 @@ public class Identifier<T> {
}
}
public class User {
companion object {
public fun main() {
val i1 = Identifier("name", false, true)
val i2 = Identifier("name", false)
val i3 = Identifier("name")
}
public object User {
public fun main() {
val i1 = Identifier("name", false, true)
val i2 = Identifier("name", false)
val i3 = Identifier("name")
}
}
@@ -20,12 +20,10 @@ public class Identifier {
}
}
public class User {
companion object {
public fun main() {
val i1 = Identifier("name", false, true)
val i2 = Identifier("name", false)
val i3 = Identifier("name")
}
public object User {
public fun main() {
val i1 = Identifier("name", false, true)
val i2 = Identifier("name", false)
val i3 = Identifier("name")
}
}
@@ -11,12 +11,10 @@ class C {
}
}
public class User {
companion object {
public fun main() {
val c1 = C(1, 2, 3)
val c2 = C(5, 6)
val c3 = C(7)
}
public object User {
public fun main() {
val c1 = C(1, 2, 3)
val c2 = C(5, 6)
val c3 = C(7)
}
}
@@ -17,12 +17,10 @@ class C(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
}
}
public class User {
companion object {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
public object User {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
}
@@ -1,4 +1,4 @@
class Outer {
object Outer {
private class Nested1() {
public constructor(a: Int) : this() {
@@ -48,13 +48,10 @@ class Outer {
}
}
companion object {
fun foo() {
val nested1 = Nested1(1)
val nested2 = Nested2(2)
val nested3 = Nested3(3)
val nested4 = Nested4(4)
}
fun foo() {
val nested1 = Nested1(1)
val nested2 = Nested2(2)
val nested3 = Nested3(3)
val nested4 = Nested4(4)
}
}
@@ -24,10 +24,8 @@ public class Test {
}
}
public class User {
companion object {
public fun main() {
val t = Test("name")
}
public object User {
public fun main() {
val t = Test("name")
}
}