Hacker News new | ask | show | jobs
by tel 3816 days ago
That just seems broken?

If `f` is Function<T, S> then given `T src`, like we have, then f.apply(src) has type S. But Extension.this.apply is applied to values of S even though T is the thing qualified as an Extension.

Actually, I'm just entirely not sure I know how to read Java type signatures.

1 comments

The part you're missing is the `this` in `Extension.this`. This method is a member of Extension<T>, and it returns an Extension<S>. So `this` (of type Extension<T>) is transformed by the method to Extension<S>.
Ah, thanks!