You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/12/05 18:56:00 UTC
[jira] [Updated] (GROOVY-9850) STC: add error for write of private
or package-private field of super class
[ https://issues.apache.org/jira/browse/GROOVY-9850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-9850:
--------------------------------
Description:
GROOVY-8999, GROOVY-9093, GROOVY-9136, GROOVY-9195, GROOVY-9288, GROOVY-9292, GROOVY-9293 and others cover various scenarios where read access to a field should or should not be allowed. One scenario that is yet uncovered is writing to a private or package-private field from a super class.
Consider the following:
{code:groovy}
package p
class C {
private /*or @PackageScope*/ Object field
}
{code}
{code:groovy}
package q
class D extends C {
@groovy.transform.CompileStatic
void test() {
field = null // should be error
}
}
{code}
Also need {{static}}, closure and inner class variants.
I also think that {{@TypeChecked}} is not producing errors for any field access cases. Not sure if it is desirable to limit the checks to the SC path.
was:
GROOVY-8999, GROOVY-9093, GROOVY-9136, GROOVY-9195, GROOVY-9288, GROOVY-9292, GROOVY-9293 and others cover various scenarios where read access to a field should or should not be allowed. One scenario that is yet uncovered is writing to a private or package-private field from a super class.
Consider the following:
{code:groovy}
package p
class C {
private /*or @PackageScope*/ Object field
}
{code}
{code:groovy}
package q
class D extends C {
@groovy.transform.CompileStatic
void test() {
field = null // should be error
}
}
{code}
Also need {{static}} variants.
I also think that {{@TypeChecked}} is not producing errors for any field access cases. Not sure if it is desirable to limit the checks to the SC path.
> STC: add error for write of private or package-private field of super class
> ---------------------------------------------------------------------------
>
> Key: GROOVY-9850
> URL: https://issues.apache.org/jira/browse/GROOVY-9850
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Priority: Minor
>
> GROOVY-8999, GROOVY-9093, GROOVY-9136, GROOVY-9195, GROOVY-9288, GROOVY-9292, GROOVY-9293 and others cover various scenarios where read access to a field should or should not be allowed. One scenario that is yet uncovered is writing to a private or package-private field from a super class.
> Consider the following:
> {code:groovy}
> package p
> class C {
> private /*or @PackageScope*/ Object field
> }
> {code}
> {code:groovy}
> package q
> class D extends C {
> @groovy.transform.CompileStatic
> void test() {
> field = null // should be error
> }
> }
> {code}
> Also need {{static}}, closure and inner class variants.
> I also think that {{@TypeChecked}} is not producing errors for any field access cases. Not sure if it is desirable to limit the checks to the SC path.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)