The GitHub Actions job "Groovy Snapshot Canary Build" on grails-core.git/fix/16294-16295-non-public-bean-marshalling has succeeded. Run started by GitHub user sbglasius (triggered by sbglasius).
Head commit for run: e9932f371fa86c3a8666ab35dcca86360ef7d6c8 / Søren Berg Glasius <[email protected]> Share the non-public bean access, and report it once Three things came out of review. The block that widens a read method was copy-pasted in all four marshallers. It now lives in `org.apache.grails.common.reflect.ReflectionUtils`, in grails-common, which is already on the compile classpath of every module that could need it. The GORM `ReflectionUtils` in grails-datastore-core is left alone: it is published, public since 1.0, and has eight call sites, so moving it is a separate change tracked on its own issue. Each marshaller now imports one utility rather than two Spring ones, and the method lookup asks for the exact parameter types. Java and Groovy beans now behave alike. The Java marshallers gated their field loop on `field.canAccess(o)`, so a public field on a non-public class was silently dropped where the Groovy ones emitted it. Both now widen a field copy, which `getDeclaredFields` hands out fresh on every call, so nothing leaks. A field that cannot be widened at all -- a class in a named module that does not open its package -- is skipped rather than failing the conversion, which is what the Java marshallers did before and what the Groovy ones did not. Widening access is compatibility handling rather than a contract, so every non-public bean class is reported once, through its own logger so a single logging line silences it. Bookkeeping runs before the log level is consulted, so "once" does not depend on how logging is configured, and the set holds class names rather than Class references so no class loader is retained. Classes from the JDK, Groovy and Spring are not reported, since nobody reading the log can declare them public. The upgrade guide gains a section: the field change alters response payloads, and the warning needs a documented way to turn it off. Raised in review of #16296. Report URL: https://github.com/apache/grails-core/actions/runs/34267653828 With regards, GitHub Actions via GitBox
