1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
public class EvalTypeHierarchyTests {
interface I_A {
int m1();
}
static class A implements I_A {
public int m1() {
return 1;
}
public int m2() {
return 2;
}
public static int s2() {
return 9;
}
public void testA() {
System.out.println("test");
}
}
interface I_B extends I_A {
int m1();
int m3();
}
static class B extends A implements I_B {
public int m1() {
return 11;
}
public int m2() {
return 22;
}
public static int s2() {
return 99;
}
public int m3() {
return 33;
}
public int m4() {
return 44;
}
public static int s4() {
return 88;
}
public void testB() {
System.out.println("test");
}
}
interface I_C extends I_B {
int m1();
int m3();
int m5();
}
static class C extends B implements I_C {
public int m1() {
return 111;
}
public int m2() {
return 222;
}
public static int s2() {
return 999;
}
public int m3() {
return 333;
}
public int m4() {
return 444;
}
public static int s4() {
return 888;
}
public int m5() {
return 555;
}
public int m6() {
return 666;
}
public static int s6() {
return 777;
}
public void testC() {
System.out.println("test");
}
}
public static void main(String[] args) {
I_A iaa= new A();
I_A iab= new B();
I_A iac= new C();
A aa= new A();
A ab= new B();
A ac= new C();
I_B ibb= new B();
I_B ibc= new C();
B bb= new B();
B bc= new C();
I_C icc= new C();
C cc= new C();
aa.testA();
ab.testA();
ac.testA();
bb.testA();
bb.testB();
bc.testA();
bc.testB();
cc.testA();
cc.testB();
cc.testC();
System.out.println("test");
}
}
|