Skip to content
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

Checkstyle does not support annotations on array types #4589

Closed
denizarsan opened this issue Jul 2, 2017 · 2 comments
Closed

Checkstyle does not support annotations on array types #4589

denizarsan opened this issue Jul 2, 2017 · 2 comments
Labels
antlr approved bug has bounty issue has some money incentive to fix it, https://www.bountysource.com/teams/checkstyle/issues
Milestone

Comments

@denizarsan
Copy link

denizarsan commented Jul 2, 2017

$ javac C.java

$ cat C.java

@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE)
@interface A {}

class C {
    int i @A [];
}

$ cat config.xml

<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
  <module name="TreeWalker">
    <module name="LineLength"/> <!-- can be any check that requires parsing -->
  </module>
</module>

$ java -jar checkstyle-7.8.2-all.jar -c config.xml C.java

Starting audit...
/tmp/C.java:5:14: unexpected token: [
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Exception was thrown while processing C.java
        at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:295)
        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:213)
        at com.puppycrawl.tools.checkstyle.Main.runCheckstyle(Main.java:425)
        at com.puppycrawl.tools.checkstyle.Main.runCli(Main.java:359)
        at com.puppycrawl.tools.checkstyle.Main.main(Main.java:174)
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: MismatchedTokenException occurred during the analysis of file C.java.
        at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:201)
        at com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:78)
        at com.puppycrawl.tools.checkstyle.Checker.processFile(Checker.java:316)
        at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:286)
        ... 4 more
Caused by: /tmp/C.java:6:1: expecting EOF, found '}'
        at antlr.Parser.match(Parser.java:211)
        at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compilationUnit(GeneratedJavaRecognizer.java:211)
        at com.puppycrawl.tools.checkstyle.TreeWalker.parse(TreeWalker.java:448)
        at com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:179)
        ... 7 more
Checkstyle ends with 1 errors.

Such annotations are supported, at least in javac 1.8.0_131, but Checkstyle crashes.


@rnveach
Copy link
Member

rnveach commented Jul 2, 2017

Is probably the same as #3236

Elscha added a commit to KernelHaven/KernelHaven that referenced this issue Jan 22, 2018
adam-sse added a commit to KernelHaven/IOUtils that referenced this issue Jan 22, 2018
@romani romani added the has bounty issue has some money incentive to fix it, https://www.bountysource.com/teams/checkstyle/issues label Apr 13, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Dec 24, 2019
@romani romani added this to the 8.29 milestone Jan 24, 2020
@romani
Copy link
Member

romani commented Jan 24, 2020

fix is merged, in scope of #7407 PR (#3238)

@esilkensen , please request bounty.

@romani romani closed this as completed Jan 24, 2020
@romani romani added the bug label Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
antlr approved bug has bounty issue has some money incentive to fix it, https://www.bountysource.com/teams/checkstyle/issues
Projects
None yet
Development

No branches or pull requests

3 participants