jhipster / jhipster/prettier-java
Adds needlessly parentheses
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 120
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 27
Description
**Prettier-Java 2.10.3**
[Playground link](https://www.jhipster.tech/prettier-java/playground#N4IgDgTglgdgLgdSgEzgCxALgCwAYA0IcAhgEZKoaYBMhArgM4CmAKmQ1gGbEA2zhxCBAD2AdwAKgpjA6YQvUcQCeHQnAjEoPWAHMAwsIC2h4lnk8eIQkwAeYJtEPSSPAPL2NcYRHHCGUOChhGDNpZCsQCCYARzooKPENHRMuXn4QAGNhZCYzBlEAjLQAAgAKGwBKYuAAHRhi4oziZmKAQWLiYtE0aQ6AOhi6NNLiPuJx4iqAWgA+YvU6JgBuOoBfEFWgA)
```sh
--print-width 40
```
**Input:**
```java
switch (x) {
case A a when a.equals(a.aaaa) -> true;
}
```
**Output:**
```java
switch (x) {
case A a when (
a.equals(a.aaaa)
) -> true;
}
```
**Expected behavior:**
```java
switch (x) {
case A a when
a.equals(a.aaaa)
-> true;
}
```
Or something.
Contributor guide
Research direction
Reproduce the example in the linked Prettier-Java Playground with --print-width 40 and compare the current and expected formatting. Trace how the switch case guard is formatted, then verify that the same input no longer adds parentheses and preserves the shown line breaks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 67/100