[ 
https://issues.apache.org/jira/browse/GROOVY-6278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15411142#comment-15411142
 ] 

Paul King edited comment on GROOVY-6278 at 8/8/16 12:44 AM:
------------------------------------------------------------

If you replace {{return new Bar().x}} with {{def b = new Bar(); return b.x}}, 
you get:
{noformat}
Access to Bar#x is forbidden at line: 6, column: 29
{noformat}
but only for {{CompileStatic}} not {{TypeChecked}}.
So there is a partial check but in the wrong spot (currently 
{{StaticTypesCallSiteWriter}}). It needs to be earlier - probably within 
{{existsProperty}} as suggested.


was (Author: paulk):
If you replace {{return new Bar().x}} with {{def b = new Bar(); return b.x}}, 
you get:
{noformat}
Access to Bar#x is forbidden at line: 6, column: 29
{noformat}
but only for {{CompileStatic}} not {{TypeChecked}}.
So there is a partial check but in the wrong spot (currently 
{{StaticTypesCallSiteWriter}}). It needs to be earlier.

> private super class members are not ignored
> -------------------------------------------
>
>                 Key: GROOVY-6278
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6278
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.3.0
>            Reporter: Jochen Theodorou
>
> {code:Java}
> class Foo { private x=2 }
> class Bar extends Foo{}
> @groovy.transform.CompileStatic
> def foo() {
>   return new Bar().x
> }
> {code}
> the logic in existsProperty finds Foo#x, even though it is private. Groovy 
> does not allow access to super class private members. Compilation should fail 
> here in static compilation mode as well as with the type checker.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to