Details
-
Bug
-
Resolution: Fixed
-
P2
-
None
-
Verified
Description
abstract class A2<T>{
abstract <S> S pick(S x, S y);
abstract <S1> void m(A2<S1> a)
void test(A2<Integer> y, A2<Long> x){
m(pick(x, y));
}
}
Even though the return type of 'pick' is not wildcard-parameterized, for certain instantiations it can be. The greedy inference strategy of JLS 7 would then perform capture on the instantiated return type before performing inference for 'm'. The Lambda Spec instead skips capture (see 18.5.2) and produces an error.
abstract <S> S pick(S x, S y);
abstract <S1> void m(A2<S1> a)
void test(A2<Integer> y, A2<Long> x){
m(pick(x, y));
}
}
Even though the return type of 'pick' is not wildcard-parameterized, for certain instantiations it can be. The greedy inference strategy of JLS 7 would then perform capture on the instantiated return type before performing inference for 'm'. The Lambda Spec instead skips capture (see 18.5.2) and produces an error.
Attachments
Issue Links
- relates to
-
JDK-8028547 javac type inference mistmatch between 7 and 8
- Resolved
-
JDK-8030741 Inference: implement eager resolution of return types, consistent with JDK-8028800
- Closed
-
JDK-8030729 Lambda Spec: Always depend on the resolution of capture vars
- Closed