Type inference problem with JDK 8 Build 82
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Apr 16 07:47:00 PDT 2013
Fixed.
Maurizio
On 03/04/13 16:07, Maurizio Cimadamore wrote:
> Another problem with capture conversion in nested method calls - we
> are working on it. In the meantime please use explicit type-parameters.
>
> Thanks
> Maurizio
>
>
> On 03/04/13 15:39, Gernot Neppert wrote:
>> Hi,
>>
>> here's some feedback regarding source compatibility of the Java 8
>> compiler.
>> First of all, Kudos to you compiler guys!
>> In a codebase of appr. 800 classes that have been used previously
>> with Java
>> 7, only one compilation problem showed up when I test-fed the source to
>> javac 8 Build 82.
>> Considering the heavy changes that have been implemented, I'm impressed
>> that compatibility remains that high!
>>
>> Here's a condensed version of the source that causes the problem:
>>
>> interface Expression<S,T> {
>> <U> Expression<S,? extends U> cast(Class<U> target);
>> }
>>
>> class BatchExpression<S,T> implements Expression<S,T> {
>> private BatchExpression(Expression<? super S, ?> first,
>> Expression<? super S, T> second) {
>> super();
>> this.first = first;
>> this.second = second;
>> }
>>
>> private final Expression<? super S, ?> first;
>> private final Expression<? super S, T> second;
>>
>> public static <S,T> BatchExpression<S,T> create(Expression<?
>> super S,?>
>> first, Expression<? super S, T> second) {
>> return new BatchExpression<S, T>(first, second);
>> }
>>
>> @Override
>> public <U> Expression<S, ? extends U> cast(Class<U> target) {
>> // This is where the compiler chokes:
>> return create(first, second.cast(target));
>> }
>> }
>>
>
More information about the lambda-dev
mailing list