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

String[]::new treated as a complex argument, breaking member chains

Open Beginner friendly
#1,113 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

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

Research direction

Start by tracing how the Java printer classifies method-chain arguments, then compare handling of String[]::new with ArrayList::new in the formatter tests. Add or update a regression case using the input shown; done means formatting leaves the member chain unchanged and the regression test passes.

Written by the indexing model from the issue text.

Description

Prettier-Java 2.11.0

Input:

class A {

  void f() {
    var items = new ArrayList<>();
    items.stream().map(Object::toString).toArray(String[]::new);
    items.stream().map(Object::toString).collect(toCollection(ArrayList::new));
  }
}

Output:

class A {

  void f() {
    var items = new ArrayList<>();
    items
      .stream()
      .map(Object::toString)
      .toArray(String[]::new);
    items.stream().map(Object::toString).collect(toCollection(ArrayList::new));
  }
}

Expected behavior: Unchanged.

An array constructor reference like String[]::new should be treated just like ArrayList::new. Both are just constructor references.

Dominant language
Java
Stars
1.2k
Forks
122
Avg merge
2d 10h
Merged PRs (30d)
35

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 jhipster/prettier-java

All issues in jhipster/prettier-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.