Hello! > I don't see how you can fix it even with a lot of dust of magic stars, > you have only the type information of the return value of > Map.Entry.comparingByValue().reversed() > > but they can no travel backward to Map.Entry.comparingByValue() because you > have no idea of the return type of Map.Entry.comparingByValue() so you don't > know the class that contains the method "reversed".
Theoretically, one may resolve the subsequent call using the upper bound of the (yet unknown) qualifier type. Here it's Comparator<Map.Entry<?K#1,?#V1 extends Comparable<? super ?#V1>>, so it's possible to resolve reversed() with the T = Map.Entry<?K#1,?#V1 extends Comparable<? super ?#V1>> constraint. Then we add type parameters of the qualifier type as inference variables to the inference session. The resulting bounds set looks solvable, but I'm pretty sure there are many cases when it will work badly, so many corner cases need to be handled specifically. A lot of magic dust, yes. With best regards, Tagir Valeev.
