8020278: NPE in javadoc

Reviewed-by: mcimadamore, vromero
This commit is contained in:
Jonathan Gibbons 2013-07-12 13:11:12 -07:00
parent 617386d568
commit 9dd2fe90d4
4 changed files with 32 additions and 1 deletions

View File

@ -327,6 +327,14 @@ public class DocLint implements Plugin {
static abstract class DeclScanner extends TreePathScanner<Void, Void> {
abstract void visitDecl(Tree tree, Name name);
@Override
public Void visitCompilationUnit(CompilationUnitTree tree, Void ignore) {
if (tree.getPackageName() != null) {
visitDecl(tree, null);
}
return super.visitCompilationUnit(tree, ignore);
}
@Override
public Void visitClass(ClassTree tree, Void ignore) {
visitDecl(tree, tree.getSimpleName());

View File

@ -142,7 +142,7 @@ public class Env {
currElement = trees.getElement(currPath);
currOverriddenMethods = ((JavacTypes) types).getOverriddenMethods(currElement);
AccessKind ak = null;
AccessKind ak = AccessKind.PUBLIC;
for (TreePath p = path; p != null; p = p.getParentPath()) {
Element e = trees.getElement(p);
if (e != null && e.getKind() != ElementKind.PACKAGE) {

View File

@ -0,0 +1,13 @@
/*
* @test /nodynamiccopyright/
* @bug 8020278
* @summary NPE in javadoc (bad handling of bad tag in package-info.java)
* @build DocLintTester
* @run main DocLintTester -ref BadPackageCommentTest.out BadPackageCommentTest.java
*/
/**
* abc.
* @@@
*/
package p;

View File

@ -0,0 +1,10 @@
BadPackageCommentTest.java:11: error: no tag name after @
* @@@
^
BadPackageCommentTest.java:11: error: no tag name after @
* @@@
^
BadPackageCommentTest.java:11: error: no tag name after @
* @@@
^
3 errors