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

Avoid excessive newlines for short variable names with --aosp

Open
#970 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by locating the formatter logic that handles variable assignments and line wrapping under --aosp. Then find the relevant formatting tests, add a case matching the short-name assignment shown here, and confirm the output keeps the assignment expression together as requested.

Written by the indexing model from the issue text.

Description

I'm trying this out in chromium codebase, and besides the known-issue of excessive lambda whitespace (issue #19), I'm finding the most jarring thing is odd whitespace for variable assignments.

google-java-format does:

                desc =
                        getResources()
                                .getString(R.string.cablev2_error_ble_permission, packageLabel);

instead of:

                desc = getResources()
                                .getString(R.string.cablev2_error_ble_permission, packageLabel);

I'm guessing it might be because with two space indents, the wrapped line appears under the = sign (which looks less weird), but with four space indent, it looks really odd

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

Contributor guide

Open the contributing guide

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.