1/* 2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24/* 25 * @test 26 * @bug 4773013 27 * @summary When hunting subpackages, silently ignore any directory name that 28 * can't be part of a subpackage. 29 * @modules jdk.javadoc/jdk.javadoc.internal.tool 30 */ 31 32import java.util.Collections; 33import java.util.Locale; 34import java.util.Set; 35 36import javax.lang.model.SourceVersion; 37 38import jdk.javadoc.doclet.Doclet; 39import jdk.javadoc.doclet.DocletEnvironment; 40import jdk.javadoc.doclet.Reporter; 41 42public class SubpackageIgnore implements Doclet { 43 44 public static void main(String[] args) { 45 String[] cmds = new String[] { 46 "-docletpath", 47 System.getProperty("test.classes"), 48 "-doclet", 49 "SubpackageIgnore", 50 "-Xwerror", 51 "-sourcepath", 52 System.getProperty("test.src", "."), 53 "-subpackages", 54 "pkg1"}; 55 if (jdk.javadoc.internal.tool.Main.execute(cmds) != 0) 56 throw new Error("Javadoc encountered warnings or errors."); 57 } 58 59 /* 60 * The world's simplest doclet. 61 */ 62 public boolean run(DocletEnvironment root) { 63 return true; 64 } 65 66 @Override 67 public String getName() { 68 return "Test"; 69 } 70 71 @Override 72 public Set<Option> getSupportedOptions() { 73 return Collections.emptySet(); 74 } 75 76 @Override 77 public SourceVersion getSupportedSourceVersion() { 78 return SourceVersion.latest(); 79 } 80 81 @Override 82 public void init(Locale locale, Reporter reporter) { 83 // do nothing 84 } 85} 86