[BUG][JAVA] Deprecated properties only get @Deprecated on the getter (base, feign, native, microprofile)

Aperta Adatta ai principianti
#25,567 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Inf1mum ci sta già lavorando.

Dal 10/11/2026.

  • #25615 di @Inf1mum — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
tooling

Direzione di ricerca

Leggi i template Java POJO elencati: Java/pojo.mustache e le varianti feign, native e microprofile in Java/libraries; confronta la gestione della deprecazione con okhttp-gson. Poi esamina in JavaClientCodegenTest i test pertinenti del codice generato. Il lavoro è concluso quando le proprietà deprecate annotano il campo, il getter, il setter e il setter fluent in ciascun template elencato e i test coprono l'output generato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue: Bug
Description

If a property is marked deprecated: true, the Java client only puts @Deprecated on the getter.
The field, setter and fluent setter don't get it, so you only get a compiler warning when reading
the value, not when setting it:

private String name;                          // no @Deprecated

public Pet name(String name) { ... }          // no @Deprecated

@Deprecated
public String getName() { ... }

public void setName(String name) { ... }      // no @Deprecated

I'd expect all of them to be annotated, the way okhttp-gson does it since #15287 (#15286).
jersey2 and jersey3 do it too. These templates still don't:

  • Java/pojo.mustache (e.g. resttemplate, webclient)
  • Java/libraries/feign/pojo.mustache
  • Java/libraries/native/pojo.mustache
  • Java/libraries/microprofile/pojo.mustache

Checked with 7.27.0 and current master.

The same thing was reported for JavaSpring in #24704 (PRs #24705, #24762).

Question

Was there a reason these were left out of #15287, or did they just get missed? If it's the
latter, I'm happy to open a PR that does the same as #15287 for the templates above and adds
tests to JavaClientCodegenTest.

Lingua principale
Java
Stelle
26.9k
Fork
7.8k
Merge medio
2g 10h
PR unite (30g)
180

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenAPITools/openapi-generator

Tutte le issue di OpenAPITools/openapi-generator

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.