Number-only array arguments print one element per line
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 56/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- developer-experience, tooling
Research direction
Start by locating the Java printer logic and tests for array formatting; the issue does not name specific files or test entry points. Reproduce the examples with print width 80, then check how number-only arrays are laid out both as a final argument and when they fit on one line. Done means short arrays stay on one line and longer arrays wrap elements across lines without dropping commas.
Written by the indexing model from the issue text.
Description
Prettier-Java 2.11.0
# Options (if any):
--print-width 80
Input:
class A {
void f() {
assertEquals(Bytes.fromInt(0x01020304), new byte[] { 0x01, 0x02, 0x03, 0x04 });
community = fromExtended(0x02, new byte[] { 0x00, 0x00, 0x00, 0x64, 0x19, 0x00, 0x00, 0x00, 0x00, 0x64, 0x19, 0x00, 0x00, 0x00, 0x00, 0x64 });
}
}
Output:
class A {
void f() {
assertEquals(Bytes.fromInt(0x01020304), new byte[] {
0x01,
0x02,
0x03,
0x04,
});
community = fromExtended(0x02, new byte[] {
0x00,
0x00,
0x00,
0x64,
0x19,
0x00,
0x00,
0x00,
0x00,
0x64,
0x19,
0x00,
0x00,
0x00,
0x00
0x64,
});
}
}
Expected behavior:
class A {
void f() {
assertEquals(
Bytes.fromInt(0x01020304),
new byte[] { 0x01, 0x02, 0x03, 0x04 }
);
community = fromExtended(
0x02,
new byte[] {
0x00, 0x00, 0x00, 0x64, 0x19, 0x00, 0x00, 0x00, 0x00, 0x64, 0x19, 0x00,
0x00, 0x00, 0x00, 0x64,
}
);
}
}
This matches Prettier JS, which doesn't hug a number-only array as the last argument and fills its elements across lines:
community = fromExtended(
0x02,
[
0x00, 0x00, 0x00, 0x64, 0x19, 0x00, 0x00, 0x00, 0x00, 0x64, 0x19, 0x00,
0x00, 0x00, 0x00, 0x64,
],
);
2.8.1 also kept short arrays like the first one on a single line:
assertEquals(Bytes.fromInt(0x01020304), new byte[] { 0x01, 0x02, 0x03, 0x04 });
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 123
- 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 2/5 1-3 hours Newbie friendliness 72/100
jhipster/prettier-java#1113 ·
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 2 days ago. 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 75 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
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ReChronoRain/HyperCeiler#1743 ·
Maintainers usually reply within 6 days
-
Weaviate: bump test image to 1.39.13 (CVE-2026-111943) and identify solon-ai via integration headerOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
JabRef/jabref#17546 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
hiero-ledger/hiero-sdk-java#3010 ·
Maintainers usually reply within 1 day