Compile-time question

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Apr 8 10:44:48 PDT 2013


On 07/04/13 20:27, Barry Burd wrote:
> Duh !!! I was looking everywhere else for the error. I'm not used to seeing this message in response to an access modifier issue...
I agree the error message is unfortunate in this context. In general the 
plan is that we should try to eliminate all 'redundant' method 
resolution errors and only display plain old good errors - at least in 
cases where there's no dependency on the context.

Maurizio
>   
> CheckAgeForDiscount.java:36: error: method forEach in interface Stream<T> cannot
>   be applied to given types;
>        .forEach(p -> {
>        ^
>    required: Consumer<? super Person>
>    found: (p)->{ p.d[...](); }
>    reason: argument mismatch; cannot type-check lambda expression with inferred p
> arameter types
>        inferred types: Person
>    where T is a type-variable:
>      T extends Object declared in interface Stream
>   
> Thanks.
>>>> On 4/7/2013 at 3:09 PM, in message <5161C451.8030003 at oracle.com>, Brian Goetz <brian.goetz at oracle.com> wrote:
> display() is private in Person?
>
>   
>



More information about the lambda-dev mailing list