8020278: NPE in javadoc
Reviewed-by: mcimadamore, vromero
This commit is contained in:
parent
617386d568
commit
9dd2fe90d4
@ -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) {
|
||||
|
13
langtools/test/tools/doclint/BadPackageCommentTest.java
Normal file
13
langtools/test/tools/doclint/BadPackageCommentTest.java
Normal 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;
|
10
langtools/test/tools/doclint/BadPackageCommentTest.out
Normal file
10
langtools/test/tools/doclint/BadPackageCommentTest.out
Normal 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
|
Loading…
x
Reference in New Issue
Block a user