Eric Milles created GROOVY-11372:
------------------------------------
Summary: STC: write property via extension method
Key: GROOVY-11372
URL: https://issues.apache.org/jira/browse/GROOVY-11372
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Affects Versions: 4.0.21, 3.0.21
Reporter: Eric Milles
Assignee: Eric Milles
Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
void test(OutputStream os) {
os.bytes = new byte[0]
}
{code}
Compiler reports "No such property: bytes for class: java.io.OutputStream".
This is because {{StaticTypeCheckingVisitor#existsProperty}} looks for getter
to determine property type. This only works for matched access methods like
"MetaClass getMetaClass()" and "void setMetaClass(MetaClass mc)".
GROOVY-9115, GROOVY-9123, GROOVY-11370
--
This message was sent by Atlassian Jira
(v8.20.10#820010)