Java 8 rules for method overrides:

- report errors on implementing methods of Any in interfaces
- update testData

~~~

Java 8 override restrictions: interface can't implement a method of 'Any'
- update compiler sources
This commit is contained in:
Dmitry Petrov
2015-10-08 13:00:13 +03:00
parent 5d9ee7efee
commit 7e9e427d4c
36 changed files with 247 additions and 190 deletions
@@ -1,12 +0,0 @@
interface IA {
override fun toString(): String = "IA"
}
interface IB {
override fun toString(): String = "IB"
}
class C : IA, IB {
override fun toString(): String =
<!AMBIGUOUS_SUPER!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>toString<!>()
}
@@ -1,20 +0,0 @@
package
public final class C : IA, IB {
public constructor C()
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ fun toString(): kotlin.String
}
public interface IA {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}
public interface IB {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}
@@ -1,12 +0,0 @@
interface A {
override fun toString(): String {
return "OK"
}
}
interface B : A
class C : B {
override fun toString(): String =
super.toString()
}
@@ -1,20 +0,0 @@
package
public interface A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}
public interface B : A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class C : B {
public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}
@@ -5,12 +5,4 @@ interface IWithToString {
class A : IWithToString {
// Should be Any#toString(), even though IWithToString defines an abstract toString.
override fun toString(): String = super.toString()
}
interface IWithImplementedToString {
override fun toString(): String = "Heh"
}
class B : IWithImplementedToString {
override fun toString(): String = super.toString()
}
}
@@ -7,19 +7,6 @@ public final class A : IWithToString {
public open override /*1*/ fun toString(): kotlin.String
}
public final class B : IWithImplementedToString {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}
public interface IWithImplementedToString {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}
public interface IWithToString {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int