[
https://issues.apache.org/jira/browse/GROOVY-12524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18133809#comment-18133809
]
ASF GitHub Bot commented on GROOVY-12524:
-----------------------------------------
testlens-app[bot] commented on PR #3064:
URL: https://github.com/apache/groovy/pull/3064#issuecomment-6479141493
## ✅ All tests passed ✅
🏷️ Commit: dd50f51fc12712e81952b5b1f3ecabb625cc307d
▶️ Tests: 124070 executed
⚪️ Checks: 32/32 completed
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> SC: a compound assignment to a property defined by extension methods fails
> with "Access to ... is forbidden"
> ------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12524
> URL: https://issues.apache.org/jira/browse/GROOVY-12524
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation
> Affects Versions: 6.0.0
> Reporter: Scott Murphy Heiberg
> Assignee: Daniel Sun
> Priority: Major
>
> Under {{@CompileStatic}}, a compound assignment to a property whose accessors
> are extension methods does not compile:
> {code:groovy}
> @groovy.transform.CompileStatic
> class C {
> String test(File file) {
> file.text += 'b' // Access to java.io.File#text is forbidden
> file.text
> }
> }
> {code}
> Reading {{file.text}} and assigning {{file.text = 'b'}} compile to direct
> calls of the extension methods {{getText(File)}} and {{setText(File,
> String)}}, and dynamic Groovy and {{@TypeChecked}} run the compound
> assignment. The same error is reported for {{this.text += 'b'}} and {{text +=
> 'b'}} in a subclass of {{File}}. Seen in 4.0.33, 5.0.8, 6.0.0 and master.
> Expected: the compound assignment compiles to calls of the extension methods,
> like the read and the plain assignment.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)