/* * @test /nodynamiccopyright/ * @bug 8222035 * @summary minimal inference context optimization is forcing resolution with incomplete constraints * @compile/fail/ref=MinContextOpTest_A.out -XDrawDiagnostics -source 15 MinContextOpTest.java * @compile/fail/ref=MinContextOpTest_B.out -XDrawDiagnostics MinContextOpTest.java */ import java.util.Map; import java.util.function.Function; import java.util.stream.Collector; import java.util.stream.Stream; public class MinContextOpTest { abstract class A { abstract static class T { abstract String f(); } abstract Function id(); abstract static class ImmutableMap implements Map {} abstract Collector> toImmutableMap( Function k, Function v); ImmutableMap> test(Stream stream) { return stream.collect(toImmutableMap(T::f, id())); } } }