提交 ea9bde31 编写于 作者: J jjg

8020278: NPE in javadoc

Reviewed-by: mcimadamore, vromero
上级 02c647df
......@@ -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());
......
......@@ -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) {
......
/*
* @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;
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册