1 /*
2  * Copyright (c) 2000, 2017, 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     public static class Test1 implements Serializable {
49         public static class Test2 implements Serializable{
50             private static final long serialVersionUID = 100L;
51         }
52     }
53 
main(String args[])54     public static void main(String args[]) throws Exception {
55         JDKToolLauncher serialver =
56                 JDKToolLauncher.create("serialver")
57                                .addToolArg("-classpath")
58                                .addToolArg(System.getProperty("test.class.path"))
59                                .addToolArg("serialver.NestedTest.Test1.Test2");
60         Process p = ProcessTools.startProcess("serialver",
61                         new ProcessBuilder(serialver.getCommand()));
62         p.waitFor();
63         if (p.exitValue() != 0) {
64             throw new RuntimeException("error occurs in serialver.");
65         }
66     }
67 }
68