String[]::new treated as a complex argument, breaking member chains
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
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
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jhipster/prettier-java
-
Difficulty 3/5 1-2 days Newbie friendliness 56/100
jhipster/prettier-java#1114 ·
Maintainers usually reply within 2 days
-
Text block containing a comment-like line with " or \ fails with "Comment was not printed"Possibly taken @sean0407 claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 66/100
jhipster/prettier-java#1112 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
jhipster/prettier-java#1031 ·
Maintainers usually reply within 2 days
-
Adds needlessly parenthesesPossibly taken @braxtonzhangio claimed this 73 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 67/100
jhipster/prettier-java#1001 ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
jhipster/prettier-java#948 · 4 comments ·
Maintainers usually reply within 2 days
All issues in jhipster/prettier-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
QuicksilverMC/Argentum#31 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
navikt/mock-oauth2-server#1129 ·
Maintainers usually reply within 1 day
-
bug main ui
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
openhab/openhab-webui#4600 ·
Maintainers usually reply within 4 days
-
26.4 area: tags enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
`DeepSeekChatModel` streaming returns no content when chunks have no `id`Possibly taken @lejuho claimed this today. Openstatus: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
spring-projects/spring-ai#7214 ·
Maintainers usually reply within 2 days