You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "John Wagenleitner (JIRA)" <ji...@apache.org> on 2015/12/31 23:48:39 UTC

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

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

John Wagenleitner resolved GROOVY-7716.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.4.6

Since the internal representation changed from a char[] to a byte[] + encoding flag field for jdk 9 the fix falls back to using {{String#toCharArray}}.  I suspect that not having the optimization for jdk9+ wont cause any significant performance issues and at some point it might be worth completely removing {{sun.misc.Unsafe}} since the only use in the codebase is in {{groovy.json.internal.FastStringUtils}}.

> 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
>             Fix For: 2.4.6
>
>
> 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)