// Some of these code was submitted in #1384. // https://github.com/typetools/checker-framework/issues/1384 // Other parts are from the following comment. // https://github.com/typetools/checker-framework/pull/1387#issuecomment-316147360 // The rest is from plume-lib. import java.util.Arrays; import java.util.List; import java.util.Queue; public class FalsePositives { static class Partitioning {} public static List> partitionInto(Queue elts, int k) { if (elts.size() < k) { throw new IllegalArgumentException(); } return partitionIntoHelper(elts, Arrays.asList(new Partitioning()), k, 0); } public static List> partitionIntoHelper( Queue elts, List> resultSoFar, int numEmptyParts, int numNonemptyParts) { throw new RuntimeException(); } interface Box {} interface Function { R apply(P p); } interface Utils { Box foo(Box input, Function function); Function bar(Function function); } class Test { Box demo(Utils u, Box bs) { return u.foo(bs, u.bar((String s) -> 5)); } Integer ugh(String n) { return 5; } Box demo2(Utils u, Box bs) { return u.foo(bs, u.bar(this::ugh)); } } abstract class Test2 { abstract Box> foo(Box> p); abstract Box> bar(Function f); abstract String baz(Number p); Box> demo() { return foo(bar(this::baz)); } } }