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

Comments

Projects
None yet
2 participants
@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()[] {.

@romani romani added the approved label Dec 20, 2018

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 16, 2019

@rnveach

This comment has been minimized.

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 added a commit that referenced this issue Feb 22, 2019

@rnveach rnveach added the new feature label Feb 22, 2019

@rnveach rnveach added this to the 8.18 milestone Feb 22, 2019

@rnveach

This comment has been minimized.

Copy link
Member Author

rnveach commented Feb 22, 2019

Fix was merged and stackoverflow was updated.

@rnveach rnveach closed this Feb 22, 2019

@romani romani added bug approved and removed approved new feature labels Feb 28, 2019

@romani

This comment has been minimized.

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
You can’t perform that action at this time.