Files
Aleksey Dobrynin 25a39de77f [java, jigsaw] Support JDK-8197532: add tests (IDEA-367339) IJ-CR-154794
(cherry picked from commit e3acb5c8848ae13da6f28c1593b432e27c81cd14)

IJ-CR-154794

GitOrigin-RevId: 881dcb8023063fcdd7116191c662b180986d4f93
2025-04-30 08:31:30 +00:00

67 lines
1.3 KiB
Java

class MultipleInheritance {
interface A {
int X = 1;
String FOO = "foo";
}
interface B extends A {
int X = 2;
String FOO = "foo";
}
interface C extends A, B {
int Y = C.<error descr="Reference to 'X' is ambiguous, both 'A.X' and 'B.X' match">X</error>;
String BAR = C.<error descr="Reference to 'FOO' is ambiguous, both 'A.FOO' and 'B.FOO' match">FOO</error>.substring(1);
}
}
class Shadowing {
interface A {
int X = 1;
}
interface B extends A {
int X = 2;
}
interface C extends B {
int Y = C.X;
}
}
class MultipleInheritance2 {
interface I1 {
String X = "x";
}
static class Y implements I1 {
public static final String X = "y";
}
static class Z extends Y {
{
System.out.println(X);
}
}
static class Z1 extends Y implements I1 {
{
System.out.println(<error descr="Reference to 'X' is ambiguous, both 'I1.X' and 'Y.X' match">X</error>);
}
}
interface I2 extends I1 {}
static class Z2 extends Y implements I2 {
{
System.out.println(<error descr="Reference to 'X' is ambiguous, both 'I1.X' and 'Y.X' match">X</error>);
}
}
static class Z3 extends Y implements Runnable, I2 {
{
System.out.println(<error descr="Reference to 'X' is ambiguous, both 'I1.X' and 'Y.X' match">X</error>);
}
public void run() {}
}
}