2
|
1 |
#!/bin/sh
|
|
2 |
|
|
3 |
#
|
|
4 |
# Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
|
|
5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
6 |
#
|
|
7 |
# This code is free software; you can redistribute it and/or modify it
|
|
8 |
# under the terms of the GNU General Public License version 2 only, as
|
|
9 |
# published by the Free Software Foundation.
|
|
10 |
#
|
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
# accompanied this code).
|
|
16 |
#
|
|
17 |
# You should have received a copy of the GNU General Public License version
|
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
#
|
|
21 |
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
22 |
# CA 95054 USA or visit www.sun.com if you need additional information or
|
|
23 |
# have any questions.
|
|
24 |
#
|
|
25 |
|
|
26 |
#
|
|
27 |
# @test
|
|
28 |
# @bug 4422141 4695338
|
|
29 |
# @summary TTY: .length field for arrays in print statements in jdb not recognized
|
|
30 |
# TTY: dump <ArrayReference> command not implemented.
|
|
31 |
# @author Tim Bell
|
|
32 |
#
|
|
33 |
# @run shell ArrayLengthDumpTest.sh
|
|
34 |
#
|
|
35 |
classname=ArrayLengthDumpTarg
|
|
36 |
|
|
37 |
createJavaFile()
|
|
38 |
{
|
|
39 |
cat <<EOF > $classname.java.1
|
|
40 |
class $classname {
|
|
41 |
static final int [] i = {0,1,2,3,4,5,6};
|
|
42 |
String [] s = {"zero", "one", "two", "three", "four"};
|
|
43 |
String [][] t = {s, s, s, s, s, s, s, s, s, s, s};
|
|
44 |
int length = 5;
|
|
45 |
|
|
46 |
public void bar() {
|
|
47 |
}
|
|
48 |
|
|
49 |
public void foo() {
|
|
50 |
ArrayLengthDumpTarg u[] = { new ArrayLengthDumpTarg(),
|
|
51 |
new ArrayLengthDumpTarg(),
|
|
52 |
new ArrayLengthDumpTarg(),
|
|
53 |
new ArrayLengthDumpTarg(),
|
|
54 |
new ArrayLengthDumpTarg(),
|
|
55 |
new ArrayLengthDumpTarg() };
|
|
56 |
int k = u.length;
|
|
57 |
System.out.println(" u.length is: " + k);
|
|
58 |
k = this.s.length;
|
|
59 |
System.out.println(" this.s.length is: " + k);
|
|
60 |
k = this.t.length;
|
|
61 |
System.out.println(" this.t.length is: " + k);
|
|
62 |
k = this.t[1].length;
|
|
63 |
System.out.println("this.t[1].length is: " + k);
|
|
64 |
k = i.length;
|
|
65 |
System.out.println(" i.length is: " + k);
|
|
66 |
bar(); // @1 breakpoint
|
|
67 |
}
|
|
68 |
|
|
69 |
public static void main(String[] args) {
|
|
70 |
ArrayLengthDumpTarg my = new ArrayLengthDumpTarg();
|
|
71 |
my.foo();
|
|
72 |
}
|
|
73 |
}
|
|
74 |
EOF
|
|
75 |
}
|
|
76 |
|
|
77 |
# This is called to feed cmds to jdb.
|
|
78 |
dojdbCmds()
|
|
79 |
{
|
|
80 |
setBkpts @1
|
|
81 |
runToBkpt @1
|
|
82 |
cmd dump this
|
|
83 |
cmd dump this.s.length
|
|
84 |
cmd dump this.s
|
|
85 |
cmd dump this.t.length
|
|
86 |
cmd dump this.t[1].length
|
|
87 |
cmd dump ArrayLengthDumpTarg.i.length
|
|
88 |
cmd dump this.length
|
|
89 |
cmd cont
|
|
90 |
}
|
|
91 |
|
|
92 |
mysetup()
|
|
93 |
{
|
|
94 |
if [ -z "$TESTSRC" ] ; then
|
|
95 |
TESTSRC=.
|
|
96 |
fi
|
|
97 |
|
|
98 |
for ii in . $TESTSRC $TESTSRC/.. ; do
|
|
99 |
if [ -r "$ii/ShellScaffold.sh" ] ; then
|
|
100 |
. $ii/ShellScaffold.sh
|
|
101 |
break
|
|
102 |
fi
|
|
103 |
done
|
|
104 |
}
|
|
105 |
|
|
106 |
|
|
107 |
# You could replace this next line with the contents
|
|
108 |
# of ShellScaffold.sh and this script will run just the same.
|
|
109 |
mysetup
|
|
110 |
|
|
111 |
runit
|
|
112 |
#
|
|
113 |
# Test the fix for 4690242:
|
|
114 |
#
|
|
115 |
jdbFailIfPresent "No instance field or method with the name length in" 50
|
|
116 |
jdbFailIfPresent "No static field or method with the name length" 50
|
|
117 |
#
|
|
118 |
# Test the fix for 4695338:
|
|
119 |
#
|
|
120 |
jdbFailIfNotPresent "\"zero\", \"one\", \"two\", \"three\", \"four\"" 50
|
|
121 |
pass
|