[xwiki-devs] [Proposal] Change the XWiki codestyle for wildcard type parameters
Hi devs, The current codestyle for wildcard type parameters is to use spaces around it, as in: List< ? > Map< ? , ? > Map<String, ? > As opposed to specific parameters: List<String> List<T> Map<String, String> Map<T, T> This might have a historical reason, when we defined the codestyle, Eclipse couldn't make the difference between "?" as a wildcard type and "?" as the ternary operator. The standard Java, Eclipse, and IDEA style conventions don't use the extra space. Personally, I don't think that the wildcard needs the extra space, so +1 for this change. -- Sergiu Dumitriu http://purl.org/net/sergiu
Isn’t this checkstyle’s default? In general when I coded the first checkstyle.xml I tried to follow the default as much as possible since the checkstyle’s team has usually defined sensible defaults after comparing various projects. Are you sure we’re checking this in checkstyle btw? I’m asking because I remember using it without spaces recently and checkstyle not complaining Otherwise I’m +0 to change it (where is it defined?). Thanks -Vincent On 18 Jul 2014 at 18:38:41, Sergiu Dumitriu ([email protected](mailto:[email protected])) wrote:
Hi devs,
The current codestyle for wildcard type parameters is to use spaces around it, as in:
List< ? > Map< ? , ? > Map
As opposed to specific parameters:
List List Map Map
This might have a historical reason, when we defined the codestyle, Eclipse couldn't make the difference between "?" as a wildcard type and "?" as the ternary operator.
The standard Java, Eclipse, and IDEA style conventions don't use the extra space.
Personally, I don't think that the wildcard needs the extra space, so +1 for this change.
-- Sergiu Dumitriu http://purl.org/net/sergiu
I'm looking in the codestyle-eclipse-java.xml configuration file. The IDEA configuration doesn't require whitespace around wildcards (actually it doesn't say anything about that, so it uses the default). Checkstyle indeed doesn't seem to complain either way, and although we do include WILDCARD_TYPE in the WhitespaceAround check, I think that one isn't actually taken into account. The current documentation doesn't mention WILDCARD_TYPE as a valid token to include in this configuration, so we could remove it from checkstyle.xml. On 07/18/2014 12:45 PM, [email protected] wrote:
Isn’t this checkstyle’s default? In general when I coded the first checkstyle.xml I tried to follow the default as much as possible since the checkstyle’s team has usually defined sensible defaults after comparing various projects.
Are you sure we’re checking this in checkstyle btw? I’m asking because I remember using it without spaces recently and checkstyle not complaining
Otherwise I’m +0 to change it (where is it defined?).
Thanks -Vincent
On 18 Jul 2014 at 18:38:41, Sergiu Dumitriu ([email protected](mailto:[email protected])) wrote:
Hi devs,
The current codestyle for wildcard type parameters is to use spaces around it, as in:
List< ? > Map< ? , ? > Map
As opposed to specific parameters:
List List Map Map
This might have a historical reason, when we defined the codestyle, Eclipse couldn't make the difference between "?" as a wildcard type and "?" as the ternary operator.
The standard Java, Eclipse, and IDEA style conventions don't use the extra space.
Personally, I don't think that the wildcard needs the extra space, so +1 for this change.
-- Sergiu Dumitriu http://purl.org/net/sergiu
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Sergiu Dumitriu http://purl.org/net/sergiu
+1 Thanks, Marius On Jul 18, 2014 7:39 PM, "Sergiu Dumitriu" <[email protected]> wrote:
Hi devs,
The current codestyle for wildcard type parameters is to use spaces around it, as in:
List< ? > Map< ? , ? > Map<String, ? >
As opposed to specific parameters:
List<String> List<T> Map<String, String> Map<T, T>
This might have a historical reason, when we defined the codestyle, Eclipse couldn't make the difference between "?" as a wildcard type and "?" as the ternary operator.
The standard Java, Eclipse, and IDEA style conventions don't use the extra space.
Personally, I don't think that the wildcard needs the extra space, so +1 for this change.
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
+1 On Mon, Jul 21, 2014 at 10:49 AM, Marius Dumitru Florea <[email protected]> wrote:
+1
Thanks, Marius
On Jul 18, 2014 7:39 PM, "Sergiu Dumitriu" <[email protected]> wrote:
Hi devs,
The current codestyle for wildcard type parameters is to use spaces around it, as in:
List< ? > Map< ? , ? > Map<String, ? >
As opposed to specific parameters:
List<String> List<T> Map<String, String> Map<T, T>
This might have a historical reason, when we defined the codestyle, Eclipse couldn't make the difference between "?" as a wildcard type and "?" as the ternary operator.
The standard Java, Eclipse, and IDEA style conventions don't use the extra space.
Personally, I don't think that the wildcard needs the extra space, so +1 for this change.
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
+1 Thanks, Eduard On Mon, Jul 21, 2014 at 12:37 PM, Thomas Mortagne <[email protected]
wrote:
+1
On Mon, Jul 21, 2014 at 10:49 AM, Marius Dumitru Florea <[email protected]> wrote:
+1
Thanks, Marius
On Jul 18, 2014 7:39 PM, "Sergiu Dumitriu" <[email protected]> wrote:
Hi devs,
The current codestyle for wildcard type parameters is to use spaces around it, as in:
List< ? > Map< ? , ? > Map<String, ? >
As opposed to specific parameters:
List<String> List<T> Map<String, String> Map<T, T>
This might have a historical reason, when we defined the codestyle, Eclipse couldn't make the difference between "?" as a wildcard type and "?" as the ternary operator.
The standard Java, Eclipse, and IDEA style conventions don't use the extra space.
Personally, I don't think that the wildcard needs the extra space, so +1 for this change.
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (5)
-
Eduard Moraru -
Marius Dumitru Florea -
Sergiu Dumitriu -
Thomas Mortagne -
vincent@massol.net