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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54b9843d159031758abedb83ec63b78b0f6d8f9767375cbdc2f369e1d6cc72f9
4
- data.tar.gz: f08bfca12d285572e3e8028f7d69e6e52972f3255bfeaa5b46675bc766a1f99c
3
+ metadata.gz: 60ac61ae600aa8890e18f0fac4882158d5a61983a46f727a4110536dae859c15
4
+ data.tar.gz: dac5dde733b16e27bcd2ec7bf9be2e1a381df3f9f014e528f569a691f289d4a2
5
5
  SHA512:
6
- metadata.gz: 0d26095364989129a57bb42c33fec3db622a8ffaf032b782bccde8359ae30a6ff562d588787f69f74babf265ae5f039a767d5f03e4ef3b862bc47c4ca5731f10
7
- data.tar.gz: 5475be25b476b8ce6122d87fa444efa253c9d1d54f59eb7bcc6bec440b08b21fd2de3db5e9c0f61fce75a9fdfaf625462edb2a086278e0bb063ceabd721f4d25
6
+ metadata.gz: b676bb38063011d3a562b07eef490566e7eef568780f79f51904ab2ced4db8df5a05d4ad9b09db8db9c98a2f7a8b22694266ca43f6c8b1261fd651a077d6b717
7
+ data.tar.gz: ed12fc31c05a55c788b8b685059eb920698e05bd4423f8a5dfb21a7e2ab6ffd51e48b946ab1586877d9c1742856d70e3e3af84b4bcd73a8572e22e5494647efd
@@ -1,3 +1,6 @@
1
+ v0.4.8
2
+ fix serialisation of big numbers as Ruby 2.4 unifies Fixnum and Bignum into Integer
3
+
1
4
  v0.4.4
2
5
  fix for issue 64
3
6
  Ruby parse() null/nil handling
@@ -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'
@@ -1,11 +1,11 @@
1
1
  module JrJackson
2
2
  module BuildInfo
3
3
  def self.version
4
- '0.4.7'
4
+ '0.4.8'
5
5
  end
6
6
 
7
7
  def self.release_date
8
- '2018-11-29'
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.25'
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
- jgen.writeNumber(RubyNumeric.num2long(value));
178
- break;
179
- case Bignum:
180
- jgen.writeNumber(((RubyBignum) value).getBigIntegerValue());
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());
@@ -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
- assert_equal Bignum, actual["zzz"]["bar"].class
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.7
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: 2018-11-29 00:00:00.000000000 Z
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.25.jar
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