146283Sdfr/*
2130803Smarcel * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3130803Smarcel * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
498944Sobrien *
546283Sdfr * This code is free software; you can redistribute it and/or modify it
646283Sdfr * under the terms of the GNU General Public License version 2 only, as
746283Sdfr * published by the Free Software Foundation.
846283Sdfr *
946283Sdfr * This code is distributed in the hope that it will be useful, but WITHOUT
1046283Sdfr * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1146283Sdfr * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1246283Sdfr * version 2 for more details (a copy is included in the LICENSE file that
1398944Sobrien * accompanied this code).
1446283Sdfr *
1598944Sobrien * You should have received a copy of the GNU General Public License version
1698944Sobrien * 2 along with this work; if not, write to the Free Software Foundation,
1798944Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1898944Sobrien *
1946283Sdfr * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2098944Sobrien * or visit www.oracle.com if you need additional information or have any
2198944Sobrien * questions.
2298944Sobrien */
2398944Sobrien
2446283Sdfr/*
2598944Sobrien * @test
2698944Sobrien * @bug 4773013
2798944Sobrien * @summary When hunting subpackages, silently ignore any directory name that
2898944Sobrien *          can't be part of a subpackage.
2946283Sdfr * @modules jdk.javadoc/jdk.javadoc.internal.tool
3046283Sdfr */
3146283Sdfr
3246283Sdfrimport java.util.Collections;
3346283Sdfrimport java.util.Locale;
3446283Sdfrimport java.util.Set;
3546283Sdfr
3646283Sdfrimport javax.lang.model.SourceVersion;
3746283Sdfr
3846283Sdfrimport jdk.javadoc.doclet.Doclet;
3998944Sobrienimport jdk.javadoc.doclet.DocletEnvironment;
40130803Smarcelimport jdk.javadoc.doclet.Reporter;
4146283Sdfr
4246283Sdfrpublic class SubpackageIgnore implements Doclet {
4398944Sobrien
44130803Smarcel    public static void main(String[] args) {
45130803Smarcel        String[] cmds = new String[] {
46130803Smarcel            "-docletpath",
47130803Smarcel            System.getProperty("test.classes"),
4846283Sdfr            "-doclet",
4946283Sdfr            "SubpackageIgnore",
5098944Sobrien            "-Xwerror",
5146283Sdfr            "-sourcepath",
5246283Sdfr            System.getProperty("test.src", "."),
5398944Sobrien            "-subpackages",
5498944Sobrien            "pkg1"};
5598944Sobrien        if (jdk.javadoc.internal.tool.Main.execute(cmds) != 0)
5698944Sobrien            throw new Error("Javadoc encountered warnings or errors.");
5798944Sobrien    }
5898944Sobrien
5946283Sdfr    /*
6046283Sdfr     * The world's simplest doclet.
6146283Sdfr     */
6246283Sdfr    public boolean run(DocletEnvironment root) {
6346283Sdfr        return true;
6446283Sdfr    }
6546283Sdfr
6646283Sdfr    @Override
6746283Sdfr    public String getName() {
6846283Sdfr        return "Test";
6946283Sdfr    }
7046283Sdfr
7146283Sdfr    @Override
7298944Sobrien    public Set<Option> getSupportedOptions() {
7346283Sdfr        return Collections.emptySet();
7446283Sdfr    }
7546283Sdfr
7646283Sdfr    @Override
7746283Sdfr    public SourceVersion getSupportedSourceVersion() {
7846283Sdfr        return SourceVersion.latest();
7946283Sdfr    }
8046283Sdfr
8146283Sdfr    @Override
8246283Sdfr    public void init(Locale locale, Reporter reporter) {
8346283Sdfr        // do nothing
8446283Sdfr    }
8546283Sdfr}
8646283Sdfr