You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2016/01/05 23:43:48 UTC

groovy git commit: Fix FastStringUtilsTest for jdk9 (GROOVY-7716)

Repository: groovy
Updated Branches:
  refs/heads/master c5f17abbe -> 3115cfdef


Fix FastStringUtilsTest for jdk9 (GROOVY-7716)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/3115cfde
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/3115cfde
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/3115cfde

Branch: refs/heads/master
Commit: 3115cfdef8f1658c2921b3c6993d04b74c6b45d8
Parents: c5f17ab
Author: John Wagenleitner <jw...@apache.org>
Authored: Tue Jan 5 14:22:03 2016 -0800
Committer: John Wagenleitner <jw...@apache.org>
Committed: Tue Jan 5 14:30:26 2016 -0800

----------------------------------------------------------------------
 .../groovy/groovy/json/internal/FastStringUtilsTest.groovy  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/3115cfde/subprojects/groovy-json/src/test/groovy/groovy/json/internal/FastStringUtilsTest.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/test/groovy/groovy/json/internal/FastStringUtilsTest.groovy b/subprojects/groovy-json/src/test/groovy/groovy/json/internal/FastStringUtilsTest.groovy
index e39cf5a..1c31673 100644
--- a/subprojects/groovy-json/src/test/groovy/groovy/json/internal/FastStringUtilsTest.groovy
+++ b/subprojects/groovy-json/src/test/groovy/groovy/json/internal/FastStringUtilsTest.groovy
@@ -24,7 +24,14 @@ class FastStringUtilsTest extends GroovyTestCase {
         synchronized (FastStringUtils) {
             def str = "some test"
             // FastStringUtils accesses the underlying char array directly
-            assert FastStringUtils.toCharArray(str).is(str.value) : FastStringUtils.STRING_IMPLEMENTATION.toString()
+            if (str.value instanceof char[]) {
+                assert FastStringUtils.toCharArray(str).is(str.value) : FastStringUtils.STRING_IMPLEMENTATION.toString()
+            } else if (str.value instanceof byte[]) {
+                // jdk9
+                assert FastStringUtils.toCharArray(str) == str.toCharArray()
+            } else {
+                fail('unexpected type encountered for String value field')
+            }
         }
     }