diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/json/ext/ByteListTranscoder.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/Generator.java | 16 | ||||
-rw-r--r-- | java/src/json/ext/GeneratorMethods.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/GeneratorService.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/GeneratorState.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/OptionsReader.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/Parser.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/Parser.rl | 3 | ||||
-rw-r--r-- | java/src/json/ext/ParserService.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/RuntimeInfo.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/StringDecoder.java | 3 | ||||
-rw-r--r-- | java/src/json/ext/StringEncoder.java | 5 | ||||
-rw-r--r-- | java/src/json/ext/Utils.java | 3 |
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; |