1 /*
2  * Copyright (c) 2000, 2019, 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 it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 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 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 /*
25  * @test
26  * @bug 4312217 4785473
27  * @library /test/lib
28  * @build jdk.test.lib.Utils
29  *        jdk.test.lib.Asserts
30  *        jdk.test.lib.JDKToolFinder
31  *        jdk.test.lib.JDKToolLauncher
32  *        jdk.test.lib.Platform
33  *        jdk.test.lib.process.*
34  * @build NestedTest
35  * @run main serialver.NestedTest
36  * @summary  To test the use of nested class specification using the '.'
37  *           notation instead of the '$' notation.
38  */
39 
40 package serialver;
41 
42 import java.io.Serializable;
43 
44 import jdk.test.lib.JDKToolLauncher;
45 import jdk.test.lib.process.ProcessTools;
46 
47 public class NestedTest implements Serializable {
48     private static final long serialVersionUID = 1L;
49 
50     public static class Test1 implements Serializable {
51         private static final long serialVersionUID = 1L;
52 
53         public static class Test2 implements Serializable{
54             private static final long serialVersionUID = 100L;
55         }
56     }
57 
main(String args[])58     public static void main(String args[]) throws Exception {
59         JDKToolLauncher serialver =
60                 JDKToolLauncher.create("serialver")
61                                .addToolArg("-classpath")
62                                .addToolArg(System.getProperty("test.class.path"))
63                                .addToolArg("serialver.NestedTest.Test1.Test2");
64         Process p = ProcessTools.startProcess("serialver",
65                         new ProcessBuilder(serialver.getCommand()));
66         p.waitFor();
67         if (p.exitValue() != 0) {
68             throw new RuntimeException("error occurs in serialver.");
69         }
70     }
71 }
72