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

ASF GitHub Bot commented on GROOVY-7709:
----------------------------------------

GitHub user jwagenleitner opened a pull request:

    https://github.com/apache/groovy/pull/237

    Safely publish MetaClass so threads wont see a partially constructed 
instance

    Added final where appropriate and limited plugin variable scope in invoke 
method.
    
    Related to PR #226 (GROOVY-7709), while full synchronization may not be 
required the lazily initialized `metaClass` should probably be `volatile`.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jwagenleitner/groovy ConversionHandler

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/237.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #237
    
----
commit f33df09674728a5d919770ac941873d7f3606826
Author: John Wagenleitner <[email protected]>
Date:   2016-01-10T01:11:57Z

    Safely publish MetaClass so threads wont see a partially constructed 
instance.
    
    Added final where appropriate and limited plugin variable scope in invoke 
method.

----


> NPE with ConvertedClosure
> -------------------------
>
>                 Key: GROOVY-7709
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7709
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.5
>            Reporter: Jochen Theodorou
>             Fix For: 2.4.6
>
>
> {code}
> interface Y extends GroovyObject {}
> def cl = {println 1} as Y
> assert cl instanceof GroovyObject
> if (cl) println "!cl"
> {code}
> the code above will cause the execution of the method getMetaClass in the 
> boolean part of the "if". It looks like this code path now produces a NPE
> {code}
> java.lang.NullPointerException
>       at 
> org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:919)
>       at 
> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:902)
>       at 
> org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean(DefaultTypeTransformation.java:185)
>       at 
> org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox(DefaultTypeTransformation.java:74){code}



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

Reply via email to