Path: blob/master/test/langtools/tools/javap/4866831/PublicInterfaceTest.java
41152 views
/*1* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 486683126* @summary Verify that javap marks public interfaces as public27* @library /tools/lib28* @modules jdk.compiler/com.sun.tools.javac.api29* jdk.compiler/com.sun.tools.javac.main30* jdk.jdeps/com.sun.tools.javap31* @build toolbox.ToolBox toolbox.JavapTask32* @run main PublicInterfaceTest33*/3435import java.nio.file.Path;36import java.nio.file.Paths;3738import toolbox.JavapTask;39import toolbox.Task;40import toolbox.ToolBox;4142// Original test: test/tools/javap/PublicInterfaceTest.sh43public class PublicInterfaceTest {44public interface Test {}4546public static void main(String[] args) throws Exception {47ToolBox tb = new ToolBox();4849Path pathToClass = Paths.get(ToolBox.testClasses, "PublicInterfaceTest$Test.class");5051String out = new JavapTask(tb)52.classes(pathToClass.toString())53.run()54.getOutput(Task.OutputKind.DIRECT);5556if (!out.contains("public"))57throw new AssertionError("The javap output does not contain \"public\"");58}5960}616263