test/langtools/jdk/jshell/DropTest.java
changeset 55156 1c291d1c272c
parent 47216 71c04702a3d5
equal deleted inserted replaced
55155:4ffd6a955e92 55156:1c291d1c272c
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8081431 8080069 8167128
    26  * @bug 8081431 8080069 8167128 8199623
    27  * @summary Test of JShell#drop().
    27  * @summary Test of JShell#drop().
    28  * @build KullaTesting TestingInputStream
    28  * @build KullaTesting TestingInputStream
    29  * @run testng DropTest
    29  * @run testng DropTest
    30  */
    30  */
    31 
    31 
    32 import jdk.jshell.DeclarationSnippet;
    32 import jdk.jshell.DeclarationSnippet;
    33 import jdk.jshell.Snippet;
    33 import jdk.jshell.Snippet;
       
    34 import jdk.jshell.MethodSnippet;
    34 import jdk.jshell.VarSnippet;
    35 import jdk.jshell.VarSnippet;
    35 import org.testng.annotations.Test;
    36 import org.testng.annotations.Test;
    36 
    37 
    37 import static jdk.jshell.Snippet.Status.*;
    38 import static jdk.jshell.Snippet.Status.*;
    38 
    39 
   223                 ste(ax, VALID, OVERWRITTEN, false, MAIN_SNIPPET)));
   224                 ste(ax, VALID, OVERWRITTEN, false, MAIN_SNIPPET)));
   224         assertEval(as1,
   225         assertEval(as1,
   225                 ste(MAIN_SNIPPET, VALID, VALID, true, null),
   226                 ste(MAIN_SNIPPET, VALID, VALID, true, null),
   226                 ste(ax, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
   227                 ste(ax, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
   227     }
   228     }
       
   229 
       
   230     // 8199623
       
   231     public void testTwoForkedDrop() {
       
   232         MethodSnippet p = methodKey(assertEval("void p() throws Exception { ((String) null).toString(); }"));
       
   233         MethodSnippet n = methodKey(assertEval("void n() throws Exception { try { p(); } catch (Exception ex) { throw new RuntimeException(\"bar\", ex); }}"));
       
   234         MethodSnippet m = methodKey(assertEval("void m() { try { n(); } catch (Exception ex) { throw new RuntimeException(\"foo\", ex); }}"));
       
   235         MethodSnippet c = methodKey(assertEval("void c() throws Throwable { p(); }"));
       
   236         assertDrop(p,
       
   237                 ste(p, VALID, DROPPED, true, null),
       
   238                 ste(n, VALID, RECOVERABLE_DEFINED, false, p),
       
   239                 ste(c, VALID, RECOVERABLE_DEFINED, false, p));
       
   240         assertActiveKeys();
       
   241     }
   228 }
   242 }