[
https://issues.apache.org/jira/browse/GROOVY-12523?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135598#comment-18135598
]
ASF GitHub Bot commented on GROOVY-12523:
-----------------------------------------
testlens-app[bot] commented on PR #3050:
URL: https://github.com/apache/groovy/pull/3050#issuecomment-6539710439
## 🚨 All tests passed but jobs failed 🚨
### Failed Jobs without Test Failures
❌ [Build and test / lts \(17,
macos-latest\)](https://github.com/apache/groovy/actions/runs/41169498094/job/124444176933?pr=3050)
❌ [Build and test / lts \(17,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169498094/job/124444176899?pr=3050)
❌ [Build and test / lts \(17, windows-latest,
1\)](https://github.com/apache/groovy/actions/runs/41169498094/job/124444176957?pr=3050)
❌ [Build and test / lts \(21,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169498094/job/124444176883?pr=3050)
❌ [Build and test / lts \(25,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41169498094/job/124444176687?pr=3050)
🏷️ Commit: 44fad5ddc861525f786f5d91942f7a6f1cd9f6d0
▶️ Tests: 43374 executed
🟡 Checks: 24/25 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/)._
> STC: x.@name is accepted for a private field of a superclass when the type of
> x is a subclass
> ---------------------------------------------------------------------------------------------
>
> Key: GROOVY-12523
> URL: https://issues.apache.org/jira/browse/GROOVY-12523
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> In a class nested in {{Outer}}, the type checker accepts {{sub.@f}}, where
> {{f}} is a private field of {{Outer}} and {{sub}} is typed as a subclass of
> {{Outer}}:
> {code:groovy}
> @groovy.transform.TypeChecked
> class Outer {
> private String f = 'outer'
> static class Sub extends Outer {
> String read(Sub sub) { sub.@f }
> }
> }
> new Outer.Sub().read(new Outer.Sub()) // MissingFieldException: No such
> field: f for class: Outer$Sub
> {code}
> Dynamic Groovy and {{@TypeChecked}} throw {{MissingFieldException}}, because
> the meta-class of a subclass offers no private field of its superclass.
> {{@CompileStatic}} reads the field. javac rejects {{sub.f}} ("f has private
> access in Outer"), since a private field is not a member of a subclass (JLS
> 8.2). With {{f}} declared in a nested class {{Box}} and {{Sub extends Box}},
> or with a top-level subclass, the type checker already rejects {{sub.@f}}
> with "Cannot access field". Seen in 5.0.8, 6.0.0 and master; 4.0.33 failed at
> run time in every mode.
> Expected: "Cannot access field: f of class: Outer", also for writes,
> closures, lambdas and {{new Sub().@f}}. {{this.@f}}, {{super.@f}}, {{((Outer)
> sub).@f}} and {{sub.@f}} inside {{Outer}} keep compiling.
> PR: https://github.com/apache/groovy/pull/3050
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)