test/langtools/jdk/jshell/CompletionSuggestionTest.java
changeset 47268 48ec75306997
parent 47216 71c04702a3d5
child 48931 b25eb74ec283
equal deleted inserted replaced
47267:b3a91921bafc 47268:48ec75306997
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110
    26  * @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110 8177466
    27  * @summary Test Completion and Documentation
    27  * @summary Test Completion and Documentation
    28  * @library /tools/lib
    28  * @library /tools/lib
    29  * @modules jdk.compiler/com.sun.tools.javac.api
    29  * @modules jdk.compiler/com.sun.tools.javac.api
    30  *          jdk.compiler/com.sun.tools.javac.main
    30  *          jdk.compiler/com.sun.tools.javac.main
    31  *          jdk.jdeps/com.sun.tools.javap
    31  *          jdk.jdeps/com.sun.tools.javap
   643         assertCompletion("Baz<String> bz = new Baz<>(|", true, "str");
   643         assertCompletion("Baz<String> bz = new Baz<>(|", true, "str");
   644         assertEval("class Foo { static void m(String str) {} static void m(Baz<String> baz) {} }");
   644         assertEval("class Foo { static void m(String str) {} static void m(Baz<String> baz) {} }");
   645         assertCompletion("Foo.m(new Baz<>(|", true, "str");
   645         assertCompletion("Foo.m(new Baz<>(|", true, "str");
   646     }
   646     }
   647 
   647 
       
   648     public void testIntersection() {
       
   649         assertEval("<Z extends Runnable & CharSequence> Z get() { return null; }");
       
   650         assertEval("var v = get();");
       
   651         assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of());
       
   652         assertCompletion("Runnable r = |", true, "get()", "v");
       
   653         assertCompletion("CharSequence r = |", true, "get()", "v");
       
   654         assertCompletion("Number r = |", true);
       
   655     }
       
   656 
       
   657     public void testAnonymous() {
       
   658         assertEval("var v = new Runnable() { public void run() { } public int length() { return 0; } };");
       
   659         assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of());
       
   660         assertCompletion("Runnable r = |", true, "v");
       
   661         assertCompletion("CharSequence r = |", true);
       
   662     }
       
   663 
   648     @BeforeMethod
   664     @BeforeMethod
   649     public void setUp() {
   665     public void setUp() {
   650         super.setUp();
   666         super.setUp();
   651 
   667 
   652         Path srcZip = Paths.get("src.zip");
   668         Path srcZip = Paths.get("src.zip");