[
https://issues.apache.org/jira/browse/GROOVY-11372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-11372:
---------------------------------
Description:
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
isser/getter to determine property type. This only works for matched methods
like "MetaClass getMetaClass()" and "void setMetaClass(MetaClass mc)".
GROOVY-9115, GROOVY-9123, GROOVY-11370
was:
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
isser/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
> 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: 3.0.21, 4.0.21
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> 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
> isser/getter to determine property type. This only works for matched 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)