H7 PredicateGenerator: drop the criterion handler registrations that the superclass lookup already covers

Aperta
#16,887 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
66/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Ambito
backend

Direzione di ricerca

Start in grails-data-hibernate7 at PredicateGenerator.registerBuiltinHandlers() and findHandler, then locate the relevant spec and criterion classes. Add a spec comparing returned handler classes for every known criterion under current registrations and base registrations only. Remove entries that match their nearest registered ancestor, retain differing entries with an explanatory comment, and run the spec.

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

Descrizione

type: improvement

PredicateGenerator in grails-data-hibernate7 finds the handler of a criterion with findHandler, which walks the superclass chain of the criterion's class and takes the nearest registered class. Registering Query.PropertyCriterion, Query.SubqueryCriterion, Query.PropertyNameCriterion, Query.PropertyComparisonCriterion and Query.Junction therefore covers their subclasses.

registerBuiltinHandlers() also registers each subclass on its own (Query.IsNull, Query.IsNotNull, Query.Conjunction, Query.Disjunction, Query.EqualsAll, Query.GreaterThanSome and so on, 42 entries). Each one creates another handler instance that is the same kind as the one its parent already provides.

The entries can be removed if every one of them maps to the same handler class as its nearest registered ancestor. That has to be checked and not assumed, because an entry that maps to a different handler would change behavior when it goes.

To do:

  • Add a spec that compares, for every criterion class the generator knows, the handler class findHandler returns with the current registrations and with only the base registrations.
  • Remove the entries that agree, and keep any that do not, with a comment that says why.

Raised by jdaugherty in the review of #16816 as optional. It changes no behavior and is left out of that PR to keep its diff reviewable.

Lingua principale
Groovy
Stelle
2.9k
Fork
980
Merge medio
2g 4h
PR unite (30g)
130

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 apache/grails-core

Tutte le issue di apache/grails-core

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.