From eeee00819be1c526aaa6ac0d4fa2259842973b22 Mon Sep 17 00:00:00 2001 From: Oliver Burn Date: Thu, 4 Mar 2010 10:57:55 +0000 Subject: [PATCH] Fixed JavadocStyle not handling package declarations that have annotations.(bug #2911363) --- .../tools/checkstyle/checks/javadoc/JavadocStyleCheck.java | 5 ++++- src/xdocs/releasenotes.xml | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java index 3553454c5..1ce73a42d 100755 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java @@ -116,8 +116,11 @@ public class JavadocStyleCheck { if (shouldCheck(aAST)) { final FileContents contents = getFileContents(); + // Need to start searching for the comment before the annotations + // that may exist. Even if annotations are not defined on the + // package, the ANNOTATIONS AST is defined. final TextBlock cmt = - contents.getJavadocBefore(aAST.getLineNo()); + contents.getJavadocBefore(aAST.getFirstChild().getLineNo()); checkComment(aAST, cmt); } diff --git a/src/xdocs/releasenotes.xml b/src/xdocs/releasenotes.xml index a1ae9ecb4..a1facaecf 100755 --- a/src/xdocs/releasenotes.xml +++ b/src/xdocs/releasenotes.xml @@ -25,6 +25,11 @@ to have the sort behaviour as in release 5.0. (bug #2952881). Thanks to Steve McKay for patch #2953936. +
  • + Fixed JavadocStyle + not handling package declarations that have annotations. + (bug #2911363) +
  • Notes: