Skip to content

Skip calls to declared methods in UsePropertyAssignmentSyntax - #9017

Open
mipal-mod wants to merge 1 commit into
mainfrom
mpalka/gradle-property-assignment-non-gradle-receiver
Open

mipal-mod wants to merge 1 commit into
mainfrom
mpalka/gradle-property-assignment-non-gradle-receiver

Conversation

@mipal-mod

@mipal-mod mipal-mod commented Oct 2, 2026 •

Copy link
Copy Markdown

What's changed?

UsePropertyAssignmentSyntax now leaves a call alone when it resolves to a declared method. The deprecated Groovy syntax (group 'x', project.version '1') only works through the property-setter fallback, so it never has a method type. Added a no-op test for Matcher.group(int) with propertyName: group.

What's your motivation?

With propertyName: group (part of UseAssignmentForPropertySyntax / MigrateToGradle8), any single-argument call named group was converted, including regular method calls in build script logic:

 def m = java.util.regex.Pattern.compile("(\\d+\\.\\d+\\.\\d+).*").matcher(version.toString())
 if (m.find()) {
-    milestoneLabel = m.group(1)
+    milestoneLabel = m.group = 1
 }

Gradle then fails to evaluate the script: No such property: group for class: java.util.regex.Matcher. Seen in LogNet/grpc-spring-boot-starter.

The deprecated Groovy syntax relies on the property-setter fallback and never resolves to a declared method. A call that does, such as `matcher.group(1)` in a build script, was rewritten to `matcher.group = 1`, which fails to evaluate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Ready to Review

Development

Successfully merging this pull request may close these issues.

2 participants