jhipster / jhipster/prettier-java

Comment section moved between two import declarations

Offen
#372 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: bug :bug: theme: Re-Writer
Vorherrschende Sprache
Java
Sterne
1.2k
Forks
120
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
27

Beschreibung

**Prettier-Java 0.7.0**

Launched through prettier-maven-plugin 0.7.0 without any option.
In the following case, the comment section is moved between two import lines.
This bugs depends on import declaration order. If "com.me.Util" is declared first, the generated file is OK.

**Input:**

```java
package org.mypackage;

/*-
*/

import java.lang.Util;
import java.util.Map;
import com.me.Util;

public class Prettier {}

```

**Output:**

```java
package org.mypackage;

import com.me.Util;
/*-
*/
import java.lang.Util;
import java.util.Map;

public class Prettier {}

```

**Expected behavior:**

```java
package org.mypackage;

/*-
*/
import java.lang.Util;
import java.util.Map;

import com.me.Util;

public class Prettier {}

```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduce the issue with the supplied Java input and compare the formatter output with the expected import and comment placement. Trace the import-ordering and comment-handling path, then add a regression test for this case and verify that the comment remains before the imports as shown.

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
Klar beschrieben
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

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