forked from JavaTX/JavaCompilerCore
34 lines
498 B
Java
Executable File
34 lines
498 B
Java
Executable File
interface I1 {
|
|
public m1();
|
|
}
|
|
|
|
interface I2 {
|
|
public m2();
|
|
}
|
|
|
|
class Implementation implements I1, I2 {
|
|
public m1() {}
|
|
|
|
public m2() {}
|
|
}
|
|
|
|
class Tester<T extends I1 & I2> {
|
|
|
|
public m3(T x) {
|
|
x.m1();
|
|
x.m2();
|
|
}
|
|
}
|
|
|
|
public class TestExtendedClassesWithBoundedGenerics {
|
|
|
|
public m() {
|
|
x;
|
|
/*can only be of Type Implementation*/
|
|
x= new Implementation();
|
|
y;
|
|
/*could be of Type: Tester<Implementation>, Tester<? super Implementation>*/
|
|
y= new Tester<Implementation>();
|
|
y.m3(x);
|
|
}
|
|
} |