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 229042 - templates should not "hard wire" a blank line after license text
Summary: templates should not "hard wire" a blank line after license text
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-26 01:40 UTC by athompson
Modified: 2013-05-13 19:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description athompson 2013-04-26 01:40:45 UTC
Currently, there are templates which look something like this:

<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "${project.licensePath}">

<#if package?? && package != "">
package ${package};
...

The problem with this approach is that there's no way *not* to skip a line after the license text. For example, I've created a blank license file called "license-none.txt" which I want to use when no license is required. The resulting file has a blank line at the top, before the "package" statement.

Depending on how you look at it, there are two ways of fixing this. You could consider it a bug that the formatter doesn't remove the blank line and fix it there, or tweak the templates so they look like this and add a blank line in the license files:


<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "${project.licensePath}">
<#if package?? && package != "">
package ${package};
...

Of course, if there's a better way I'm not aware of to specify no license, please let me know. :)
Comment 1 athompson 2013-04-26 01:42:07 UTC
That is, the resulting *class* has a blank line at the top.
Comment 2 athompson 2013-04-26 01:50:28 UTC
Ah! the blank line is caused by the new "Maximum Blank Lines" options in the formatter. It also causes blank lines to be inserted after javadoc comments and other inappropriate places. These options should probably be overridden to 0 when formatting templates, (which will make people who want extra blank lines in their templates unhappy), or the templates need to be tweaked to be smarter about blank lines and not rely on the formatter to make them come out right.
Comment 3 Dusan Balek 2013-05-10 16:54:10 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/92fe1ec87f59
Comment 4 Quality Engineering 2013-05-13 14:16:21 UTC
Integrated into 'main-golden', will be available in build *201305131004* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/92fe1ec87f59
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #229042: templates should not "hard wire" a blank line after license text - fixed.
Comment 5 athompson 2013-05-13 19:35:42 UTC
yup