mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
new inference: initial tests
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
class TestGenerics {
|
||||
|
||||
static interface EnumInterface {
|
||||
public String getSomething();
|
||||
}
|
||||
|
||||
static enum Enum1 implements EnumInterface {
|
||||
A("alpha"),
|
||||
B("beta"),
|
||||
G("gamme"),
|
||||
;
|
||||
private String text;
|
||||
|
||||
Enum1(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
static class TestBase<I extends Enum<I> & EnumInterface> {
|
||||
|
||||
protected final void add(Eval eval) {
|
||||
eval.hashCode();
|
||||
}
|
||||
|
||||
abstract class Eval {
|
||||
private I enumI;
|
||||
|
||||
public Eval(I enumI) {
|
||||
this.enumI = enumI;
|
||||
}
|
||||
|
||||
public final void doSomething() {
|
||||
System.out.println(enumI.getSomething());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Test1 extends TestBase<Enum1> {
|
||||
|
||||
public Test1() {
|
||||
add(new Eval(Enum1.A) {});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user