GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Leave a comment that opens with /*** out of javadoc formatting by abashev · Pull Request #74 · openjavaformat/open-java-format

Conversation

@abashev

@abashev abashev commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Brings over upstream commit google/google-java-format@37171795 (google-java-format 1.8).

The bug

With javadoc formatting on (JavaFormatterOptions.formatJavadoc(true)), a banner such as

/*************************
 * Copyright
 *
 * Some Company
 *************************/

was taken for javadoc because it starts with /**: the row of asterisks moved onto a line of its own, and its paragraphs became <p> tags. The javadoc formatter has nothing to improve in a comment like that.

From upstream, with the author kept

  • google/google-java-format@37171795 by cushon (Liam Miller-Cushon), commit authored by them: a comment whose fourth character is another asterisk is not javadoc. The empty() expectation of JavadocFormattingTest changes with it: /***/ stays as it is.

Added here

  • bannerCommentIsNotJavadoc in JavadocFormattingTest, the banner above with javadoc formatting on.

What changes with javadoc formatting off

The same check decides how blank lines around a comment are treated. A blank line between such a banner and the declaration after it is now kept, as after any other block comment, instead of being removed as it would be after javadoc; a banner with no blank line after it stays as it was.

Checked

  • The new test fails on main and passes with the change.
  • ./gradlew :open-java-format:test on JDK 21: 1498 tests, all green.
  • Of the 15,747 files of the JDK 21 sources, 43 format differently, by 70 blank lines more in all and no other change; every one of them is in the input, after a banner comment. Formatting main's output of those files again with this change adds nothing, apart from the four of them that change on a second run on main already.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cushon @abashev
Leave a comment that opens with "/***" out of javadoc formatting
49ff83d
With javadoc formatting on, a banner such as

    /*************************
     * Copyright
     *
     * Some Company
     *************************/

was taken for javadoc because it starts with "/**": the row of
asterisks moved onto a line of its own, and its paragraphs became <p>
tags. The javadoc formatter has nothing to improve in a comment like
that.

This ports upstream commit 37171795 by cushon (google-java-format
1.8): a comment whose fourth character is another asterisk is not
javadoc. That holds with javadoc formatting off as well, where it
decides how blank lines around the comment are treated: a blank line
between such a banner and the declaration after it is now kept, as
after any other block comment, instead of being removed as it would be
after javadoc. The empty() expectation changes accordingly, and a test
pins the banner.

Of the 15,747 files of the JDK 21 sources, 43 format differently, by
70 blank lines more in all and no other change; every one of them is
in the input, after a banner comment. The four of those files that
change again on a second run did so on main already.
@abashev
abashev merged commit 7f2a32d into main Sep 25, 2026
15 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@abashev
abashev deleted the javadoc-banner-comments branch September 25, 2026 08:26
abashev added a commit to openjavaformat/docs that referenced this pull request Sep 25, 2026
@abashev
List the switch and banner changes among the output differences on Mi…
dff4404
…grate

Two more changes on the formatter's main branch move output away from
palantir-java-format 2.98.0, and Migrate lists every such difference.
openjavaformat/open-java-format#76 brings over palantir 2.99.0's one
change: a switch expression that initializes a variable or a field
starts on the declaration's line, 57 declarations in 51 files of the JDK
21 sources. openjavaformat/open-java-format#74 stops counting a comment
that opens with /*** as javadoc, so a blank line between such a banner
and the declaration after it stays: 70 blank lines in 43 files, all of
them in the source. Both join the cast fix as not yet released, and the
corpus paragraph gives their numbers.
abashev added a commit to openjavaformat/docs that referenced this pull request Sep 25, 2026
@abashev
Install open-java-format 2.98.0.4, which ships the Migrate changes
215f758
2.98.0.4 is out on GitHub, Maven Central and the Gradle Plugin Portal,
so the pages now install it. It carries the three output changes that
Migrate listed as not yet in a release: the cast fix
(openjavaformat/open-java-format#78), the switch expression on the
declaration's line (openjavaformat/open-java-format#76) and the /***
banner that no longer counts as javadoc
(openjavaformat/open-java-format#74). Each now says it applies since
2.98.0.4, and the corpus paragraph no longer calls them unreleased.

The GitHub Action page keeps 2.98.0.3 as the default of the action's
version input, because the action itself still defaults to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@abashev @cushon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.