You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2018/12/17 07:51:00 UTC
[jira] [Commented] (GROOVY-6335) MissingPropertyException when
static property is used inside a nested closure and called from a child
class
[ https://issues.apache.org/jira/browse/GROOVY-6335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16722761#comment-16722761 ]
Paul King commented on GROOVY-6335:
-----------------------------------
Assuming GROOVY-7233 is closed (PR pending), then this scenario is catered for using:
{code}
import groovy.transform.*
import groovy.util.logging.*
import static groovy.transform.options.Visibility.*
@VisibilityOptions(value = PROTECTED)
@Log
class A {
void logSth() {
2.times { 1.times { log.info 'sth' } }
}
}
class B extends A {}
new B().logSth()
{code}
> MissingPropertyException when static property is used inside a nested closure and called from a child class
> -----------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-6335
> URL: https://issues.apache.org/jira/browse/GROOVY-6335
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 2.1.2, 2.4.0-rc-1
> Reporter: Marcin Erdmann
> Priority: Major
>
> The folowing throws a MissingPropertyException:
> {code}
> import groovy.util.logging.*
> @Log
> class A {
> void logSth() {
> 2.times { 1.times { log.info 'sth' } }
> }
> }
> class B extends A {}
> new B().logSth()
> {code}
> Note that exception is not thrown if the method is called on the parent class ({{new A().logSth()}}) and if log property is accessed from a non-nested closure.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)