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.
See screenshot for settings. The preview shows correctly that blank lines are removed, but the blank lines are not removed from the code unless "Maximum Blank Lines" are set to zero. 1. Code before formatting: --------------------------------------------------- package imports; import java.util.*; /** * * @author jprox */ public class Count { public int x; public double y; public String str; public List a; public LinkedList b; public HashMap c; public Map d; public void a() { } } -------------------------------------------------- 2. After invoking Source>>Format, nothing changes! 3. Expected formatting: -------------------------------------------------- package imports; import java.util.*; /** * * @author jprox */ public class Count { public int x; public double y; public String str; public List a; public LinkedList b; public HashMap c; public Map d; public void a() { } } --------------------------------------------------- Product Version: NetBeans IDE Dev (Build 201308052300) Updates: Updates available Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b16 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Created attachment 138356 [details] Blank lines settings screenshot
I think I understand what the intent of this is, but calling them "Maximum blank lines" is misleading. They are more like "Preserve existing blank lines", not "Maximum blank lines". It this is the way it operates, there should be a checkbook "Preserve existing blank lines" then the other two existing fields are enabled to set "Maximum preserved lines in deceleration" and "Maximum preserved lines in code".
Fixed in jet-main. Label changed to 'Maximum preserved blank lines'. If you don't want to preserve the existing blank lines, use '0' as a value. http://hg.netbeans.org/jet-main/rev/5df057c38fba
Well, I guess it is a little more complicated than that... if it is set to zero, it basically disables blank lines from working. I need to think about this some more, but I think it should really act like Max blank lines and add and remove blank lines to match the Min blank lines settings, but just doesn't allow any lines more than Max if Min is set higher than Max. It would behave like the preview and like v7.3.1 up to Max blank lines. Then if you want to preserve blank line, there would be a checkbox that says: "do not remove existing lines" and it would only add lines up to Max but never remove them if you set Min lower. At the moment, there is no way to get the same behavior as v7.3.1 and it does not match what the preview shows.
Maybe I am assuming setting to zero still works that same and that you didn't change that part... :)
The behavior has been changed to exactly follow what the label says - 'Maximum PRESERVED blank lines'. Setting to '0' means: 'do not preserve any existing blank lines (just use the limits for minimum blank lines)'.
Integrated into 'main-silver', will be available in build *201308090746* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/5df057c38fba User: Dusan Balek <dbalek@netbeans.org> Log: Issue #234019: Maximum blank lines behaves like minimum blank lines if blank lines exist - fixed.
It is partially working. If "In Declaration" is set to zero then these are still disabled: After Package Before Imports After Imports After Class (Does not work after Inner Class or Inner Interface.) After Field After Method Product Version: NetBeans IDE Dev (Build 201308090746) Java: 1.7.0_40-ea; Java HotSpot(TM) 64-Bit Server VM 24.0-b55 Runtime: Java(TM) SE Runtime Environment 1.7.0_40-ea-b36 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
OOPS. Fixed in jet-main - second attempt. http://hg.netbeans.org/jet-main/rev/cc4755b61815
Integrated into 'main-silver', will be available in build *201308122300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/cc4755b61815 User: Dusan Balek <dbalek@netbeans.org> Log: Issue #234019: Maximum blank lines behaves like minimum blank lines if blank lines exist - fix cont.
It works good, but I just noticed that on the outer class and functions, blank lines between Annotations and the declaration is not removed if "In Declaration" is zero. This is always removed in v7.3.1. The blank lines between annotation and Inner Classes are removed if "In Declaration" is zero. ---------------------------------------------------------------------------- @Deprecated <------------------------blank line should be removed public MyClass { @Override <----------------------blank line should be removed public String toString() { return null; } @SupressWarning("unchecked") <--blank line is removed for inner class private MyInnerClass { } } ---------------------------------------------------------------------------- Product Version: NetBeans IDE Dev (Build 201308122300) Java: 1.7.0_40-ea; Java HotSpot(TM) 64-Bit Server VM 24.0-b55 Runtime: Java(TM) SE Runtime Environment 1.7.0_40-ea-b38 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Fixed in jet-main. http://hg.netbeans.org/jet-main/rev/aa9e4e2e6d3a
Integrated into 'main-silver', will be available in build *201308152300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/aa9e4e2e6d3a User: Dusan Balek <dbalek@netbeans.org> Log: Issue #234019: Maximum blank lines behaves like minimum blank lines if blank lines exist - fixed.
Verified fixed in: Product Version: NetBeans IDE Dev (Build 201308152300) Java: 1.7.0_40-ea; Java HotSpot(TM) 64-Bit Server VM 24.0-b55 Runtime: Java(TM) SE Runtime Environment 1.7.0_40-ea-b38 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
*** Bug 235509 has been marked as a duplicate of this bug. ***