@SuppressWarnings("") public class Issue2717 { interface Tree {} interface ExpressionTree extends Tree {} interface BinaryTree extends ExpressionTree {} interface Matcher {} public static void test(Matcher m) {} public static void caller() { test(toType(BinaryTree.class, Issue2717.allOf())); } public static Matcher allOf() { return null; } public static Matcher toType( Class type, Matcher matcher) { return null; } }