author | sla |
Tue, 29 Oct 2013 08:10:32 +0100 | |
changeset 21371 | 8da9c7389e29 |
child 24973 | 8c4bc3fa4c4e |
permissions | -rw-r--r-- |
21371
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
1 |
/* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
4 |
* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
8 |
* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
13 |
* accompanied this code). |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
14 |
* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
18 |
* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
21 |
* questions. |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
22 |
*/ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
23 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
24 |
/** |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
25 |
* @test |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
26 |
* @summary Test stepping through lambdas |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
27 |
* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
28 |
* @author Staffan Larsen |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
29 |
* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
30 |
* @run build TestScaffold VMConnection TargetListener TargetAdapter |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
31 |
* @run compile -g LambdaStepTest.java |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
32 |
* @run main LambdaStepTest |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
33 |
*/ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
34 |
import com.sun.jdi.LocalVariable; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
35 |
import com.sun.jdi.ObjectReference; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
36 |
import com.sun.jdi.ReferenceType; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
37 |
import com.sun.jdi.StackFrame; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
38 |
import com.sun.jdi.StringReference; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
39 |
import com.sun.jdi.ThreadReference; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
40 |
import com.sun.jdi.event.BreakpointEvent; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
41 |
import com.sun.jdi.event.StepEvent; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
42 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
43 |
/********** target program **********/ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
44 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
45 |
interface DefaultTest { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
46 |
default void defaultMethod() { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
47 |
String from = "default"; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
48 |
System.out.println("Hello from " + from); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
49 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
50 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
51 |
class LambdaStepTestTarg implements DefaultTest { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
52 |
private void test() { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
53 |
String from = "test"; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
54 |
System.out.println("Hello from " + from); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
55 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
56 |
private static void instanceTest() { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
57 |
LambdaStepTestTarg l = new LambdaStepTestTarg(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
58 |
l.test(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
59 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
60 |
private static void lambdaTest() { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
61 |
Runnable r = () -> { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
62 |
String from = "lambda"; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
63 |
System.out.println("Hello from " + from); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
64 |
}; |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
65 |
r.run(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
66 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
67 |
private static void defaultTest() { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
68 |
LambdaStepTestTarg l = new LambdaStepTestTarg(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
69 |
l.defaultMethod(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
70 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
71 |
public static void main(String[] args) { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
72 |
instanceTest(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
73 |
lambdaTest(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
74 |
defaultTest(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
75 |
System.out.println("Goodbye from LambdaStepTestTarg!"); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
76 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
77 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
78 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
79 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
80 |
/********** test program **********/ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
81 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
82 |
public class LambdaStepTest extends TestScaffold { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
83 |
LambdaStepTest (String args[]) { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
84 |
super(args); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
85 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
86 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
87 |
public static void main(String[] args) |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
88 |
throws Exception |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
89 |
{ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
90 |
new LambdaStepTest (args).startTests(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
91 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
92 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
93 |
/********** test core **********/ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
94 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
95 |
protected void runTests() |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
96 |
throws Exception |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
97 |
{ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
98 |
// ## Normal instance method |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
99 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
100 |
BreakpointEvent bpe = startTo("LambdaStepTestTarg", "instanceTest", "()V"); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
101 |
ThreadReference thread = bpe.thread(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
102 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
103 |
// step over allocation |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
104 |
StepEvent se = stepOverLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
105 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
106 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
107 |
// step into test(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
108 |
se = stepIntoLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
109 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
110 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
111 |
// step over variable initialization |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
112 |
se = stepOverLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
113 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
114 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
115 |
// get value of variable "from" |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
116 |
StackFrame frame = se.thread().frame(0); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
117 |
LocalVariable lv = frame.visibleVariableByName("from"); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
118 |
System.out.println(lv); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
119 |
StringReference sr = (StringReference) frame.getValue(lv); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
120 |
if (!sr.value().equals("test")) { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
121 |
throw new Exception("Unexpected variable value in instanceTest: "+sr.value()); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
122 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
123 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
124 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
125 |
// ## Lambda method |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
126 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
127 |
bpe = resumeTo("LambdaStepTestTarg", "lambdaTest", "()V"); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
128 |
thread = bpe.thread(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
129 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
130 |
// step over allocation |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
131 |
se = stepOverLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
132 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
133 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
134 |
// step into run() of the lambda |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
135 |
se = stepIntoLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
136 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
137 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
138 |
// step over variable initialization |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
139 |
se = stepOverLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
140 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
141 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
142 |
// get value of variable "from" |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
143 |
frame = se.thread().frame(0); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
144 |
lv = frame.visibleVariableByName("from"); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
145 |
System.out.println(lv); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
146 |
sr = (StringReference) frame.getValue(lv); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
147 |
if (!sr.value().equals("lambda")) { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
148 |
throw new Exception("Unexpected variable value in lambdaTest: "+sr.value()); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
149 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
150 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
151 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
152 |
// ## Default method |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
153 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
154 |
bpe = resumeTo("LambdaStepTestTarg", "defaultTest", "()V"); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
155 |
thread = bpe.thread(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
156 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
157 |
// step over allocation |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
158 |
se = stepOverLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
159 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
160 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
161 |
// step into defaultMethod() |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
162 |
se = stepIntoLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
163 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
164 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
165 |
// step over variable initialization |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
166 |
se = stepOverLine(thread); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
167 |
System.out.println(se.thread().frame(0)); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
168 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
169 |
// get value of variable "from" |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
170 |
frame = se.thread().frame(0); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
171 |
lv = frame.visibleVariableByName("from"); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
172 |
System.out.println(lv); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
173 |
sr = (StringReference) frame.getValue(lv); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
174 |
if (!sr.value().equals("default")) { |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
175 |
throw new Exception("Unexpected variable value in lambdaTest: "+sr.value()); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
176 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
177 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
178 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
179 |
/* |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
180 |
* resume the target listening for events |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
181 |
*/ |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
182 |
listenUntilVMDisconnect(); |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
183 |
|
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
184 |
} |
8da9c7389e29
8027371: Add JDI tests for breakpointing and stepping in lambda code
sla
parents:
diff
changeset
|
185 |
} |