You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/07/12 19:35:04 UTC

[jira] [Updated] (GROOVY-7494) ArrayStoreException assigning GStringImpl to String[] when using Indy

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

Pascal Schumacher updated GROOVY-7494:
--------------------------------------
    Labels: indy  (was: )

> ArrayStoreException assigning GStringImpl to String[] when using Indy
> ---------------------------------------------------------------------
>
>                 Key: GROOVY-7494
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7494
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.3
>         Environment: Windows 7; Java 8
>            Reporter: Ken Scoggins
>              Labels: indy
>
> While upgrading a software baseline from Java 7/Groovy 2.0.2 to Java 8/Groovy 2.4, it appears that assigning a GString with an embedded variable reference to a String array is broken when using Indy. The following example demonstrates this issue:
> {code}
> int a = 1
> String[] fubar = new String[1]
> fubar[0] = "Item $a"
> println fubar
> {code}
> Without Indy, it works just fine:
> {panel}
> /c/test$ groovy GroovyIndyBug.groovy
> [Item 1]
> {panel}
> With Indy, we get the ArrayStoreException
> {panel}
> /c/test$ groovy -indy GroovyIndyBug.groovy
> Caught: java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
> java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
>         at GroovyIndyBug.run(GroovyIndyBug.groovy:3)
> {panel}
> I tried various other assignment methods and this appears to be the only one with the issue.  Oddly, even doing the same assignment, but at creation time instead of after, works just fine.  Some of the other related scenarios I tried are:
> {code}
> int a = 1
> String[] foo = ["Assigned At Creation $a"]
> println foo
> foo[0] = "No Embedded Variable"
> println foo
> foo[0] = "as String $a" as String
> println foo
> foo[0] = "BROKEN $a"
> println foo
> {code}
> With Indy:
> {panel}
> /c/test $ groovy -indy GroovyIndyBug.groovy
> [Assigned At Creation 1]
> [No Embedded Variable]
> [as String 1]
> Caught: java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
> java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
>         at GroovyIndyBug.run(GroovyIndyBug.groovy:12){panel}



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