| 1 |
class GenericMethodArguments { |
| 2 |
|
| 3 |
static class Items<T> { |
| 4 |
public <Output extends T> Output apply(Transform<? super Items<T>, Output> t) { |
| 5 |
return null; |
| 6 |
} |
| 7 |
} |
| 8 |
|
| 9 |
static class Transforms { |
| 10 |
public static <I, O> Transform<I, O> of(DoFn<I, O> fn) { |
| 11 |
return null; |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
static class Transform<Input, Output> {} |
| 16 |
|
| 17 |
static class DoFn<Input, Output> {} |
| 18 |
|
| 19 |
static class MyFn1<T> extends DoFn<T, Long> {} |
| 20 |
|
| 21 |
static class MyFn2 extends MyFn1<Integer> {} |
| 22 |
|
| 23 |
private Items<Integer> items; |
| 24 |
|
| 25 |
public void useCase1() { |
| 26 |
items.apply(Transforms.of(new MyFn2())); |
| 27 |
} |
| 28 |
|
| 29 |
public void useCase2() { |
| 30 |
items.apply(Transforms.of(new DoFn<Integer,Long>(){})); |
| 31 |
} |
| 32 |
|
| 33 |
} |