overload resolution with inexact method reference

anna.kozlova at jetbrains.com anna.kozlova at jetbrains.com
Mon Feb 2 18:16:24 UTC 2015


Hi,

given the code

class Test {
     {
         bar(baz(LinkedHashMap::new));
     }

     <M extends Map<String, Long>> M baz(Supplier< M> mapSupplier) {
         return null;
     }

     void bar(TreeMap<String, Long> t) {}
     void bar(Object o) {}
}

How javac understands that bar(TreeMap<String, Long>) is not 
applicable? Does it calculate the type of baz(LinkedHashMap::new) with 
inference and all that stuff for all overloads?

Thanks,
Anna


More information about the compiler-dev mailing list