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
@@ -0,0 +1,5 @@
interface IA {
<!VIRTUAL_MEMBER_HIDDEN!>fun toString(): String<!> = "IB"
override fun equals(other: Any?): Boolean
}
@@ -0,0 +1,7 @@
package
public interface IA {
public abstract override /*1*/ 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
}
@@ -0,0 +1,9 @@
interface IA {
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IA"<!>
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun equals(other: Any?): Boolean = <!SUPERCLASS_NOT_ACCESSIBLE_FROM_TRAIT!>super<!>.equals(other)<!>
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun hashCode(): Int {
return 42;
}<!>
}
@@ -0,0 +1,7 @@
package
public interface IA {
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun toString(): kotlin.String
}
@@ -0,0 +1,3 @@
interface IC {
fun toString(x: String): String = "IC$x"
}
@@ -0,0 +1,8 @@
package
public interface IC {
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 open fun toString(/*0*/ x: kotlin.String): kotlin.String
}
@@ -0,0 +1,13 @@
interface IA
interface IB : IA {
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IB"<!>
}
interface IC : IB {
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IC"<!>
}
interface ID : IC {
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "ID"<!>
}
@@ -0,0 +1,25 @@
package
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*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface IB : 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 IC : 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
}
public interface ID : IC {
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
}
@@ -0,0 +1,11 @@
interface ILeft {
override fun toString(): String
}
interface IRight {
override fun toString(): String
}
interface IDiamond : ILeft, IRight {
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IDiamond"<!>
}
@@ -0,0 +1,19 @@
package
public interface IDiamond : ILeft, IRight {
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 ILeft {
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 abstract override /*1*/ fun toString(): kotlin.String
}
public interface IRight {
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 abstract override /*1*/ fun toString(): kotlin.String
}