jrjackson 0.4.7-java → 0.4.8-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/changelog.md +3 -0
- data/jrjackson.gemspec +1 -0
- data/lib/jrjackson/build_info.rb +3 -3
- data/src/main/java/com/jrjackson/RubyAnySerializer.java +15 -5
- data/test/jrjackson_test.rb +12 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60ac61ae600aa8890e18f0fac4882158d5a61983a46f727a4110536dae859c15
|
4
|
+
data.tar.gz: dac5dde733b16e27bcd2ec7bf9be2e1a381df3f9f014e528f569a691f289d4a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b676bb38063011d3a562b07eef490566e7eef568780f79f51904ab2ced4db8df5a05d4ad9b09db8db9c98a2f7a8b22694266ca43f6c8b1261fd651a077d6b717
|
7
|
+
data.tar.gz: ed12fc31c05a55c788b8b685059eb920698e05bd4423f8a5dfb21a7e2ab6ffd51e48b946ab1586877d9c1742856d70e3e3af84b4bcd73a8572e22e5494647efd
|
data/changelog.md
CHANGED
data/jrjackson.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.summary = %q{A JRuby wrapper for the java jackson json processor jar}
|
17
17
|
s.description = %q{A mostly native JRuby wrapper for the java jackson json processor jar}
|
18
18
|
s.license = 'Apache License 2.0'
|
19
|
+
s.require_paths = ["lib"]
|
19
20
|
|
20
21
|
s.add_development_dependency 'bundler', '~> 1.10'
|
21
22
|
s.add_development_dependency 'jar-dependencies', '< 2.0', '>= 0.3.2'
|
data/lib/jrjackson/build_info.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module JrJackson
|
2
2
|
module BuildInfo
|
3
3
|
def self.version
|
4
|
-
'0.4.
|
4
|
+
'0.4.8'
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.release_date
|
8
|
-
'
|
8
|
+
'2019-05-01'
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.files
|
@@ -17,7 +17,7 @@ module JrJackson
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.jar_version
|
20
|
-
'1.2.
|
20
|
+
'1.2.26'
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
@@ -5,7 +5,15 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
|
5
5
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
6
6
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
7
7
|
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
8
|
-
import org.jruby
|
8
|
+
import org.jruby.RubyArray;
|
9
|
+
import org.jruby.RubyClass;
|
10
|
+
import org.jruby.RubyException;
|
11
|
+
import org.jruby.RubyHash;
|
12
|
+
import org.jruby.RubyNumeric;
|
13
|
+
import org.jruby.RubyObject;
|
14
|
+
import org.jruby.RubyString;
|
15
|
+
import org.jruby.RubyStruct;
|
16
|
+
import org.jruby.RubyTime;
|
9
17
|
import org.jruby.ext.bigdecimal.RubyBigDecimal;
|
10
18
|
import org.jruby.internal.runtime.methods.DynamicMethod;
|
11
19
|
import org.jruby.java.proxies.JavaProxy;
|
@@ -172,12 +180,14 @@ public class RubyAnySerializer extends JsonSerializer<IRubyObject> {
|
|
172
180
|
case Float:
|
173
181
|
jgen.writeNumber(RubyNumeric.num2dbl(value));
|
174
182
|
break;
|
183
|
+
case Bignum:
|
175
184
|
case Fixnum:
|
176
185
|
case Integer:
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
186
|
+
if (value.getJavaClass() == long.class) {
|
187
|
+
jgen.writeNumber(((RubyNumeric) value).getLongValue());
|
188
|
+
} else {
|
189
|
+
jgen.writeNumber(((RubyNumeric) value).getBigIntegerValue());
|
190
|
+
}
|
181
191
|
break;
|
182
192
|
case BigDecimal:
|
183
193
|
jgen.writeNumber(((RubyBigDecimal) value).getBigDecimalValue());
|
data/test/jrjackson_test.rb
CHANGED
@@ -369,7 +369,12 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
369
369
|
assert_equal "bar", actual["moo"]
|
370
370
|
assert_equal "żółć", actual["utf8"]
|
371
371
|
assert_equal Java::JavaUtil::HashMap, actual["zzz"].class
|
372
|
-
|
372
|
+
if 1.class == Integer
|
373
|
+
# avoid deprecation warning as Ruby 2.4 unifies Fixnum and Bignum into Integer
|
374
|
+
assert_equal Integer, actual["zzz"]["bar"].class
|
375
|
+
else
|
376
|
+
assert_equal Bignum, actual["zzz"]["bar"].class
|
377
|
+
end
|
373
378
|
assert_equal(-9, actual["zzz"]["bar"])
|
374
379
|
end
|
375
380
|
|
@@ -537,6 +542,12 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
537
542
|
assert_equal "{\"foo\":\"#{BasicObject.inspect}\"}", actual
|
538
543
|
end
|
539
544
|
|
545
|
+
def test_can_handle_big_numbers
|
546
|
+
object = {"foo" => 2**63, "bar" => 65536}
|
547
|
+
actual = JrJackson::Json.dump(object)
|
548
|
+
assert_equal "{\"foo\":9223372036854775808,\"bar\":65536}", actual
|
549
|
+
end
|
550
|
+
|
540
551
|
# -----------------------------
|
541
552
|
|
542
553
|
def assert_bigdecimal_equal(expected, actual)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jrjackson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Guy Boertje
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ files:
|
|
66
66
|
- lib/com/fasterxml/jackson/module/jackson-module-afterburner/2.9.7/jackson-module-afterburner-2.9.7.jar
|
67
67
|
- lib/jrjackson.rb
|
68
68
|
- lib/jrjackson/build_info.rb
|
69
|
-
- lib/jrjackson/jars/jrjackson-1.2.
|
69
|
+
- lib/jrjackson/jars/jrjackson-1.2.26.jar
|
70
70
|
- lib/jrjackson/jrjackson.rb
|
71
71
|
- lib/jrjackson_jars.rb
|
72
72
|
- lib/require_relative_patch.rb
|