[jira] [Commented] (GROOVY-7709) NPE with ConvertedClosure

2015-12-26 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on GROOVY-7709:


Github user jwagenleitner commented on a diff in the pull request:

https://github.com/apache/groovy/pull/226#discussion_r48451502
  
--- Diff: src/main/org/codehaus/groovy/runtime/ConversionHandler.java ---
@@ -189,4 +202,15 @@ public static boolean isCoreObjectMethod(Method 
method) {
 return Object.class.equals(method.getDeclaringClass());
 }
 
+private MetaClass setMetaClass(MetaClass mc) {
+metaClass = mc;
+return mc;
+}
+
+private MetaClass getMetaClass(Object proxy) {
+if (metaClass == null) {
+metaClass = ((MetaClassRegistryImpl) 
GroovySystem.getMetaClassRegistry()).getMetaClass(proxy);
--- End diff --

Not sure if this is the right way to get the `metaClass` for the `Proxy` 
object.


> 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
>
> {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)


[GitHub] groovy pull request: GROOVY-7709 - ConvertedClosure/ConvertedMap d...

2015-12-26 Thread jwagenleitner
Github user jwagenleitner commented on a diff in the pull request:

https://github.com/apache/groovy/pull/226#discussion_r48451502
  
--- Diff: src/main/org/codehaus/groovy/runtime/ConversionHandler.java ---
@@ -189,4 +202,15 @@ public static boolean isCoreObjectMethod(Method 
method) {
 return Object.class.equals(method.getDeclaringClass());
 }
 
+private MetaClass setMetaClass(MetaClass mc) {
+metaClass = mc;
+return mc;
+}
+
+private MetaClass getMetaClass(Object proxy) {
+if (metaClass == null) {
+metaClass = ((MetaClassRegistryImpl) 
GroovySystem.getMetaClassRegistry()).getMetaClass(proxy);
--- End diff --

Not sure if this is the right way to get the `metaClass` for the `Proxy` 
object.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (GROOVY-7709) NPE with ConvertedClosure

2015-12-26 Thread John Wagenleitner (JIRA)

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

John Wagenleitner commented on GROOVY-7709:
---

The same issue exists for ConvertedMap.  I posted a PR, pretty sure I'm way off 
base but thought I might as well post it and maybe it'll be worth something.  I 
tried various ways of delegating the {{GroovyObject}} calls to the 
{{ConvertedClosure}} delegate but since the object/receiver is a 
{{java.lang.reflection.Proxy}} and not really a closure it failed in the 
{{ClosureMetaclass}}.

> 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
>
> {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)


[jira] [Commented] (GROOVY-7709) NPE with ConvertedClosure

2015-12-26 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on GROOVY-7709:


GitHub user jwagenleitner opened a pull request:

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

GROOVY-7709 - ConvertedClosure/ConvertedMap do not work with interface 
extending GroovyObject

Just posting for discussion and acknowledge that there is probably a better 
fix and lots here is not being addressed other the immediate issue.  For this 
fix I borrowed from what was done in `GroovyResultSetProxy`.

Assuming this is even somewhat close to the right way to address it, it 
might make sense for the `ConvertedMap` to handle the metaClass in case the map 
has a `getMetaClass` key.

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

$ git pull https://github.com/jwagenleitner/groovy GROOVY-7709

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

https://github.com/apache/groovy/pull/226.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 #226


commit 584840327d484e9a24fd69a3cfc8a8c97fa55e86
Author: John Wagenleitner 
Date:   2015-12-27T03:17:07Z

GROOVY-7709 - ConvertedClosure/ConvertedMap do not work with interface 
extending GroovyObject




> 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
>
> {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)


[GitHub] groovy pull request: GROOVY-7709 - ConvertedClosure/ConvertedMap d...

2015-12-26 Thread jwagenleitner
GitHub user jwagenleitner opened a pull request:

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

GROOVY-7709 - ConvertedClosure/ConvertedMap do not work with interface 
extending GroovyObject

Just posting for discussion and acknowledge that there is probably a better 
fix and lots here is not being addressed other the immediate issue.  For this 
fix I borrowed from what was done in `GroovyResultSetProxy`.

Assuming this is even somewhat close to the right way to address it, it 
might make sense for the `ConvertedMap` to handle the metaClass in case the map 
has a `getMetaClass` key.

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

$ git pull https://github.com/jwagenleitner/groovy GROOVY-7709

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

https://github.com/apache/groovy/pull/226.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 #226


commit 584840327d484e9a24fd69a3cfc8a8c97fa55e86
Author: John Wagenleitner 
Date:   2015-12-27T03:17:07Z

GROOVY-7709 - ConvertedClosure/ConvertedMap do not work with interface 
extending GroovyObject




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Comment Edited] (GROOVY-7709) NPE with ConvertedClosure

2015-12-26 Thread Shil Sinha (JIRA)

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

Shil Sinha edited comment on GROOVY-7709 at 12/26/15 11:41 PM:
---

Yes, the meta class used to create the PogoMetaClassSite (in 
CallSiteArray#createPogoSite) is the value returned by the closure, which in 
this case will be null. If the closure is changed to \{ 1 \} for example, the 
test will instead fail with:
{code}
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
groovy.lang.MetaClass
{code}


was (Author: shils):
Yes, the meta class used to create the PogoMetaClassSite (in 
CallSiteArray#createPogoSite) is the value returned by the closure, which in 
this case will be null. If the closure is changed to { 1 } for example, the 
test will instead fail with:
{code}
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
groovy.lang.MetaClass
{code}

> 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
>
> {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)


[jira] [Commented] (GROOVY-7709) NPE with ConvertedClosure

2015-12-26 Thread Shil Sinha (JIRA)

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

Shil Sinha commented on GROOVY-7709:


Yes, the meta class used to create the PogoMetaClassSite (in 
CallSiteArray#createPogoSite) is the value returned by the closure, which in 
this case will be null. If the closure is changed to { 1 } for example, the 
test will instead fail with:
{code}
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
groovy.lang.MetaClass
{code}

> 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
>
> {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)


[jira] [Commented] (GROOVY-7716) groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails on jdk9

2015-12-26 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on GROOVY-7716:


GitHub user jwagenleitner opened a pull request:

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

GROOVY-7716 - groovy.json.internal.FastStringUtils fails on jdk9

JDK 9 Compat Strings enhancement changed the internal representation of the 
value field from a char[] to a combination of a byte[] and an encoding flag 
field (see http://openjdk.java.net/jeps/254).  As a workaround this change 
allows fallback to the normal String#toCharArray method and bypasses using 
direct access.

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

$ git pull https://github.com/jwagenleitner/groovy GROOVY-7716

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

https://github.com/apache/groovy/pull/225.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 #225


commit d6d9647c75edaa187c213f26e1aa3ac2ea708277
Author: John Wagenleitner 
Date:   2015-12-26T21:35:01Z

GROOVY-7716 - 
groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails on 
jdk9

JDK 9 Compat Strings enhancement changed the internal representation of the 
value field from a char[] to a combination of a byte[] and an encoding flag 
field (see http://openjdk.java.net/jeps/254).  As a workaround this change 
allows fallback to the normal String#toCharArray method and bypasses using 
direct access.




> groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails 
> on jdk9
> ---
>
> Key: GROOVY-7716
> URL: https://issues.apache.org/jira/browse/GROOVY-7716
> Project: Groovy
>  Issue Type: Bug
>  Components: JSON
>Affects Versions: 2.3.10, 2.4.5
>Reporter: Nikita Salnikov-Tarnovski
>  Labels: jdk9
>
> Trying to build my application on recent jdk9 build I got the following 
> exception:
> java.lang.ClassCastException: [B cannot be cast to [C
>   at 
> groovy.json.internal.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:88)
>   at 
> groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:175)
>   at groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:103)
>   at groovy.json.JsonSlurper.parseText(JsonSlurper.java:208)
> I believe that jdk9 has changed the inner representation of Strings (see 
> http://openjdk.java.net/jeps/254).



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


[GitHub] groovy pull request: GROOVY-7716 - groovy.json.internal.FastString...

2015-12-26 Thread jwagenleitner
GitHub user jwagenleitner opened a pull request:

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

GROOVY-7716 - groovy.json.internal.FastStringUtils fails on jdk9

JDK 9 Compat Strings enhancement changed the internal representation of the 
value field from a char[] to a combination of a byte[] and an encoding flag 
field (see http://openjdk.java.net/jeps/254).  As a workaround this change 
allows fallback to the normal String#toCharArray method and bypasses using 
direct access.

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

$ git pull https://github.com/jwagenleitner/groovy GROOVY-7716

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

https://github.com/apache/groovy/pull/225.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 #225


commit d6d9647c75edaa187c213f26e1aa3ac2ea708277
Author: John Wagenleitner 
Date:   2015-12-26T21:35:01Z

GROOVY-7716 - 
groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails on 
jdk9

JDK 9 Compat Strings enhancement changed the internal representation of the 
value field from a char[] to a combination of a byte[] and an encoding flag 
field (see http://openjdk.java.net/jeps/254).  As a workaround this change 
allows fallback to the normal String#toCharArray method and bypasses using 
direct access.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] groovy pull request: ReferenceManager.createThresholdedIdlingManag...

2015-12-26 Thread asfgit
Github user asfgit closed the pull request at:

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (GROOVY-7716) groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails on jdk9

2015-12-26 Thread John Wagenleitner (JIRA)

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

John Wagenleitner commented on GROOVY-7716:
---

Passing "-Dgroovy.json.faststringutils.disable=true" to the program could be 
used as a workaround for this issue until it's fixed.

> groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails 
> on jdk9
> ---
>
> Key: GROOVY-7716
> URL: https://issues.apache.org/jira/browse/GROOVY-7716
> Project: Groovy
>  Issue Type: Bug
>  Components: JSON
>Affects Versions: 2.3.10, 2.4.5
>Reporter: Nikita Salnikov-Tarnovski
>  Labels: jdk9
>
> Trying to build my application on recent jdk9 build I got the following 
> exception:
> java.lang.ClassCastException: [B cannot be cast to [C
>   at 
> groovy.json.internal.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:88)
>   at 
> groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:175)
>   at groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:103)
>   at groovy.json.JsonSlurper.parseText(JsonSlurper.java:208)
> I believe that jdk9 has changed the inner representation of Strings (see 
> http://openjdk.java.net/jeps/254).



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


[jira] [Updated] (GROOVY-7716) groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails on jdk9

2015-12-26 Thread Pascal Schumacher (JIRA)

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

Pascal Schumacher updated GROOVY-7716:
--
Affects Version/s: 2.4.5
  Component/s: JSON

> groovy.json.internal.FastStringUtils.StringImplementation#toCharArray fails 
> on jdk9
> ---
>
> Key: GROOVY-7716
> URL: https://issues.apache.org/jira/browse/GROOVY-7716
> Project: Groovy
>  Issue Type: Bug
>  Components: JSON
>Affects Versions: 2.3.10, 2.4.5
>Reporter: Nikita Salnikov-Tarnovski
>  Labels: jdk9
>
> Trying to build my application on recent jdk9 build I got the following 
> exception:
> java.lang.ClassCastException: [B cannot be cast to [C
>   at 
> groovy.json.internal.FastStringUtils$StringImplementation$1.toCharArray(FastStringUtils.java:88)
>   at 
> groovy.json.internal.FastStringUtils.toCharArray(FastStringUtils.java:175)
>   at groovy.json.internal.BaseJsonParser.parse(BaseJsonParser.java:103)
>   at groovy.json.JsonSlurper.parseText(JsonSlurper.java:208)
> I believe that jdk9 has changed the inner representation of Strings (see 
> http://openjdk.java.net/jeps/254).



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