Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/tools/javap/4866831/PublicInterfaceTest.java
32285 views
1import java.nio.file.Path;2import java.nio.file.Paths;34/*5* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.7*8* This code is free software; you can redistribute it and/or modify it9* under the terms of the GNU General Public License version 2 only, as10* published by the Free Software Foundation.11*12* This code is distributed in the hope that it will be useful, but WITHOUT13* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or14* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License15* version 2 for more details (a copy is included in the LICENSE file that16* accompanied this code).17*18* You should have received a copy of the GNU General Public License version19* 2 along with this work; if not, write to the Free Software Foundation,20* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.21*22* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA23* or visit www.oracle.com if you need additional information or have any24* questions.25*/2627/*28* @test29* @bug 486683130* @summary Verify that javap marks public interfaces as public31* @library /tools/javac/lib32* @build ToolBox33* @run main PublicInterfaceTest34*/3536//original test: test/tools/javap/PublicInterfaceTest.sh37public class PublicInterfaceTest {38public interface Test {}3940public static void main(String[] args) throws Exception {41// "$JAVAP" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" NotPackagePrivateInterface | grep public42Path pathToClass = Paths.get(System.getProperty("test.classes"),43"PublicInterfaceTest$Test.class");44ToolBox.JavaToolArgs javapParams =45new ToolBox.JavaToolArgs()46.setAllArgs(pathToClass.toString());47if (!ToolBox.javap(javapParams).contains("public"))48throw new AssertionError("The javap output does not contain \"public\"");49}5051}525354