Path: blob/master/test/langtools/jdk/javadoc/tool/AddOpensTest.java
40957 views
/*1* Copyright (c) 2018, 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 818187826* @summary javadoc should support/ignore --add-opens27* @modules jdk.compiler/com.sun.tools.javac.api28* @modules jdk.compiler/com.sun.tools.javac.main29* @modules jdk.javadoc/jdk.javadoc.internal.api30* @modules jdk.javadoc/jdk.javadoc.internal.tool31* @library /tools/lib32* @build toolbox.JavacTask toolbox.JavadocTask toolbox.TestRunner toolbox.ToolBox33* @run main AddOpensTest34*/3536import java.io.IOException;37import java.nio.charset.StandardCharsets;38import java.nio.file.Path;39import java.nio.file.Paths;4041import toolbox.JavadocTask;42import toolbox.Task;43import toolbox.TestRunner;44import toolbox.ToolBox;4546public class AddOpensTest extends TestRunner {47public static void main(String... args) throws Exception {48AddOpensTest t = new AddOpensTest();49t.runTests();50}5152private final ToolBox tb = new ToolBox();53private final Path src = Paths.get("src");54private final Path api = Paths.get("api");5556AddOpensTest() throws Exception {57super(System.err);58init();59}6061void init() throws IOException {62tb.writeJavaFiles(src, "public class C { }");63}6465@Test66public void testEncoding() {67Task.Result result = new JavadocTask(tb, Task.Mode.EXEC)68.options("-d", api.toString(),69"--add-opens", "some.module")70.files(src.resolve("C.java"))71.run(Task.Expect.SUCCESS)72.writeAll();73}74}75767778