Gradle API method introduced in 8.11 works when running Gradle 7.4?

Hi,

I am maintaining a Gradle plugin that still supports Gradle versions down to 7.4. Since 8.11, a deprecation warning is shown when running the plugin: “The ProjectDependency.getDependencyProject() method has been deprecated.”

I followed the instructions to address this, and the warning is not shown anymore.

However, I now use ProjectDependency.getPath() or rather ProjectDependency.path where previously I used the now deprecated method.

The new method is documented with “@since 8.11”, so I expected this change to break backwards compatibility with the older Gradle versions. But the project uses compatibility tests (using GradleRunner) for different Gradle versions, down to 7.4, and to my surprise, they all pass.

What am I missing here? I will check the compatibility tests once more to see if accidentally the wrong Gradle version is used. Because, this cannot be true, or can it? Does the Gradle API somehow do some magic behind the scenes to support this?

I am really a little bit confused.

I’m not aware of any magic there and would greatly wonder if it is the case.
I also tried in a 7.4.2 build to use .path even from Groovy DSL which could access even private properties and it fails.
So yes, sounds fishy what you see if this is really the case.
Maybe you can provide some MCVE?