Path: blob/master/test/jdk/com/sun/jdi/EvalArraysAsList.java
41149 views
/*1* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 816002426* @summary jdb returns invalid argument count if first parameter to Arrays.asList is null27* @comment converted from test/jdk/com/sun/jdi/EvalArraysAsList.sh28*29* @library /test/lib30* @build EvalArraysAsList31* @run main/othervm EvalArraysAsList32*/3334import lib.jdb.JdbCommand;35import lib.jdb.JdbTest;3637/*38* The test checks if evaluation of the expression java.util.Arrays.asList(null, "a")39* works normally and does not throw an IllegalArgumentException.40*/41class EvalArraysAsListTarg {42public static void main(String[] args) {43java.util.List<Object> l = java.util.Arrays.asList(null, "a");44System.out.println("java.util.Arrays.asList(null, \"a\") returns: " + l);45return; // @1 breakpoint46}47}484950public class EvalArraysAsList extends JdbTest {51public static void main(String argv[]) {52new EvalArraysAsList().run();53}5455private EvalArraysAsList() {56super(DEBUGGEE_CLASS);57}5859private static final String DEBUGGEE_CLASS = EvalArraysAsListTarg.class.getName();6061@Override62protected void runCases() {63setBreakpointsFromTestSource("EvalArraysAsList.java", 1);64// Run to breakpoint #165jdb.command(JdbCommand.run());6667final String illegalArgumentException = "IllegalArgumentException";6869evalShouldNotContain("java.util.Arrays.asList(null, null)", illegalArgumentException);7071evalShouldNotContain("java.util.Arrays.asList(null, \"a\")", illegalArgumentException);7273evalShouldNotContain("java.util.Arrays.asList(\"a\", null)", illegalArgumentException);7475jdb.contToExit(1);76}7778}798081