[
https://issues.apache.org/jira/browse/LUCENE-7012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Steve Rowe reopened LUCENE-7012:
--------------------------------
I noticed that IntelliJ is creating Java files with the package in the wrong
place (at the beginning of the file, before the license header).
I manually configured the Copyright plugin (Editor|Copyright|Formatting|Java)
to put the header in the right place (Location in File|Before Package) and the
following line is removed from the config file
{{.idea/copyright/profiles_settings.xml}} (under {{<LanguageOptions
name="JAVA">}}):
{code:xml}
<option name="fileLocation" value="3" />
{code}
The dialog has "Before Package" as the first of 3 possibilities for "Location
in File", so I tried making the {{value}} be {{1}} instead of {{3}}, and that
worked - the package now goes in the right place. But IntelliJ rewrites the
file to remove that line altogether - I'm guessing that {{1}} is the default,
and after it parses this config file, it then normalizes it to exclude default
settings when it re-serializes it.
So I'll just go remove the line.
> Change Lucene/Solr IDE configs to place new Java files' license header before
> the package declaration
> -----------------------------------------------------------------------------------------------------
>
> Key: LUCENE-7012
> URL: https://issues.apache.org/jira/browse/LUCENE-7012
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Shai Erera
> Assignee: Shai Erera
> Fix For: 5.5, 6.0
>
> Attachments: LUCENE-7012-intellij.patch, LUCENE-7012.patch
>
>
> Today the license header is placed after the package declaration. This
> results in inconsistency in our files. In some the license is put after the
> package and before the imports, in others it appears after the imports but
> before class declaration and in others it appears in the middle of the
> imports.
> Also, when you e.g. "Organize Imports" in eclipse, if the header is located
> in the middle of imports, it's sometimes completely removed from the file.
> This issue is about changing the "New Java Files" template in eclipse so that
> the license header is placed before the package declaration. This ensures
> that "Organize Imports" doesn't mess with it, as well for new files (created
> in eclipse), we will start getting some consistency.
> If we also want to handle all current files by moving the license header
> before the package, we can do so (I volunteer), but since it's a big change,
> will likely do it over multiple commits and no need for an issue. BTW, if
> anyone knows of a tool that can automate that, great. I found that Apache has
> a perl script but it seems to only fix the header to the new format, yet not
> moving it in the file.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]