Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 103831 - 6.0 M9 - extra blank lines not removed
6.0 M9 - extra blank lines not removed
Status: RESOLVED WONTFIX
Product: java
Classification: Unclassified
Component: Editor
6.x
PC Windows XP
: P4 (vote)
: 6.x
Assigned To: Dusan Balek
issues@java
CLEAN
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-12 05:39 UTC by wqtnetbeans
Modified: 2015-08-22 04:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wqtnetbeans 2007-05-12 05:39:06 UTC
void someMethod() {
    <blank line>
    <blank line>
    doThing1();
    <blank line>
    <blank line>
    <blank line>
    <blank line>
    doThing2();
    <blank line>
    <blank line>
}

should be formatted to

void someMethod() {
    <blank line>
    doThing1();
    <blank line>
    doThing2();
    <blank line>
} 

but is not.
Comment 1 Vitezslav Stejskal 2007-06-18 03:46:36 UTC
I'm not sure what the correct behavior should be. See issue #106815.
Comment 2 wqtnetbeans 2007-06-18 15:21:30 UTC
Maybe there should be an option to tick-mark "remove extra blank lines". 

A personal comment: I think "format code" eventually should have a "mode", where you can just type your entire Java
class in one single line (if you choose to do that); and after press "reformat code", the whole class should be
formatted into a "Sun-style" (or "C", or some other style) format: some "sensible" blank lines should be added
automatically - ex. before for-loop, before "if", before "return".... The argument would be: This will completely
separate the concern of "coding" from the concern of "formatting" if the use chooses to do so. And that is a good coding
productivity gain for some.

The open source project Jalopy is a good reference of this. In fact, the tool is useful enough that the author was able
to spin off a commercial version of it.
Comment 3 Jan Becicka 2007-08-20 15:15:49 UTC
personally I prefer to keep blank lines.
Comment 4 wqtnetbeans 2007-08-20 15:22:21 UTC
Actually it's be ideal for the "blank line" treatment to have two options that the user can turn on and off:

1. Remove extra blank line like what is mentioned here.
2. Add blank lines before special language construct, such as "return ", "if (", "for (", "while ("...., which is again
an ideal borrowed from Jalopy.

The key thing here is make the options tick-markable to make everybody happy (if there is ever such thing :)
Comment 5 _ wadechandler 2007-09-05 19:44:39 UTC
I agree these need to be options. I for one don't want blank lines removed if I have put them there for a reason. For me
this is what happens most, not that I have erroneous blanks lines. Maybe if there was a way to have blank lines removed
from a selection that would work for me, but certainly I don't want every one from the entire file. With a selection a
method could be selected or whatever, and the blanks could be removed from just that area of the file.
Comment 6 Quality Engineering 2009-12-21 05:53:50 UTC
This bug was reported against NetBeans IDE 6.0 or an older release, or against a non-maintained module. NetBeans team does not have enough resources to get to this issue, therefore we are closing the issue as a WONTFIX. If you are interested in providing a patch for this bug, please see our NetFIX guidelines for how to proceed. 

We apologize for any inconvenience.


Thank you.
The NetBeans Team
Comment 7 2Geckos 2015-08-22 04:35:22 UTC
(In reply to wqtnetbeans from comment #0)
> void someMethod() {
>     <blank line>
>     <blank line>
>     doThing1();
>     <blank line>
>     <blank line>
>     <blank line>
>     <blank line>
>     doThing2();
>     <blank line>
>     <blank line>
> }
> 
> should be formatted to
> 
> void someMethod() {
>     <blank line>
>     doThing1();
>     <blank line>
>     doThing2();
>     <blank line>
> } 
> 
> but is not.

This problem is still VERY annoying, one <blank line> between every line is bad enough but 5-10 extra lines is criminal.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo