False positive with GenericWhitespace - Array #47

Closed
romani opened this Issue Nov 5, 2013 · 3 comments

Projects

None yet

2 participants

@romani
Member
romani commented Nov 5, 2013

Created: 2010-08-04
Creator: markt_asf
SF issue: 617

http://checkstyle.sourceforge.net/config_whitespace.html#GenericWhitespace
The following line incorrectly triggers an error with the GenericWhitespace module

private HashMap<String, Class<?>[]> classCache;

Found when using checkstyle with Apache Tomcat. Specifically:
http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java

Second case, warning "Generic Whitespace: '>' is followed by whitespace.":

ListResult<String> result = new ListResult<String>(Collections.<String> emptyList());
@isopov isopov added a commit to isopov/checkstyle that referenced this issue Jun 30, 2014
@isopov isopov fix for #47 d07e82b
@coveralls coveralls referenced this issue Jun 30, 2014
Merged

fix for #47 #162

@isopov
isopov commented Jul 1, 2014

About the second case:

  1. There is specific comment in the checkstyle source that this exact case should be reported:
    https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.java#L89
  2. I use this check to catch files that were not autoformatted. And autoformatter preferences for IDEA at my work (slightly modified defaults) remove this space if it is added.

So should we change the second case at all?

@romani
Member
romani commented Jul 2, 2014

Hi @isopov , thanks for investigation, after attentive look at this case :

ListResult<String> result = new ListResult<String>(Collections.<String> emptyList());

I do not think it is good idea to have space at this place. With space it looks like type of some new form of method reference/call.

I am voting for ignoring that request (to have a space after ">") and fix the issue.

@isopov isopov added a commit to isopov/checkstyle that referenced this issue Jul 2, 2014
@isopov isopov fix for #47 dcd4e91
@isopov
isopov commented Jul 2, 2014

Done.

@isopov isopov closed this Jul 2, 2014
@mkordas mkordas added a commit to mkordas/checkstyle that referenced this issue Dec 14, 2014
@mkordas mkordas Partial fix for #47 - Add missing @Override annotations 6a6af7e
@mkordas mkordas added a commit to mkordas/checkstyle that referenced this issue Dec 14, 2014
@mkordas mkordas Partial fix for #47 - Add missing @Override annotations 76efe64
@mkordas mkordas added a commit to mkordas/checkstyle that referenced this issue Dec 14, 2014
@mkordas mkordas Partial fix for #47 - Reformat of pom.xml to delete tab characters an…
…d correct indentation
08a3230
@romani romani added a commit that referenced this issue Dec 15, 2014
@mkordas mkordas Partial fix for #47 - Reformat of pom.xml to delete tab characters an…
…d correct indentation
8eae8c6
@mkordas mkordas added a commit to mkordas/checkstyle that referenced this issue Dec 20, 2014
@mkordas mkordas Partial fix for #47 - Add missing @Override annotations 28ef2ce
@mkordas mkordas added a commit to mkordas/checkstyle that referenced this issue Dec 20, 2014
@mkordas mkordas Partial fix for #47 - Reformat of pom.xml to delete tab characters an…
…d correct indentation
820e457
@mkordas mkordas added a commit to mkordas/checkstyle that referenced this issue Dec 20, 2014
@mkordas mkordas Partial fix for #47 - Add missing @Override annotations 35951cc
@mkordas mkordas added a commit to mkordas/checkstyle that referenced this issue Dec 20, 2014
@mkordas mkordas Partial fix for #47 - Reformat of pom.xml to delete tab characters an…
…d correct indentation
8cace35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment