Cannot rely on the job when typing labels

In Java 8, type inference has been expanded to target input , which allows you to write:

Comparator<String> ascending = comparingInt(String::length); 

without using a witness of type ( Comparator.<String> comparingInt ). However, the last expression below does not compile. Is there a reason? Is there any workaround?

 Comparator<String> ascending = comparingInt(String::length); //ok Comparator<String> descending = ascending.reversed(); //ok Comparator<String> descending = reverseOrder(comparingInt(String::length)); //ok Comparator<String> descending = Comparator.<String>comparingInt(String::length) .reversed(); //ok Comparator<String> descending = comparingInt(String::length).reversed(); //error 
+4
java generics java-8 typing
Feb 13 '14 at 10:41
source share
1 answer

The issue is fixed using build 129 (but appears before build 128).

+4
Feb 13 '14 at 12:16
source share



All Articles