This was a very tricky one to investigate. It’s still not clear what ‘simplified varargs method invocation’ is referring to but one difference (improvement) I was able to narrow down was that of a more specific and helpful warning that jdk7 adds to certain varargs code as below.
import java.util.Collections; import java.util.List; import java.util.Map; public class BetterVarargsWarnings { static <T> List<T> foo(T... elements) { return null; } static List<Map<String, String>> bar() { Map<String, String> m = Collections.singletonMap("a", "b"); return foo(m, m, m); } }
No comments:
Post a Comment