jhipster / jhipster/prettier-java

Regression in 2.6.0

Offen
#683 4 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Java
Sterne
1.2k
Forks
120
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
27

Beschreibung

**Prettier-Java 0.6.0**

```sh
# Options (if any):
--print-width 120
```

It looks like https://github.com/jhipster/prettier-java/pull/632 , despite being a great improvement overall, introduced a regression when the first method call needs to be multi-line due to long arguments, leading to a closing `)` misaligned.

**Input:**

```java
public static final MethodDescriptor NEW_TUNNEL_METHOD = MethodDescriptor
.newBuilder(ByteBufMarshaller.INSTANCE, ByteBufMarshaller.INSTANCE)
.setFullMethodName(TUNNEL_SERVICE + "/new")
.setType(MethodDescriptor.MethodType.BIDI_STREAMING)
.build();
```

**Output:**

```java
public static final MethodDescriptor NEW_TUNNEL_METHOD = MethodDescriptor.newBuilder(
ByteBufMarshaller.INSTANCE,
ByteBufMarshaller.INSTANCE
)
.setFullMethodName(TUNNEL_SERVICE + "/new")
.setType(MethodDescriptor.MethodType.BIDI_STREAMING)
.build();
```

**Expected behavior:**
```java
public static final MethodDescriptor NEW_TUNNEL_METHOD = MethodDescriptor
.newBuilder(ByteBufMarshaller.INSTANCE, ByteBufMarshaller.INSTANCE)
.setFullMethodName(TUNNEL_SERVICE + "/new")
.setType(MethodDescriptor.MethodType.BIDI_STREAMING)
.build();
```

**Alternative expected behavior:**
```java
public static final MethodDescriptor NEW_TUNNEL_METHOD = MethodDescriptor.newBuilder(
ByteBufMarshaller.INSTANCE,
ByteBufMarshaller.INSTANCE
)
.setFullMethodName(TUNNEL_SERVICE + "/new")
.setType(MethodDescriptor.MethodType.BIDI_STREAMING)
.build();
```

See https://github.com/bsideup/grpc-bidi/commit/bd351342e59ed4be2ad6f18e32f174978f0c7c02

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduce the formatting regression with the provided Java input and --print-width 120, then inspect the change from pull request 632 and the referenced grpc-bidi commit. Done means the formatter consistently produces one of the two expected closing-parenthesis layouts and the regression is covered by a reproducible check.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.