Java to Kotlin converter: fixed overriding of Object methods

This commit is contained in:
Valentin Kipyatkov
2014-06-04 15:12:37 +04:00
parent dcfa396b50
commit 118b23061b
12 changed files with 169 additions and 222 deletions
@@ -23,20 +23,20 @@ class Test() : Base() {
}
class Base() {
public fun hashCode(): Int {
return System.identityHashCode(this)
override fun hashCode(): Int {
return super.hashCode()
}
public fun equals(o: Any): Boolean {
return this.identityEquals(o)
override fun equals(other: Any?): Boolean {
return super.equals(o)
}
protected fun clone(): Any {
return super.clone()
}
public fun toString(): String {
return getJavaClass<Base>.getName() + '@' + Integer.toHexString(hashCode())
override fun toString(): String {
return super.toString()
}
protected fun finalize() {
@@ -1,29 +1,29 @@
//file
package test;
class X {
@Override
public int hashCode() {
return super.hashCode();
}
class Test {
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public String toString() {
return super.toString();
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
@Override
public String toString() {
return super.toString();
}
@Override
protected void finalize() throws Throwable {
super.finalize();
}
class Y extends Thread {
@Override
protected Object clone() throws CloneNotSupportedException {
return super.clone();
}
}
@@ -1,23 +1,23 @@
package test
class Test() {
public fun hashCode(): Int {
return System.identityHashCode(this)
class X() {
override fun hashCode(): Int {
return super.hashCode()
}
public fun equals(o: Any): Boolean {
return this.identityEquals(o)
override fun equals(other: Any?): Boolean {
return super.equals(o)
}
override fun toString(): String {
return super.toString()
}
protected fun clone(): Any {
return super.clone()
}
}
public fun toString(): String {
return getJavaClass<Test>.getName() + '@' + Integer.toHexString(hashCode())
}
protected fun finalize() {
super.finalize()
class Y() : Thread() {
override fun clone(): Any {
return super.clone()
}
}