Explain what GiA says about accessing extension properties?

In “Gradle in Action”, section 8.5.4, “Plugin extension mechanism”, there is the following paragraph: > Every task of your plugin has a property named conventionMapping. To > be more specific, every task derived from DefaultTask owns this > property. You use this property to assign the extension model values > to a task’s input or output fields. By wrapping the extension model > value into a closure, you lazily set these values. This means that the > value is only calculated when the task is executed. To retrieve the > values of a property stored in convention mapping, you’ll need to > explicitly use getter methods, as shown in the next listing. Keep in > mind that trying to access a field directly will result in a null > value.

I was following this paragraph fine until the bolded sentence. I’m not sure what the point is there. Can someone elaborate on this?

To access property ‘foo’ declared in the same class, it’s necessary to use ‘getFoo()’ rather than ‘foo’. Otherwise, convention mapping won’t kick in.

Ok, perhaps I should rephrase the question.

I understand exactly what it’s saying. What I want to know is why. Your answer just reiterated what the statement said.

‘getFoo’ calls the generated getter that contains the convention mapping logic. ‘foo’ accesses the field directly and bypasses that logic.

If you have specific questions about the book, you might rather want to post it on Manning’s author forum in the future.