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

Inconsistent formatting (first pass, second pass results in a different output).

Open
#1,260 0 comments 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
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
tooling

Research direction

Reproduce the issue with the Java snippet in src.java and the google-java-format-1.27.0-all-deps.jar commands shown, then compare 1.java and 2.java. Done means running the formatter repeatedly produces identical output, with no diff between the first and second formatted files.

Written by the indexing model from the issue text.

Description

This class:

class Xyz {
  void foo() {
    int i = 0;
switch (i) {
          case 18:
            { /* Break so we don't hit fall-through warning: */ break;/* ignore STRING */
            }
          }}}

results in a different output when you run gjf multiple times:

$ java -jar google-java-format-1.27.0-all-deps.jar src.java > 1.java
$ java -jar google-java-format-1.27.0-all-deps.jar 1.java > 2.java
$ diff 1.java 2.java 
7c7
<             /* Break so we don't hit fall-through warning: */
---
>           /* Break so we don't hit fall-through warning: */
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.