Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/com/sun/jdi/EvalArraysAsList.sh
38855 views
#!/bin/sh1#2# Copyright (c) 2016, 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 it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 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 USA20# or visit www.oracle.com if you need additional information or have any21# questions.22#2324# @test25# @bug 816002426# @summary jdb returns invalid argument count if first parameter to Arrays.asList is null27#28# @run shell/timeout=300 EvalArraysAsList.sh29#30# The test checks if evaluation of the expression java.util.Arrays.asList(null, "a")31# works normally and does not throw an IllegalArgumentException.3233classname=EvalArraysAsList3435createJavaFile()36{37cat <<EOF > $classname.java.138public class $classname {39public static void main(String[] args) {40java.util.List<Object> l = java.util.Arrays.asList(null, "a");41System.out.println("java.util.Arrays.asList(null, \\"a\\") returns: " + l);42return; // @1 breakpoint43}44}45EOF46}4748# drive jdb by sending cmds to it and examining its output49dojdbCmds()50{51setBkpts @152runToBkpt @15354cmd eval "java.util.Arrays.asList(null, null)"55jdbFailIfPresent "IllegalArgumentException" 35657cmd eval "java.util.Arrays.asList(null, \"a\")"58jdbFailIfPresent "IllegalArgumentException" 35960cmd eval "java.util.Arrays.asList(\"a\", null)"61jdbFailIfPresent "IllegalArgumentException" 362}636465mysetup()66{67if [ -z "$TESTSRC" ] ; then68TESTSRC=.69fi7071for ii in . $TESTSRC $TESTSRC/.. ; do72if [ -r "$ii/ShellScaffold.sh" ] ; then73. $ii/ShellScaffold.sh74break75fi76done77}7879# You could replace this next line with the contents80# of ShellScaffold.sh and this script will run just the same.81mysetup8283runit84pass858687