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 2016/06/02 02:50:59 UTC
[jira] [Updated] (GROOVY-7291) Declaration of double variable
without value assignment referrenced in closure
[ https://issues.apache.org/jira/browse/GROOVY-7291?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-7291:
------------------------------
Description:
I have problem with following code:
{code}
double a;
def b = {
a = a + 1;
}
b();
{code}
I tried to compile it with groovy 1.8.6 and it worked
variable 'a' was instantiated with value 0.0
but after upgrade to groovy 2.2.1
it throws NullPointerException because variable 'a' is instantiated to null
I tried to decompile class files and declaration of 'a' looked like this:
version 1.8.6
{noformat}
CallSite[] var1 = $getCallSiteArray();
final Reference a = new Reference((Double)DefaultTypeTransformation.box(0.0D));
DefaultTypeTransformation.doubleUnbox(a.get());
...
{noformat}
version 2.2.1
{noformat}
CallSite[] var1 = $getCallSiteArray();
final Reference a = new Reference((Object)null);
Double var10000 = (Double)a.get();
...
{noformat}
I tried it also with version 2.4.0 but it has same result as 2.2.1
In attachment are groovy classes, compiled classes and consoleOutputs for versions 1.8.6 and 2.2.1
was:
I have problem with following code:
double a;
def b = {
a = a + 1;
}
b();
I tried to compile it with groovy 1.8.6 and it worked
variable 'a' was instantiated with value 0.0
but after upgrade to groovy 2.2.1
it throws NullPointerException because variable 'a' is instantiated to null
I tried to decompile class files and declaration of 'a' looked like this:
version 1.8.6
CallSite[] var1 = $getCallSiteArray();
final Reference a = new Reference((Double)DefaultTypeTransformation.box(0.0D));
DefaultTypeTransformation.doubleUnbox(a.get());
...
version 2.2.1
CallSite[] var1 = $getCallSiteArray();
final Reference a = new Reference((Object)null);
Double var10000 = (Double)a.get();
...
I tried it also with version 2.4.0 but it has same result as 2.2.1
In attachment are groovy classes, compiled classes and consoleOutputs for versions 1.8.6 and 2.2.1
> Declaration of double variable without value assignment referrenced in closure
> ------------------------------------------------------------------------------
>
> Key: GROOVY-7291
> URL: https://issues.apache.org/jira/browse/GROOVY-7291
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 1.8.6, 2.2.1, 2.4.0
> Environment: Windows 8.1, JDK 1.7_71 and 1.8_25
> Reporter: David Richter
> Priority: Critical
> Attachments: groovyBug.zip
>
>
> I have problem with following code:
> {code}
> double a;
> def b = {
> a = a + 1;
> }
> b();
> {code}
> I tried to compile it with groovy 1.8.6 and it worked
> variable 'a' was instantiated with value 0.0
> but after upgrade to groovy 2.2.1
> it throws NullPointerException because variable 'a' is instantiated to null
> I tried to decompile class files and declaration of 'a' looked like this:
> version 1.8.6
> {noformat}
> CallSite[] var1 = $getCallSiteArray();
> final Reference a = new Reference((Double)DefaultTypeTransformation.box(0.0D));
> DefaultTypeTransformation.doubleUnbox(a.get());
> ...
> {noformat}
> version 2.2.1
> {noformat}
> CallSite[] var1 = $getCallSiteArray();
> final Reference a = new Reference((Object)null);
> Double var10000 = (Double)a.get();
> ...
> {noformat}
> I tried it also with version 2.4.0 but it has same result as 2.2.1
> In attachment are groovy classes, compiled classes and consoleOutputs for versions 1.8.6 and 2.2.1
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)