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

ArrayTypeStyle: add support for brackets in method definition after parameters #6301

Closed
rnveach opened this issue Dec 19, 2018 · 3 comments
Closed
Milestone

Comments

@rnveach
Copy link
Member

rnveach commented Dec 19, 2018

https://checkstyle.org/config_misc.html#ArrayTypeStyle

$ cat TestClass.java
class BracketsAfterMethodSignature {
  Object emptyArray()[] {
    return new Object[]{};
  }
}

$ javac BracketsAfterMethodSignature.java
✔

$ cat TestConfig.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<module name="Checker">
    <property name="charset" value="UTF-8"/>

    <module name="TreeWalker">

<module name="ArrayTypeStyle">
  <property name="javaStyle" value="true" />
</module>

<module name="ArrayTypeStyle">
  <property name="javaStyle" value="false" />
</module>

    </module>
</module>

$ java -jar checkstyle-8.15-all.jar -c TestConfig.xml TestClass.java
Starting audit...
Audit done.

There should be a violation to make it possible to enforce method definiton to be written like
Object[] emptyArray() {
vs
Object emptyArray()[] {.

@rnveach
Copy link
Member Author

rnveach commented Feb 16, 2019

Once update is done, stackoverflow question should be updated to say next version of checkstyle will support it.
https://stackoverflow.com/questions/53855343/prohibit-brackets-after-method-signature-in-java-code

esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 16, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 17, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 17, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 17, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 17, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 18, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 19, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 22, 2019
esilkensen added a commit to esilkensen/checkstyle that referenced this issue Feb 22, 2019
@rnveach rnveach added this to the 8.18 milestone Feb 22, 2019
@rnveach
Copy link
Member Author

rnveach commented Feb 22, 2019

Fix was merged and stackoverflow was updated.

@romani
Copy link
Member

romani commented Feb 28, 2019

@rnveach , as in change there is no changes for "api/config" - it should be considered as bug.

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

No branches or pull requests

2 participants