codeconsole commented on PR #3137: URL: https://github.com/apache/groovy/pull/3137#issuecomment-6608403166
@paulk-asert I ran the shapes from #3137 and #3147 against #3169 (its three changed files compiled over its base, eb37f3402a), dynamic and `@TypeChecked`. These now return the value, in a static nested `Sub`: `z`, `this.z`, `super.z`, closures, lambdas, `this.z = ..`, `z += ..`, `super.z = ..`, and `that.z` with `Sub that`. These still throw `MissingPropertyException`: - `sub.z` from `Other`, another nested class of `Base`, and every case in `testPrivateFieldOfSuperclassViaReceiverOfOtherClass`, where the receiver is not an instance of the calling class. That is GROOVY-10198, by design. - `super.z = ..`, `+=` and `++` in a non-static inner subclass. `MetaClassImpl.isNestmateAccessor` excludes inner subclasses, and the enclosing-instance fallback does not cover a write through `super` (GROOVY-11823). - `z`, `this.z`, `super.z` and writes in an enum constant body. `E$1` has `ACC_ENUM | ACC_FINAL` but not `ACC_STATIC`, so `isNestmateAccessor` treats it as having an enclosing instance. An anonymous subclass created in a static method (flags 0, no `this$0`) takes the same path. So under (2) the type checker still has to reject these: the #3137 rule narrowed, not dropped. Separately, #3147 makes `E.this` in an enum constant body a compile error instead of a `VerifyError`, whichever direction is taken. Given your preference for (1) on 6.0.x, I'll keep #3137 and #3147 open. Should they target `GROOVY_6_0_X`, or stay on master and be narrowed there if (2) lands? I'll extend the rule to private methods in a follow-up. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
