Can't rely on target typing when chaining methods
generics, java, java-8, typing
Solution
The problem is fixed with build 129 (but appears until build 128).
Problem
In Java 8, type inference has been extended to target typing which enables to write: ``` Comparator<String> ascending = comparingInt(String::length); ``` without having to use a type witness (`Comparator.<String> comparingInt`). However the last statement below does not compile. Is there a reason? Is there a 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 ```