A question about project.getObjects()

Hello, I was writing some basic code to understand DefaultNamedDomainObjectSet

ObjectFactory objectFactory = project.getObjects()
DefaultNamedDomainObjectSet zx = objectFactory.namedDomainObjectSet(car.class)

As part of that, i was looking at the source code to see how the ObjectFactory instance is obtained and i came across this in the DefaultProject class.

    @Override
    @Inject
    public ObjectFactory getObjects() {
        // Decoration takes care of the implementation
        throw new UnsupportedOperationException();
    }

what exactly is the Decoration here? Pretty new to gradle so excuse if the question is very basic

Gradle doesn’t use a third-party dependency injection framework like Spring or Guice, but uses ASM to dynamically generate and modify existing classes. You’ll often see _Decorated as part of the class names of Gradle types in stack traces. The decoration is adding additional methods to a class (like the actual decorator pattern, but also a little more).

In this case, any getter on a “decorated” class with the @Inject annotation is going to instead return an instance that’s managed by Gradle (usually a singleton) instead of calling the code in the method. That code would only be called if you tried to use these classes without Gradle managing the lifecycle.

Opposite, most users have no reason to know or care about these advanced implementation details.