Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

No longer rely on deep reflection in cloning

Aperta
#1,929 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
java
Ambito
backend

Direzione di ricerca

The issue does not name specific files or tests. Start by locating the current solution-cloning implementation and the Gizmo-based cloner, then compare how each handles mutable and final fields. Done means defining and implementing a replacement for deep reflection that works without requiring mutable fields to be public.

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

Descrizione

In the near future, Java will start restricting deep reflection - for example, setAccessible(true) will become a problem.

The current approach to solution cloning relies heavily on deep reflection, and it can not be fixed. For example, the cloner will use setAccessible(true) to be able to write a final field after the encapsulating object was already created. A new approach to cloning will be necessary. Possibilities include:

  • @JsonCreator-like approach.
  • @ConstructorProperties-like approach.
  • PlanningClonable interface; maybe not ideal.
  • Wait until Java finishes serialization 2.0, which will likely provide mechanisms for this. Unfortunately, as this would require an upgrade of the minimum version of the JDK, this is unlikely to be applicable any time soon; a solution to this issue will likely be required earlier.
Gizmo cloner

We already support the Gizmo-based cloner, which does not use deep reflection. However, outside of Quarkus, it requires all mutable fields to be public, which arguably no user would be excited about doing. If we decide to go for the @JsonCreator approach, we may be able to fully generate cloners even without forcing the user to accept such workarounds, giving peak performance to everyone in all circumstances. As an added bonus, this would allow us to only have a single implementation of the cloner.

Lingua principale
Java
Stelle
1.8k
Fork
238
Merge medio
3g 1h
PR unite (30g)
55

Preparare l'ambiente

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 TimefoldAI/timefold-solver

Tutte le issue di TimefoldAI/timefold-solver

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.