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

whitespace after Array type when using a type annotation #3300

Closed
ctolkmit opened this Issue Jun 23, 2016 · 10 comments

Comments

Projects
None yet
5 participants
@ctolkmit

ctolkmit commented Jun 23, 2016

My Method has the following signature:

public void setKeystorePassword(final char @NonNull [] aKeyStorePassword) ;

Checkstyle now complains about "NoWhitespaceAfter" and "'char' is followed by whitespace.".

Sadly, I think char@NonNull[] reads terribly ;) However, the meaning of @NonNull char[] something is different from char @NonNull [] something (the first meaning even is stupid, because a char cannot hold null values, whereas the array can.)

I don't see a good method to allow configuration in this case. Is this case somehow missing?

/var/tmp $ java -jar checkstyle-7.0-all.jar -c my_check.xml TestClass.java 
Starting audit...
[ERROR] /var/tmp/TestClass.java:2:29: 'char' is followed by whitespace. [NoWhitespaceAfter]
Audit done.
Checkstyle ends with 1 errors.

/var/tmp $ cat TestClass.java 
public class TestClass {
  public void foo(final char @NonNull [] param) { }
}

/var/tmp $ cat my_check.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">
    <module name="TreeWalker">
        <module name="NoWhitespaceAfter"/>
    </module>
</module>

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Jun 27, 2016

Member

Annotations in the middle should be ignored.

Member

romani commented Jun 27, 2016

Annotations in the middle should be ignored.

@ctolkmit

This comment has been minimized.

Show comment
Hide comment
@ctolkmit

ctolkmit Jun 27, 2016

I just saw that you updated the issue already. So I will just look at the Test that fails in my build on my (german) machine.

ctolkmit commented Jun 27, 2016

I just saw that you updated the issue already. So I will just look at the Test that fails in my build on my (german) machine.

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Jun 27, 2016

Member

please share logs and commands at our mail-list (as problem is unrelated)

Member

romani commented Jun 27, 2016

please share logs and commands at our mail-list (as problem is unrelated)

@Vladlis

This comment has been minimized.

Show comment
Hide comment
@Vladlis

Vladlis Aug 31, 2017

Member

@sergileon Please help us with this issue

Member

Vladlis commented Aug 31, 2017

@sergileon Please help us with this issue

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Sep 1, 2017

Member

@Vladlis , I added @sergileon to collaborators, as he confirm proposal you can assign issue on him, to avoid conflicts in issue resolving.

Member

romani commented Sep 1, 2017

@Vladlis , I added @sergileon to collaborators, as he confirm proposal you can assign issue on him, to avoid conflicts in issue resolving.

@sergileon

This comment has been minimized.

Show comment
Hide comment
@sergileon

sergileon Sep 1, 2017

Contributor

I am on it

Contributor

sergileon commented Sep 1, 2017

I am on it

@sergileon

This comment has been minimized.

Show comment
Hide comment
@sergileon

sergileon Sep 4, 2017

Contributor

@romani , What did you mean by saying 'Annotations in the middle should be ignored.'?

Contributor

sergileon commented Sep 4, 2017

@romani , What did you mean by saying 'Annotations in the middle should be ignored.'?

@sergileon

This comment has been minimized.

Show comment
Hide comment
@sergileon

sergileon Sep 4, 2017

Contributor

@romani , I think char @NonNull[] something will be correct for module NoWhitespaceAfter, because it is right for documentation the class: The check processes ARRAY_DECLARATOR and INDEX_OP tokens specially from other tokens. Actually it is checked that there is no whitespace before this tokens, not after them.

Contributor

sergileon commented Sep 4, 2017

@romani , I think char @NonNull[] something will be correct for module NoWhitespaceAfter, because it is right for documentation the class: The check processes ARRAY_DECLARATOR and INDEX_OP tokens specially from other tokens. Actually it is checked that there is no whitespace before this tokens, not after them.

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Sep 4, 2017

Member

What did you mean by saying 'Annotations in the middle should be ignored.'?

in the middle of char and [].
public void setKeystorePassword(final char @NonNull [] aKeyStorePassword) ; - should produce no violations

I think char @NonNull[] something will be correct for module NoWhitespaceAfter

yes, it should produce no violations.

Member

romani commented Sep 4, 2017

What did you mean by saying 'Annotations in the middle should be ignored.'?

in the middle of char and [].
public void setKeystorePassword(final char @NonNull [] aKeyStorePassword) ; - should produce no violations

I think char @NonNull[] something will be correct for module NoWhitespaceAfter

yes, it should produce no violations.

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 5, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 6, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 6, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 6, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 6, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 7, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 7, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 8, 2017

sergileon added a commit to sergileon/checkstyle that referenced this issue Sep 12, 2017

romani added a commit that referenced this issue Sep 12, 2017

@romani romani added this to the 8.3 milestone Sep 12, 2017

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Sep 12, 2017

Member

Fix is merged

Member

romani commented Sep 12, 2017

Fix is merged

@romani romani closed this Sep 12, 2017

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