New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnnotationUtility.getAnnotation fails when there is an comment in the annotation #5327

rnveach opened this Issue Dec 6, 2017 · 1 comment


None yet
2 participants

rnveach commented Dec 6, 2017

Identified when working on #4983 , example code:

     * @Deprecated this is not the same
    protected InputMissingDeprecatedBadJavadoc() {


printing the AST shows the following:

    |--CTOR_DEF -> CTOR_DEF [5:4]
    |  |--MODIFIERS -> MODIFIERS [5:4]
    |  |  |--ANNOTATION -> ANNOTATION [5:4]
    |  |  |  |--BLOCK_COMMENT_BEGIN -> /* [2:4]
    |  |  |  |  |--COMMENT_CONTENT -> *\n    * @Deprecated this is not the same\n      [2:6]
    |  |  |  |  `--BLOCK_COMMENT_END -> */ [4:5]
    |  |  |  |--AT -> @ [5:4]
    |  |  |  `--IDENT -> Deprecated [5:5]
    |  |  `--LITERAL_PROTECTED -> protected [6:4]

The first child of the annotation is the BLOCK_COMMENT_BEGIN but this messes up the utility as it is thinking the first child is the AT token.
This causes the utility to not find the @Deprecated annotation and return it doesn't exist.

This is not an issue with MissingDeprecatedCheck right now because it is not comment aware, but it is breaking the rules by getting the comment/javadoc of what it is examining. The rewrite is turning it into a comment aware check which is why it is showing up now.

rnveach added a commit to rnveach/checkstyle that referenced this issue Dec 6, 2017

rnveach added a commit to rnveach/checkstyle that referenced this issue Dec 6, 2017

romani added a commit that referenced this issue Dec 8, 2017

@romani romani added this to the 8.6 milestone Dec 8, 2017


This comment has been minimized.

Show comment
Hide comment

romani Dec 8, 2017


fix is merged


romani commented Dec 8, 2017

fix is merged

@romani romani closed this Dec 8, 2017

timurt added a commit to timurt/checkstyle that referenced this issue Dec 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment