test/jdk/com/sun/jdi/UnpreparedByName.java
changeset 49009 1ecb986334cb
parent 47216 71c04702a3d5
equal deleted inserted replaced
49008:d777541fceba 49009:1ecb986334cb
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
     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.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    26  * @bug 4368402
    26  * @bug 4368402
    27  * @summary UnpreparedByName verifies that unprepared classes
    27  * @summary UnpreparedByName verifies that unprepared classes
    28  * won't be returned by classesByName.
    28  * won't be returned by classesByName.
    29  * @author Robert Field
    29  * @author Robert Field
    30  *
    30  *
    31  * @run build JDIScaffold VMConnection
    31  * @run build TestScaffold VMConnection
    32  * @run compile -g InnerTarg.java
    32  * @run compile -g InnerTarg.java
    33  * @run build UnpreparedByName
    33  * @run build UnpreparedByName
    34  *
    34  *
    35  * @run driver UnpreparedByName InnerTarg
    35  * @run driver UnpreparedByName InnerTarg
    36  */
    36  */
    39 import com.sun.jdi.request.*;
    39 import com.sun.jdi.request.*;
    40 
    40 
    41 import java.util.List;
    41 import java.util.List;
    42 import java.util.Iterator;
    42 import java.util.Iterator;
    43 
    43 
    44 public class UnpreparedByName extends JDIScaffold {
    44 public class UnpreparedByName extends TestScaffold {
    45     final String[] args;
       
    46 
    45 
    47     public static void main(String args[]) throws Exception {
    46     public static void main(String args[]) throws Exception {
    48         new UnpreparedByName(args).startTests();
    47         new UnpreparedByName(args).startTests();
    49     }
    48     }
    50 
    49 
    51     UnpreparedByName(String args[]) throws Exception {
    50     UnpreparedByName(String args[]) throws Exception {
    52         super();
    51         super(args);
    53         this.args = args;
       
    54     }
    52     }
    55 
    53 
    56     protected void runTests() throws Exception {
    54     protected void runTests() throws Exception {
    57         connect(args);
    55         startTo("InnerTarg", "go", "()V");
    58         waitForVMStart();
       
    59         resumeTo("InnerTarg", "go", "()V");
       
    60 
    56 
    61         List classes = vm().classesByName("InnerTarg$TheInner");
    57         List classes = vm().classesByName("InnerTarg$TheInner");
    62         if (classes.size() == 0) {
    58         if (classes.size() == 0) {
    63             System.out.println("PASS: InnerTarg$TheInner not returned");
    59             System.out.println("PASS: InnerTarg$TheInner not returned");
    64         } else {
    60         } else {
    73                 throw new Exception("Inner class not prepared: " + cls);
    69                 throw new Exception("Inner class not prepared: " + cls);
    74             }
    70             }
    75         }
    71         }
    76 
    72 
    77         // Allow application to complete
    73         // Allow application to complete
    78         resumeToVMDeath();
    74         resumeToVMDisconnect();
    79     }
    75     }
    80 }
    76 }