This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 154151 - Need space-after-comma setting for generic type parameters
Summary: Need space-after-comma setting for generic type parameters
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Rastislav Komara
Depends on:
Reported: 2008-11-29 19:17 UTC by Torbjorn Norbye
Modified: 2009-02-19 21:09 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Torbjorn Norbye 2008-11-29 19:17:56 UTC
When formatting my code, I don't want a space after a comma for generic type parameters.

For example, in code like this:

        Entry<K,V> e;
        while ( (e = (Entry<K,V>) queue.poll()) != null) {
            int h = e.hash;
            int i = indexFor(h, table.length);

            Entry<K,V> prev = table[i];
            Entry<K,V> p = prev;

note that there are no spaces between the K and V parameters. This is from the standard JDK collections classes. If I format this with NetBeans I end up with

            Entry<K, V> prev = table[i];
            Entry<K, V> p = prev;
            while (p != null) {
                Entry<K, V> next =;


I prefer the no-space style myself, but I haven't found a way to make NetBeans format the source this way.  There is only one setting that I can find for 
"space after comma".  I don't want to set it to false, since for most comma lists I -do- want a space -- it's for generic type parameters only that I want to 
turn it off.

Or is it there and I just missed it?

If not, I think this is a really important enhancement, bordering on a defect, since out of the box you cannot really format modern (Java 5 style) Java code 
without hand tweaking the results a lot or putting up with the space style.
Comment 1 Rastislav Komara 2009-02-03 10:56:34 UTC