The GitHub Actions job "Coverage" on grails-core.git/fix/generated-beans-injected-once-8.0.x has succeeded. Run started by GitHub user codeconsole (triggered by codeconsole).
Head commit for run: 1d6f73b3edc350fbda9bfa980268375f856e0f0a / Scott Murphy Heiberg <[email protected]> Tell what the generated code injected from marks it writes The definitions the generated code contributed were taken from a snapshot of the bean factory as the context was initialized, and a bean was left alone when its definition was in the snapshot and its class was the type the definition declared. That was wrong three ways: - The snapshot held every definition registered by then, so a bean an initializer ordered ahead of the generated one declared was taken for a generated one, and nobody injected or initialized it. - An inner bean is not in the registry, so it was never in the snapshot, and was injected twice. - The decision went by name and type, not by instance. Another instance under a generated bean's name, as configureBean and the Hibernate bean container create, was left uninjected, and initializeBean skipped its @PostConstruct method. The code generated for each definition, an inner bean's included, now marks it as it returns it. GeneratedInjectionBeanRegistrationAotProcessor has it call GeneratedBeanDefinitions.markGenerated, which names the type whose members that code injects and has the instance supplier record, by identity, each instance it creates. The processors read the mark from the merged definition they are given and mark that type's members, and their overrides, as configured from outside. They then process every bean: an instance the generated code created only through what its class adds, and any other instance in full, through a plain processor whose metadata carries no marks. Lifecycle methods are no longer skipped. The common processor calls the annotated ones for every instance, as on a context without generated code, and the names the generated code recorded for them are taken off its definitions when the processors are registered. Left on, they made configureBean call them twice, since it works on a copy of the definition that keeps the recorded names but not what the processor called. The snapshot, and recording it in GrailsPluginLifecycleInitializer, are gone. GeneratedArtifactsInjectionSpec generates, compiles and runs the code for each case and counts every call; the cases that the snapshot, the name check and the inner bean got wrong fail without this change. Report URL: https://github.com/apache/grails-core/actions/runs/39664034941 With regards, GitHub Actions via GitBox
