[
https://issues.apache.org/jira/browse/GROOVY-12525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18133818#comment-18133818
]
ASF GitHub Bot commented on GROOVY-12525:
-----------------------------------------
testlens-app[bot] commented on PR #3066:
URL: https://github.com/apache/groovy/pull/3066#issuecomment-6479430070
## ✅ All tests passed ✅
🏷️ Commit: f50bfce8bc82e0704dedabeba0cfcc52edc73443
▶️ Tests: 124110 executed
⚪️ Checks: 32/32 completed
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> STC accepts a call to an isX() or getX() accessor that the property does not
> generate
> -------------------------------------------------------------------------------------
>
> Key: GROOVY-12525
> URL: https://issues.apache.org/jira/browse/GROOVY-12525
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 6.0.0
> Reporter: Scott Murphy Heiberg
> Assignee: Daniel Sun
> Priority: Major
>
> The type checker accepts a call to an accessor method that a property would
> generate, also when the property does not generate it, and the call then
> fails at run time in every mode:
> {code:groovy}
> @groovy.transform.TypeChecked
> class Box {
> boolean flag = true
> boolean getFlag() { flag } // with an explicit getFlag(), no isFlag() is
> generated
> }
> @groovy.transform.TypeChecked
> class C {
> boolean test(Box b) { b.isFlag() }
> }
> new C().test(new Box()) // MissingMethodException: No signature of method:
> isFlag for class: Box
> {code}
> Dynamic Groovy throws the same exception. Under {{@CompileStatic}} the call
> compiles to {{Box.isFlag()}} and fails with {{NoSuchMethodError: 'boolean
> Box.isFlag()'}}. The same happens for {{b.getFlag()}} when {{Box}} declares
> {{isFlag()}} instead, and for {{b.isFlag()}} on a {{Boolean flag}} property,
> which only gets {{getFlag()}}. Without an explicit accessor, a {{boolean}}
> property gets both, and the call works. Seen in 4.0.33, 5.0.8, 6.0.0 and
> master.
> Expected: "Cannot find matching method Box#isFlag()".
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)