Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

No new line break for some at-sign@ in Javadoc comment

Open
#1,249 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
tooling

Research direction

Start by reproducing the supplied Javadoc example with java-format and compare the input and formatted output around @InternalApi. Trace the Javadoc formatting path to determine why that line break is removed, then add or update a regression test showing that the break is preserved.

Written by the indexing model from the issue text.

Description

We have a string as:

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* <p> Sample code:
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* try (EchoServiceClient echoServiceClient =
*     EchoServiceClient.create()) {
*   EchoResponse response =
*       echoServiceClient.chat();
* }
* }</pre>
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
* @InternalApi This method is internal used only. Please do not use directly.
*/

After running java-format on the above string, the Javadoc comment gets reformatted as:

// AUTO-GENERATED DOCUMENTATION AND METHOD.
  /**
   * Sample code:
   *
   * <pre>{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * try (EchoServiceClient echoServiceClient =
   *     EchoServiceClient.create()) {
   *   EchoResponse response =
   *       echoServiceClient.chat();
   * }
   * }</pre>
   *
   * @param request The request object containing all of the parameters for the API call.
   * @throws com.google.api.gax.rpc.ApiException if the remote call fails @InternalApi This method
   *     is internal used only. Please do not use directly.
   */

Notice the line break before @InternalApi was removed and a line break was added after @InternalApi This method. This makes the method comments hard to read.
Could you please help investigate?
Thank you!

Dominant language
Java
Stars
6.2k
Forks
936
Avg merge
6m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/google-java-format

All issues in google/google-java-format

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.