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

Aleks Tamarkin updated GROOVY-11745:
------------------------------------
    Description: 
When Groovy5 calls Groovy4 code that sets a property which should be calling a 
setter under the hood, an NPE is thrown.

The stack looks like 
 
{code:java}
Exception in thread "main" java.lang.NullPointerException 
  at java.base/java.lang.Class.isAssignableFrom(Native Method) 
  at groovy.lang.MetaClassImpl.isVisibleProperty(MetaClassImpl.java:2104) 
  at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2761) 
  at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:509){code}
I am seeing this error fairly randomly on setters. 

One example in the Groovy4 code being called by Groovy5 looks like 
{code:java}
HttpURLConnection c = "<someUrl>".toURL().openConnection() as HttpURLConnection
...
c.useCaches = false // this line has the error{code}
 

  was:
When Groovy5 calls Groovy4 code that sets a property which should be calling a 
setter under the hood, an NPE is thrown.

The stack looks like 
 
{code:java}
Exception in thread "main" java.lang.NullPointerException at 
java.base/java.lang.Class.isAssignableFrom(Native Method) at 
groovy.lang.MetaClassImpl.isVisibleProperty(MetaClassImpl.java:2104) at 
groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2761) at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:509){code}

I am seeing this error fairly randomly on setters. 

One example in the Groovy4 code being called by Groovy5 looks like 



{code:java}
HttpURLConnection c = "<someUrl>".toURL().openConnection() as HttpURLConnection
...
c.useCaches = false // this line has the error{code}
 


> Groovy5 calling Groovy4 library with setter throws NPE
> ------------------------------------------------------
>
>                 Key: GROOVY-11745
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11745
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.28, 5.0.0
>            Reporter: Aleks Tamarkin
>            Priority: Major
>
> When Groovy5 calls Groovy4 code that sets a property which should be calling 
> a setter under the hood, an NPE is thrown.
> The stack looks like 
>  
> {code:java}
> Exception in thread "main" java.lang.NullPointerException 
>   at java.base/java.lang.Class.isAssignableFrom(Native Method) 
>   at groovy.lang.MetaClassImpl.isVisibleProperty(MetaClassImpl.java:2104) 
>   at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2761) 
>   at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:509){code}
> I am seeing this error fairly randomly on setters. 
> One example in the Groovy4 code being called by Groovy5 looks like 
> {code:java}
> HttpURLConnection c = "<someUrl>".toURL().openConnection() as 
> HttpURLConnection
> ...
> c.useCaches = false // this line has the error{code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to