test/tools/javap/4866831/PublicInterfaceTest.java

changeset 1591
dc8b7aa7cef3
parent 0
959103a6100f
equal deleted inserted replaced
1590:011cf7e0a148 1591:dc8b7aa7cef3
1
2 import java.nio.file.Path;
3 import java.nio.file.Paths;
4
5 /*
6 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 *
9 * This code is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 only, as
11 * published by the Free Software Foundation.
12 *
13 * This code is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * version 2 for more details (a copy is included in the LICENSE file that
17 * accompanied this code).
18 *
19 * You should have received a copy of the GNU General Public License version
20 * 2 along with this work; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
24 * or visit www.oracle.com if you need additional information or have any
25 * questions.
26 */
27
28 /*
29 * @test
30 * @bug 4866831
31 * @summary Verify that javap marks public interfaces as public
32 * @library /tools/javac/lib
33 * @build ToolBox
34 * @run main PublicInterfaceTest
35 */
36
37 //original test: test/tools/javap/PublicInterfaceTest.sh
38 public class PublicInterfaceTest {
39 public interface Test {}
40
41 public static void main(String[] args) throws Exception {
42 // "$JAVAP" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" NotPackagePrivateInterface | grep public
43 Path pathToClass = Paths.get(System.getProperty("test.classes"),
44 "PublicInterfaceTest$Test.class");
45 ToolBox.JavaToolArgs javapParams =
46 new ToolBox.JavaToolArgs()
47 .setAllArgs(pathToClass.toString());
48 if (!ToolBox.javap(javapParams).contains("public"))
49 throw new AssertionError("The javap output does not contain \"public\"");
50 }
51
52 }

mercurial