forked from JavaTX/JavaCompilerCore
67 lines
1004 B
Java
Executable File
67 lines
1004 B
Java
Executable File
package mycompiler.test.notUsedAnymore;
|
|
|
|
interface I1 {
|
|
public void m1();
|
|
}
|
|
|
|
interface I2 {
|
|
public void m2();
|
|
}
|
|
|
|
class Implementation implements I1, I2 {
|
|
public void m1() {}
|
|
|
|
public void m2() {}
|
|
}
|
|
|
|
class Implementation2 extends Implementation {
|
|
}
|
|
|
|
class Tester<T extends I1 & I2> {
|
|
T x;
|
|
public void m3(Implementation x) {
|
|
x.m1();
|
|
x.m2();
|
|
}
|
|
public void m4 (T x) {
|
|
x.m1();
|
|
x.m2();
|
|
}
|
|
|
|
public Long m4(Integer a, Long b) {
|
|
return a+b;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public class Test {
|
|
|
|
public static void main(String[] args) {
|
|
Implementation x= new Implementation();
|
|
Implementation2 y = new Implementation2();
|
|
|
|
Tester<? extends I1> a = new Tester<Implementation>();
|
|
//a.m3(x);
|
|
|
|
|
|
Tester<? super Implementation2> b = new Tester<Implementation>();
|
|
b.m3(y);
|
|
|
|
Tester<?> c = new Tester<Implementation2>();
|
|
c.m3(y);
|
|
//c.m4(y);
|
|
}
|
|
}
|
|
|
|
class TestSimpleClassesWithBoundedGenerics1<T extends java.lang.Integer> {
|
|
|
|
public T ma(T x) {
|
|
return x;
|
|
}
|
|
|
|
public int mb(T x) {
|
|
return x+1;
|
|
}
|
|
|
|
} |