In Apache Beam we actually using the style you mentioned: package-info.java
has one blank line after copyright.

I did a test. It turns out Spotless think it's a violation if there are
more than one blank line. Spotless can also fix it by deleting extra blank
lines and keep only one line. Another interesting finding is Spotless
accepts no blank line as well without complaining.


-Rui

On Mon, Dec 9, 2019 at 3:37 AM Vladimir Sitnikov <
[email protected]> wrote:

> Hi,
>
> I've noticed that package-info.java files have different copyright
> "formatting" than all the other Java files.
>
> The difference is as follows: package-info.java has a blank line after the
> copyright, and all the other files do not have that blank line.
>
> Sample blank like:
>
> https://github.com/apache/calcite/blob/c7c8ab17c3f4785f81dc02184034ebeb5e1d4ae1/core/src/main/java/org/apache/calcite/schema/impl/package-info.java#L17
> Typical Java file (no blank like):
>
> https://github.com/apache/calcite/blob/c7c8ab17c3f4785f81dc02184034ebeb5e1d4ae1/core/src/main/java/org/apache/calcite/schema/impl/StarTable.java#L16-L17
>
> I'm inclined to remove the blank lines to align package-info.java with the
> other .java files. Hopefully, it does not hurt aesthetically.
>
> Note the motivation there is not nit-picking, and I've discovered it when I
> was implementing an automated check for the headers.
>
> It turned out, the current Spotless does not support `package-info.java`
> files (it excludes the files no matter what), that is why we see no
> violations so far.
> I'm planning to replace Spotless with
> https://github.com/autostyle/autostyle to
> make the verifier and formatter more robust.
>
> Vladimir
>

Reply via email to