/* * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/* * @test * @bug 4422141 4695338 * @summary TTY: .length field for arrays in print statements in jdb not recognized * TTY: dump <ArrayReference> command not implemented. * @comment converted from test/jdk/com/sun/jdi/ArrayLengthDumpTest.sh * * @library /test/lib * @build ArrayLengthDumpTest * @run main/othervm ArrayLengthDumpTest
*/
class ArrayLengthDumpTarg { staticfinalint [] i = {0,1,2,3,4,5,6};
String [] s = {"zero", "one", "two", "three", "four"};
String [][] t = {s, s, s, s, s, s, s, s, s, s, s}; int length = 5;
privatevoid bar() {
}
privatevoid foo() {
ArrayLengthDumpTarg u[] = { new ArrayLengthDumpTarg(), new ArrayLengthDumpTarg(), new ArrayLengthDumpTarg(), new ArrayLengthDumpTarg(), new ArrayLengthDumpTarg(), new ArrayLengthDumpTarg() }; int k = u.length;
System.out.println(" u.length is: " + k);
k = this.s.length;
System.out.println(" this.s.length is: " + k);
k = this.t.length;
System.out.println(" this.t.length is: " + k);
k = this.t[1].length;
System.out.println("this.t[1].length is: " + k);
k = i.length;
System.out.println(" i.length is: " + k);
bar(); // @1 breakpoint
}
publicstaticvoid main(String[] args) {
ArrayLengthDumpTarg my = new ArrayLengthDumpTarg();
my.foo();
}
}
new OutputAnalyzer(reply.stream().collect(Collectors.joining(lineSeparator))) // Test the fix for 4690242:
.shouldNotContain("No instance field or method with the name length in")
.shouldNotContain("No static field or method with the name length") // Test the fix for 4695338:
.shouldContain("\"zero\", \"one\", \"two\", \"three\", \"four\"");
jdb.contToExit(1);
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.