[ 
https://issues.apache.org/jira/browse/GROOVY-12745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-12745:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
package p
class B {
  @groovy.transform.PackageScope static String field // or protected or private
}
{code}

{code:groovy}
@groovy.transform.CompileStatic
class C extends p.B {
  static {
    def x = field
    field = null
  }
}
{code}

Both occurrences of "field" have the error "No such property: field for class: 
C".  However, the "field = null" case still writes inferred type metadata to 
the variable expression indicating String typing.  And both cases still retain 
the accessed variable reference to the super class field.

Other cases like this clear out the accessed variable with a 
{{DynamicVariable}} (see tryVariableExpressionAsProperty).

  was:
Consider the following:
{code:groovy}
package p
class B {
  @groovy.transform.PackageScope static String field // or protected or private
}
{code}

{code:groovy}
@groovy.transform.CompileStatic
class C extends p.B {
  static {
    def x = field
    field = null
  }
}
{code}

Both occurrences of "field" have the error "No such property: field for class: 
C".  However, the "field = null" case still writes inferred type metadata to 
the variable expression.  And both cases still retain the accessed variable 
reference to the super class field.

Other cases like this clear out the accessed variable with a 
{{DynamicVariable}} (see tryVariableExpressionAsProperty).


> STC: inaccessible field or property for variable expression
> -----------------------------------------------------------
>
>                 Key: GROOVY-12745
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12745
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> package p
> class B {
>   @groovy.transform.PackageScope static String field // or protected or 
> private
> }
> {code}
> {code:groovy}
> @groovy.transform.CompileStatic
> class C extends p.B {
>   static {
>     def x = field
>     field = null
>   }
> }
> {code}
> Both occurrences of "field" have the error "No such property: field for 
> class: C".  However, the "field = null" case still writes inferred type 
> metadata to the variable expression indicating String typing.  And both cases 
> still retain the accessed variable reference to the super class field.
> Other cases like this clear out the accessed variable with a 
> {{DynamicVariable}} (see tryVariableExpressionAsProperty).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to