jhipster / jhipster/prettier-java
Format record properties equivalent to class fields
- Lingua principale
- Java
- Stelle
- 1.2k
- Fork
- 120
- Merge medio
- 1g 14h
- PR unite (30g)
- 27
Descrizione
**Prettier-Java 1.6.0**
```sh
--print-width 80
```
**Input:**
```java
public record PolicyDto(
@NotNull
@Pattern(regexp = "\\d{10}")
String policyNumber,
@NotEmpty List<@NotNull @Valid ContractRelationDto> contractRelations,
@NotNull
@JsonSerialize(using = ContractStateSerializer.class)
@Schema(type = "integer", description = "some description")
ContractState contractState
) {}
```
**Output:**
```java
public record PolicyDto(
@NotNull @Pattern(regexp = "\\d{10}") String policyNumber,
@NotEmpty List<@NotNull @Valid ContractRelationDto> contractRelations,
@NotNull
@JsonSerialize(using = ContractStateSerializer.class)
@Schema(type = "integer", description = "some description")
ContractState contractState
) {}
```
**Expected behavior:**
```java
public record PolicyDto(
@NotNull
@Pattern(regexp = "\\d{10}")
String policyNumber,
@NotEmpty
List<@NotNull @Valid ContractRelationDto> contractRelations,
@NotNull
@JsonSerialize(using = ContractStateSerializer.class)
@Schema(type = "integer", description = "some description")
ContractState contractState
) {}
```
Format document properties equivalent to class fields. For this, each annotation needs to be put on a separate line (regardless of whether the print-width is exceeded).
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
No files, tests, or entry points are named. Reproduce the issue with the provided Java record and Prettier-Java 1.6.0 configuration, then compare record-property formatting with class-field formatting; done means each record annotation is on its own line regardless of print width.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 38/100