inherit abstract/default when inheritor provides substitutor which makes 2 different methods in the super hierarchy override equivalent (IDEA-140490; IDEA-146056)

This commit is contained in:
Anna Kozlova
2016-01-07 14:19:10 +01:00
parent e32cc02725
commit a25cb73db1
5 changed files with 139 additions and 47 deletions

View File

@@ -10,4 +10,4 @@ interface A5 {
Iterator iterator();
}
abstract class <error descr="B inherits abstract and default for iterator() from types A5 and A4">B</error> implements A5, A4 {}
abstract class <error descr="B inherits abstract and default for iterator() from types A4 and A5">B</error> implements A5, A4 {}

View File

@@ -0,0 +1,50 @@
class Test1 {
interface A<T> {
void foo(T x);
default void foo(String x) { }
}
class <error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'A'">C</error> implements A<String> { }
abstract class <error descr="Test1.D inherits abstract and default for foo(String) from types Test1.A and Test1.A">D</error> implements A<String> {}
interface <error descr="Test1.E inherits abstract and default for foo(String) from types Test1.A and Test1.A">E</error> extends A<String> {}
}
class Test2 {
interface A {
default void foo(String x) { }
}
interface B<T> extends A {
void foo(T x);
}
<error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'B'">class <error descr="Class 'C' must either be declared abstract or implement abstract method 'foo(T)' in 'B'">C</error> implements B<String></error> { }
abstract class D implements B<String> {}
interface E extends B<String> {}
}
class Test3 {
interface A<T> {
default void foo(T x) {}
default void foo(String x) { }
}
class <error descr="Test3.C inherits unrelated defaults for foo(T) from types Test3.A and Test3.A">C</error> implements A<String> { }
abstract class <error descr="Test3.D inherits unrelated defaults for foo(T) from types Test3.A and Test3.A">D</error> implements A<String> {}
interface <error descr="Test3.E inherits unrelated defaults for foo(T) from types Test3.A and Test3.A">E</error> extends A<String> {}
}
class Test4 {
interface A {
default void foo(String x) { }
}
interface B<T> extends A {
default void foo(T x) {}
}
class C implements B<String> { }
abstract class D implements B<String> {}
interface E extends B<String> {}
}

View File

@@ -10,9 +10,9 @@ interface SecondParent {
int doSomething();
}
class <error descr="Class 'SecondParent' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">FirstSon</error> implements FirstParent, SecondParent {}
class <error descr="Class 'FirstSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">FirstSon</error> implements FirstParent, SecondParent {}
<error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">class <error descr="SecondSon inherits abstract and default for doSomething() from types SecondParent and FirstParent">SecondSon</error> implements SecondParent, FirstParent</error> {}
<error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">class <error descr="Class 'SecondSon' must either be declared abstract or implement abstract method 'doSomething()' in 'SecondParent'">SecondSon</error> implements SecondParent, FirstParent</error> {}
interface A {
default int foo() {