// If conservativeUninferredTypeArguments option is used, then the lines marked // "TODO: Issue 802", will issue a methodref.inference.unimplemented warning. interface Supplier { R supply(); } interface FunctionMR { R apply(T t); } interface Consumer { void consume(T t); } interface BiFunctionMR { R apply(T t, U u); } /** super # instMethod */ // SUPER(ReferenceMode.INVOKE, false), class Super { Object func1(Object o) { return o; } T func2(T o) { return o; } class Sub extends Super { void context() { FunctionMR f1 = super::func1; // TODO: Issue 802: type argument inference FunctionMR f2 = super::func2; // Top level wildcards are ignored when type checking FunctionMR f3 = super::func2; } } } class SuperWithArg { void func1(U o) {} class Sub extends SuperWithArg { void context() { Consumer f1 = super::func1; } } } /** Type # instMethod. */ // UNBOUNDED(ReferenceMode.INVOKE, true), class Unbound { T func1(T o) { return o; } void context() { FunctionMR f1 = String::toString; // TODO: Issue 802: type argument inference BiFunctionMR f2 = Unbound::func1; @SuppressWarnings("nullness:type.argument.type.incompatible") BiFunctionMR f3 = Unbound::func1; } } abstract class UnboundWithArg { abstract U func1(); void context() { // TODO: Issue 802: type argument inference FunctionMR, String> f1 = UnboundWithArg::func1; FunctionMR, String> f2 = UnboundWithArg::func1; // TODO: Issue 802: type argument inference FunctionMR, String> f3 = UnboundWithArg::func1; FunctionMR, String> f4 = UnboundWithArg::func1; } } /** Type # staticMethod. */ // STATIC(ReferenceMode.INVOKE, false), class Static { static T func1(T o) { return o; } void context() { // TODO: Issue 802: type argument inference FunctionMR f1 = Static::func1; FunctionMR f2 = Static::func1; } } /** Expr # instMethod. */ // BOUND(ReferenceMode.INVOKE, false), class Bound { T func1(T o) { return o; } void context(Bound bound) { // TODO: Issue 802: type argument inference FunctionMR f1 = bound::func1; // TODO: Issue 802: type argument inference FunctionMR f2 = this::func1; FunctionMR f3 = this::func1; FunctionMR f4 = this::func1; } } class BoundWithArg { void func1(U param) {} void context(BoundWithArg bound) { Consumer f1 = bound::func1; Consumer f2 = bound::func1; } } /** Inner # new. */ // IMPLICIT_INNER(ReferenceMode.NEW, false), class Outer { void context(Outer other) { Supplier f1 = Inner::new; } class Inner extends Outer {} } class OuterWithArg { void context() { // TODO: Issue 802: type argument inference Supplier> f1 = Inner::new; Supplier> f2 = Inner::new; Supplier> f3 = Inner::new; } class Inner extends OuterWithArg {} } /** Toplevel # new. */ // TOPLEVEL(ReferenceMode.NEW, false), class TopLevel { TopLevel() {} TopLevel(T s) {} void context() { Supplier f1 = TopLevel::new; // TODO: Issue 802: type argument inference FunctionMR f2 = TopLevel::new; FunctionMR f3 = TopLevel::new; } } class TopLevelWithArg { TopLevelWithArg() {} TopLevelWithArg(U s) {} void context() { // TODO: Issue 802: type argument inference Supplier> f1 = TopLevelWithArg::new; Supplier> f2 = TopLevelWithArg::new; FunctionMR> f3 = TopLevelWithArg::new; } } /** ArrayType # new. */ // ARRAY_CTOR(ReferenceMode.NEW, false); class ArrayType { void context() { // TODO: Signedness Checker does not default boxed primitives correctly. // See Issue #797: https://github.com/typetools/checker-framework/issues/797 @SuppressWarnings({"signedness"}) FunctionMR string = String[]::new; FunctionMR clone = String[]::clone; FunctionMR toString = String[]::toString; } }