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
@@ -1,7 +1,10 @@
package test;
import java.lang.String;
public class Short {
public static Short valueOf(String value) {return new Short();}
public Short(String s){}
public static Short valueOf(String value) {return new Short(value);}
}
class Test {
@@ -1,19 +1,17 @@
package test
public class Short {
public class Short(s: String) {
companion object {
public fun valueOf(value: String): Short {
return Short()
return Short(value)
}
}
}
class Test {
companion object {
public fun test() {
test.Short.valueOf("1")
test.Short.valueOf("1")
java.lang.Short.valueOf("1")
}
object Test {
public fun test() {
test.Short.valueOf("1")
test.Short.valueOf("1")
java.lang.Short.valueOf("1")
}
}
@@ -0,0 +1,7 @@
class Base {
public static final int CONSTANT = 10;
}
class Derived extends Base {
void foo(){}
}
@@ -0,0 +1,10 @@
open class Base {
companion object {
public val CONSTANT: Int = 10
}
}
class Derived : Base() {
fun foo() {
}
}
@@ -1,7 +1,5 @@
class S {
companion object {
fun staticF(): Boolean {
return true
}
object S {
fun staticF(): Boolean {
return true
}
}
@@ -1,11 +1,9 @@
class S {
companion object {
fun sB(): Boolean {
return true
}
object S {
fun sB(): Boolean {
return true
}
fun sI(): Int {
return 1
}
fun sI(): Int {
return 1
}
}
@@ -0,0 +1,6 @@
class Util {
public static void util1() {}
public static void util2() {}
public static final int CONSTANT = 10;
}
@@ -0,0 +1,9 @@
object Util {
public fun util1() {
}
public fun util2() {
}
public val CONSTANT: Int = 10
}
@@ -0,0 +1,8 @@
class Util {
private Util(){}
public static void util1() {}
public static void util2() {}
public static final int CONSTANT = 10;
}
@@ -0,0 +1,10 @@
object Util {
public fun util1() {
}
public fun util2() {
}
public val CONSTANT: Int = 10
}
@@ -0,0 +1,6 @@
abstract class Util {
public static void util1() {}
public static void util2() {}
public static final int CONSTANT = 10;
}
@@ -0,0 +1,9 @@
object Util {
public fun util1() {
}
public fun util2() {
}
public val CONSTANT: Int = 10
}