Type inference problem with JDK 8 Build 82 (original) (raw)

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Apr 3 08:07:16 PDT 2013


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> { Expression<S,? extends U> cast(Class target); } class BatchExpression<S,T> implements Expression<S,T> { private BatchExpression(Expression first, Expression<? super S, T> second) { super(); this.first = first; this.second = second; } private final Expression first; private final Expression<? super S, T> second; public static <S,T> BatchExpression<S,T> create(Expression first, Expression<? super S, T> second) { return new BatchExpression<S, T>(first, second); } @Override public Expression<S, ? extends U> cast(Class target) { // This is where the compiler chokes: return create(first, second.cast(target)); } }



More information about the lambda-dev mailing list