Functional interface confusion
scolebourne at joda.org
Sun Jul 7 12:29:08 PDT 2013
On 7 July 2013 15:28, Brian Goetz <brian.goetz at oracle.com> wrote:
> Returning to your proposal, it doesn't make sense to me. The
> firstDayOfMonth() method does *not* return something generic; it returns a
> lambda specialized to a specific T. That's not compatible with the function
> contract for a generic TemporalAdjuster.
> Remember, when you *invoke* a generic method, the type variables are chosen
> at the call site. If you did:
> TemporalAdjuster ta = TA.<T>firstDayOfMonth();
> for the purpose of the body, you've selected a T. But a users is free to
You are right in that it wouldn't do what it looked like it would do
for my case. But I suspect that in some cases it would provide an easy
existing place to introduce the missing generic type.
Fortunately, this matters even less than it did last night as the rest
of the associated generics of other interfaces necessary to make use
of this change wouldn't compile either (I think its the lack of a self
type causing the pain). Cue solution of no generics.
Oh, and is IntelliJ wrong on @FunctionalInterface?
More information about the lambda-dev