[
https://issues.apache.org/jira/browse/GROOVY-12626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18139912#comment-18139912
]
ASF GitHub Bot commented on GROOVY-12626:
-----------------------------------------
testlens-app[bot] commented on PR #3152:
URL: https://github.com/apache/groovy/pull/3152#issuecomment-6695515146
## 🚨 All tests passed but jobs failed 🚨
### Failed Jobs without Test Failures
❌ [Build and test / lts \(17, windows-latest,
1\)](https://github.com/apache/groovy/actions/runs/42282881413/job/128116126121?pr=3152)
🏷️ Commit: 3b6aa7ff063ac831656af61ad11b0b145cd90b00
▶️ Tests: 63884 executed
⚪️ Checks: 26/26 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
- [ ] **Rerun jobs**
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> SC: a bare private field name in an enum constant body, or in an anonymous
> subclass created in a static method, fails with VerifyError
> --------------------------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12626
> URL: https://issues.apache.org/jira/browse/GROOVY-12626
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 5.0.8, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> @groovy.transform.CompileStatic
> enum E { A { def n() { z } }; private String z = 'x' }
> assert E.A.n() == 'x'
> {code}
> Actual: {{java.lang.VerifyError: Bad type on operand stack}}. The same
> happens for this.z, assignment, compound assignment, a closure, a lambda or
> an anonymous class in the constant body. It also happens for an anonymous
> subclass created in a static method of the declaring class:
> {code:groovy}
> @groovy.transform.CompileStatic
> class B { private String z = 'x'; static B make() { new B() { String
> toString() { z } } } }
> assert B.make().toString() == 'x'
> {code}
> Expected: the field the class inherits is read and written; both scripts pass.
> Cause: the static compiler rewrites the field access through the enclosing E
> instance because it treats the constant body (and the anonymous class) as
> having an enclosing instance of the declaring class. Neither has one: the
> constant body is created by the enum's static initializer, and the anonymous
> class by a static method.
> Seen in 5.0.8 and 6.0.0; 4.0.33 compiles it to a dynamic access that throws
> MissingPropertyException.
> PR: https://github.com/apache/groovy/pull/3152
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)