groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwagenleit...@apache.org
Subject groovy git commit: Fix FastStringUtilsTest for jdk9 (GROOVY-7716)
Date Tue, 05 Jan 2016 22:48:02 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X d73ad00f1 -> 23ad731c4


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/23ad731c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/23ad731c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/23ad731c

Branch: refs/heads/GROOVY_2_4_X
Commit: 23ad731c49dceda51e5ff324d1cfed48d7d65c49
Parents: d73ad00
Author: John Wagenleitner <jwagenleitner@apache.org>
Authored: Tue Jan 5 14:22:03 2016 -0800
Committer: John Wagenleitner <jwagenleitner@apache.org>
Committed: Tue Jan 5 14:45:47 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/23ad731c/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')
+            }
         }
     }
 


Mime
View raw message