SubpackageIgnore.java revision 3233:b5d08bc0d224
1129468Sru/*
2129468Sru * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
3147647Shmp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4137872Srwatson *
5137872Srwatson * This code is free software; you can redistribute it and/or modify it
6129468Sru * under the terms of the GNU General Public License version 2 only, as
7137872Srwatson * published by the Free Software Foundation.
8129468Sru *
9129468Sru * This code is distributed in the hope that it will be useful, but WITHOUT
10129468Sru * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11129468Sru * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12129468Sru * version 2 for more details (a copy is included in the LICENSE file that
13129468Sru * accompanied this code).
14129468Sru *
15129468Sru * You should have received a copy of the GNU General Public License version
16129468Sru * 2 along with this work; if not, write to the Free Software Foundation,
17129468Sru * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18129468Sru *
19129468Sru * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20129468Sru * or visit www.oracle.com if you need additional information or have any
21129468Sru * questions.
22129468Sru */
23175253Smaxim
24129468Sru/*
25129468Sru * @test
26129468Sru * @bug 4773013
27129468Sru * @summary When hunting subpackages, silently ignore any directory name that
28129468Sru *          can't be part of a subpackage.
29129468Sru * @ignore API modifications
30129468Sru * @modules jdk.javadoc
31129468Sru */
32129468Sru
33129468Sruimport java.util.Collections;
34129468Sruimport java.util.Set;
35129468Sru
36129468Sruimport javax.lang.model.SourceVersion;
37129468Sru
38129468Sruimport jdk.javadoc.doclet.Doclet;
39129468Sruimport jdk.javadoc.doclet.DocletEnvironment;
40129468Sru
41129468Srupublic class SubpackageIgnore implements Doclet {
42129468Sru
43129468Sru    public static void main(String[] args) {
44129468Sru        if (jdk.javadoc.internal.tool.Main.execute(
45129468Sru                "javadoc",
46129468Sru                "SubpackageIgnore",
47129468Sru                SubpackageIgnore.class.getClassLoader(),
48129468Sru                new String[] {"-Xwerror",
49129468Sru                              "-sourcepath",
50129468Sru                              System.getProperty("test.src", "."),
51129468Sru                              "-subpackages",
52129468Sru                              "pkg1"}) != 0)
53129468Sru            throw new Error("Javadoc encountered warnings or errors.");
54129468Sru    }
55129468Sru
56129468Sru    /*
57129468Sru     * The world's simplest doclet.
58129468Sru     */
59129468Sru    public boolean run(DocletEnvironment root) {
60129468Sru        return true;
61129468Sru    }
62137872Srwatson
63137872Srwatson    @Override
64137872Srwatson    public String getName() {
65137872Srwatson        return "Test";
66137872Srwatson    }
67137872Srwatson
68137872Srwatson    @Override
69137953Srwatson    public Set<Option> getSupportedOptions() {
70137872Srwatson        return Collections.emptySet();
71137872Srwatson    }
72175247Smaxim
73175247Smaxim    @Override
74137872Srwatson    public SourceVersion getSupportedSourceVersion() {
75137872Srwatson        return SourceVersion.latest();
76137872Srwatson    }
77137872Srwatson}
78137872Srwatson