summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2016-02-25 10:27:44 +0100
committerFlorian Frank <flori@ping.de>2016-02-25 10:27:44 +0100
commit8883a51ec7a56cd8bda87ab2c82924a90d7aa782 (patch)
treee4804afa8c639993f5ef4e872e201cad3a843c44 /java
parentbf8ef07bf3cf0fe7126b029b888e4054116c7c09 (diff)
parent4922d2ae6cf93d14f7d51d416f518b5945935b3a (diff)
downloadjson-8883a51ec7a56cd8bda87ab2c82924a90d7aa782.tar.gz
Merge branch 'v1.8'
Diffstat (limited to 'java')
-rw-r--r--java/src/json/ext/ByteListTranscoder.java3
-rw-r--r--java/src/json/ext/Generator.java16
-rw-r--r--java/src/json/ext/GeneratorMethods.java3
-rw-r--r--java/src/json/ext/GeneratorService.java3
-rw-r--r--java/src/json/ext/GeneratorState.java3
-rw-r--r--java/src/json/ext/OptionsReader.java3
-rw-r--r--java/src/json/ext/Parser.java3
-rw-r--r--java/src/json/ext/Parser.rl3
-rw-r--r--java/src/json/ext/ParserService.java3
-rw-r--r--java/src/json/ext/RuntimeInfo.java3
-rw-r--r--java/src/json/ext/StringDecoder.java3
-rw-r--r--java/src/json/ext/StringEncoder.java5
-rw-r--r--java/src/json/ext/Utils.java3
13 files changed, 25 insertions, 29 deletions
diff --git a/java/src/json/ext/ByteListTranscoder.java b/java/src/json/ext/ByteListTranscoder.java
index ed9e54b..6f6ab66 100644
--- a/java/src/json/ext/ByteListTranscoder.java
+++ b/java/src/json/ext/ByteListTranscoder.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/Generator.java b/java/src/json/ext/Generator.java
index ecceb27..bb3a394 100644
--- a/java/src/json/ext/Generator.java
+++ b/java/src/json/ext/Generator.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
@@ -428,11 +427,14 @@ public final class Generator {
new Handler<IRubyObject>() {
@Override
RubyString generateNew(Session session, IRubyObject object) {
- IRubyObject result =
- object.callMethod(session.getContext(), "to_json",
- new IRubyObject[] {session.getState()});
- if (result instanceof RubyString) return (RubyString)result;
- throw session.getRuntime().newTypeError("to_json must return a String");
+ if (object.respondsTo("to_json")) {
+ IRubyObject result = object.callMethod(session.getContext(), "to_json",
+ new IRubyObject[] {session.getState()});
+ if (result instanceof RubyString) return (RubyString)result;
+ throw session.getRuntime().newTypeError("to_json must return a String");
+ } else {
+ return OBJECT_HANDLER.generateNew(session, object);
+ }
}
@Override
diff --git a/java/src/json/ext/GeneratorMethods.java b/java/src/json/ext/GeneratorMethods.java
index 637b579..bde7a18 100644
--- a/java/src/json/ext/GeneratorMethods.java
+++ b/java/src/json/ext/GeneratorMethods.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/GeneratorService.java b/java/src/json/ext/GeneratorService.java
index ed33639..e665ad1 100644
--- a/java/src/json/ext/GeneratorService.java
+++ b/java/src/json/ext/GeneratorService.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/GeneratorState.java b/java/src/json/ext/GeneratorState.java
index db4f3f5..11d98d0 100644
--- a/java/src/json/ext/GeneratorState.java
+++ b/java/src/json/ext/GeneratorState.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/OptionsReader.java b/java/src/json/ext/OptionsReader.java
index 8212503..9bb6e64 100644
--- a/java/src/json/ext/OptionsReader.java
+++ b/java/src/json/ext/OptionsReader.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/Parser.java b/java/src/json/ext/Parser.java
index 37423f5..5458fb1 100644
--- a/java/src/json/ext/Parser.java
+++ b/java/src/json/ext/Parser.java
@@ -3,8 +3,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/Parser.rl b/java/src/json/ext/Parser.rl
index 6d65963..d43c74f 100644
--- a/java/src/json/ext/Parser.rl
+++ b/java/src/json/ext/Parser.rl
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/ParserService.java b/java/src/json/ext/ParserService.java
index dde8834..b6015f9 100644
--- a/java/src/json/ext/ParserService.java
+++ b/java/src/json/ext/ParserService.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/RuntimeInfo.java b/java/src/json/ext/RuntimeInfo.java
index 5de5740..ceaca5b 100644
--- a/java/src/json/ext/RuntimeInfo.java
+++ b/java/src/json/ext/RuntimeInfo.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/StringDecoder.java b/java/src/json/ext/StringDecoder.java
index 6023113..76cf183 100644
--- a/java/src/json/ext/StringDecoder.java
+++ b/java/src/json/ext/StringDecoder.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;
diff --git a/java/src/json/ext/StringEncoder.java b/java/src/json/ext/StringEncoder.java
index 57bd19b..9d40dd3 100644
--- a/java/src/json/ext/StringEncoder.java
+++ b/java/src/json/ext/StringEncoder.java
@@ -1,3 +1,8 @@
+/*
+ * This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
+ *
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
+ */
package json.ext;
import org.jruby.exceptions.RaiseException;
diff --git a/java/src/json/ext/Utils.java b/java/src/json/ext/Utils.java
index 44d6a55..ed6f832 100644
--- a/java/src/json/ext/Utils.java
+++ b/java/src/json/ext/Utils.java
@@ -1,8 +1,7 @@
/*
* This code is copyrighted work by Daniel Luz <dev at mernen dot com>.
*
- * Distributed under the Ruby and GPLv2 licenses; see COPYING and GPL files
- * for details.
+ * Distributed under the Ruby license: https://www.ruby-lang.org/en/about/license.txt
*/
package json.ext;