<div dir="auto">Usually problems that you describe are solved with custom data structures to reflect path + some annotation processing for generating metamodels with methods that yield this paths. This also involves a pretty high level of generics juggling, with various numbers of generics depending on strictness of constraints you want to enforce (my query framework over hibernate, for example, has Path<ROOT, PARENT, TARGET> as base, with number of params reaching 5 for some of the most specialized paths. This is complex and not pretty, but is a most common solution for your problem</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Dec 1, 2025, 21:59 Bruno Eberhard <<a href="mailto:bruno.eberhard@pop.ch">bruno.eberhard@pop.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 01.12.2025 um 20:37 schrieb Ethan McCue:<br>
> One more question: How does the code today work around things like the <br>
> small integer cache?<br>
It allocates for each field a "new Integer(0)". As long as Integer have <br>
an identity two of these values are distinguishable and can serve as <br>
different keys in a IdentityHashMap .<br>
</blockquote></div>