diff -r b3a91921bafc -r 48ec75306997 test/langtools/jdk/jshell/CompletionSuggestionTest.java --- a/test/langtools/jdk/jshell/CompletionSuggestionTest.java Tue Sep 26 15:08:56 2017 +0530 +++ b/test/langtools/jdk/jshell/CompletionSuggestionTest.java Tue Sep 26 12:52:53 2017 +0100 @@ -23,7 +23,7 @@ /* * @test - * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110 + * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110 8177466 * @summary Test Completion and Documentation * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api @@ -645,6 +645,22 @@ assertCompletion("Foo.m(new Baz<>(|", true, "str"); } + public void testIntersection() { + assertEval(" Z get() { return null; }"); + assertEval("var v = get();"); + assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of()); + assertCompletion("Runnable r = |", true, "get()", "v"); + assertCompletion("CharSequence r = |", true, "get()", "v"); + assertCompletion("Number r = |", true); + } + + public void testAnonymous() { + assertEval("var v = new Runnable() { public void run() { } public int length() { return 0; } };"); + assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of()); + assertCompletion("Runnable r = |", true, "v"); + assertCompletion("CharSequence r = |", true); + } + @BeforeMethod public void setUp() { super.setUp();