Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001a.java
41161 views
1
/*
2
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
// THIS TEST IS LINE NUMBER SENSITIVE
25
26
package nsk.jdwp.ObjectReference.InvokeMethod;
27
28
import nsk.share.*;
29
import nsk.share.jpda.*;
30
import nsk.share.jdwp.*;
31
32
import java.io.*;
33
34
/**
35
* This class represents debuggee part in the test.
36
*/
37
public class invokemeth001a {
38
39
// name of the tested thread
40
public static final String THREAD_NAME = "testedThread";
41
42
// line nunber for breakpoint
43
public static final int BREAKPOINT_LINE_NUMBER = 90;
44
45
// initial and final value of variable changed by the method invoked from debugger
46
public static final int INITIAL_VALUE = 10;
47
public static final int FINAL_VALUE = 1234;
48
49
// scaffold objects
50
private static volatile ArgumentHandler argumentHandler = null;
51
private static volatile Log log = null;
52
53
public static void main(String args[]) {
54
invokemeth001a _invokemeth001a = new invokemeth001a();
55
System.exit(invokemeth001.JCK_STATUS_BASE + _invokemeth001a.runIt(args, System.err));
56
}
57
58
public int runIt(String args[], PrintStream out) {
59
//make log for debugee messages
60
argumentHandler = new ArgumentHandler(args);
61
log = new Log(out, argumentHandler);
62
63
// create tested of tested class
64
log.display("Creating object of tested class");
65
TestedObjectClass.object = new TestedObjectClass();
66
log.display(" ... object created");
67
68
// invoke method with breakpoint
69
TestedObjectClass.run();
70
71
log.display("Debugee PASSED");
72
return invokemeth001.PASSED;
73
}
74
75
// tested object class
76
public static class TestedObjectClass {
77
78
// tested object value
79
public static volatile TestedObjectClass object = null;
80
81
// result of invoking tested mathod
82
public static volatile int result = INITIAL_VALUE;
83
84
// start the thread and suspend on breakpoint
85
public static void run() {
86
log.display("Tested thread: started");
87
88
log.display("Breakpoint line reached");
89
// next line is for breakpoint
90
int foo = 0; // BREAKPOINT_LINE_NUMBER
91
log.display("Breakpoint line passed");
92
93
log.display("Tested thread: finished");
94
}
95
96
// tested method for invokation from debugger
97
public int testedMethod(int arg) {
98
log.display("Tested method invoked with argument:" + arg);
99
int old = result;
100
result = arg;
101
log.display("Tested method returned with result:" + old);
102
return old;
103
}
104
105
}
106
107
}
108
109