Path: blob/master/test/langtools/jdk/javadoc/tool/subpackageIgnore/SubpackageIgnore.java
66646 views
/*1* Copyright (c) 2003, 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 477301326* @summary When hunting subpackages, silently ignore any directory name that27* can't be part of a subpackage.28* @modules jdk.javadoc/jdk.javadoc.internal.tool29*/3031import java.util.Collections;32import java.util.Locale;33import java.util.Set;3435import javax.lang.model.SourceVersion;3637import jdk.javadoc.doclet.Doclet;38import jdk.javadoc.doclet.DocletEnvironment;39import jdk.javadoc.doclet.Reporter;4041public class SubpackageIgnore implements Doclet {4243public static void main(String[] args) {44String[] cmds = new String[] {45"-docletpath",46System.getProperty("test.classes"),47"-doclet",48"SubpackageIgnore",49"-Xwerror",50"-sourcepath",51System.getProperty("test.src", "."),52"-subpackages",53"pkg1"};54if (jdk.javadoc.internal.tool.Main.execute(cmds) != 0)55throw new Error("Javadoc encountered warnings or errors.");56}5758/*59* The world's simplest doclet.60*/61public boolean run(DocletEnvironment root) {62return true;63}6465@Override66public String getName() {67return "Test";68}6970@Override71public Set<Option> getSupportedOptions() {72return Collections.emptySet();73}7475@Override76public SourceVersion getSupportedSourceVersion() {77return SourceVersion.latest();78}7980@Override81public void init(Locale locale, Reporter reporter) {82// do nothing83}84}858687