8149842: javadoc incorrectly tries to get the documentation for inherited methods

Reviewed-by: jjg
This commit is contained in:
Kumar Srinivasan 2016-02-17 11:19:07 -08:00
parent 512b3becc6
commit 33dcb43fe9
4 changed files with 126 additions and 9 deletions

View File

@ -705,14 +705,6 @@ public class DocEnv {
return false;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public Boolean defaultAction(Element e, Void p) {
if (includedSet.contains(e) || shouldDocument(e)) {
return true;
}
return false;
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public Boolean visitPackage(PackageElement e, Void p) {
return includedSet.contains(e);
@ -720,7 +712,12 @@ public class DocEnv {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public Boolean visitUnknown(Element e, Void p) {
throw new AssertionError("got element: " + e);
throw new AssertionError("unknown element: " + e);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public Boolean defaultAction(Element e, Void p) {
return visit(e.getEnclosingElement()) && shouldDocument(e);
}
};
}

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8149468
* @summary Verify that non included classes are not inspected.
* @library ../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build JavadocTester
* @run main TestIncluded
*/
public class TestIncluded extends JavadocTester {
public static void main(String... args) throws Exception {
TestIncluded tester = new TestIncluded();
tester.runTests();
}
/*
* The arguments specify only "pkg" but "parent" sources are on the path.
* The class parent.A utilizes a non existent taglet, that will trigger
* an error, if doc comments are inspected.
*/
@Test
void test() {
javadoc("-d", "out",
"-Xdoclint:all",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkFiles(false, "parent/A.html");
}
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package parent;
public class A {
/**
* Does nothing. Uses an non existent taglet {@enoexist no errors please}.
*/
public void method(){}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
/**
* Just a lonesome class.
*/
public class B extends parent.A {
/**
* The main method.
* @param args the aaaaargs
*/
public static void main(String... args) {}
}