langtools/test/jdk/jshell/VariablesTest.java
changeset 34750 36d62753f5da
parent 33362 65ec6de1d6b4
child 37644 33cf53901cac
equal deleted inserted replaced
34572:4edcff1b9a88 34750:36d62753f5da
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
       
    26  * @bug 8144903
    26  * @summary Tests for EvaluationState.variables
    27  * @summary Tests for EvaluationState.variables
    27  * @build KullaTesting TestingInputStream ExpectedDiagnostic
    28  * @build KullaTesting TestingInputStream ExpectedDiagnostic
    28  * @run testng VariablesTest
    29  * @run testng VariablesTest
    29  */
    30  */
    30 
    31 
   182                 variable("String", "$2"),
   183                 variable("String", "$2"),
   183                 variable("String", "$3"));
   184                 variable("String", "$3"));
   184         assertActiveKeys();
   185         assertActiveKeys();
   185     }
   186     }
   186 
   187 
       
   188     public void variablesTemporaryArrayOfCapturedType() {
       
   189         assertEval("class Test<T> { T[][] get() { return null; } }", added(VALID));
       
   190         assertEval("Test<? extends String> test() { return new Test<>(); }", added(VALID));
       
   191         assertEval("test().get()", added(VALID));
       
   192         assertVariables(variable("String[][]", "$1"));
       
   193         assertEval("\"\".getClass().getEnumConstants()", added(VALID));
       
   194         assertVariables(variable("String[][]", "$1"), variable("String[]", "$2"));
       
   195         assertActiveKeys();
       
   196     }
       
   197 
   187     public void variablesClassReplace() {
   198     public void variablesClassReplace() {
   188         assertEval("import java.util.*;", added(VALID));
   199         assertEval("import java.util.*;", added(VALID));
   189         Snippet var = varKey(assertEval("List<Integer> list = new ArrayList<>();", "[]",
   200         Snippet var = varKey(assertEval("List<Integer> list = new ArrayList<>();", "[]",
   190                 added(VALID)));
   201                 added(VALID)));
   191         assertVariables(variable("List<Integer>", "list"));
   202         assertVariables(variable("List<Integer>", "list"));