jrjackson 0.4.6-java → 0.4.7-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Mavenfile +1 -1
- data/lib/jrjackson/build_info.rb +4 -4
- data/run_all_individual_bench.sh +12 -12
- data/src/main/java/com/jrjackson/RubyAnySerializer.java +2 -0
- data/src/main/java/com/jrjackson/RubyJacksonModule.java +4 -8
- data/test/jrjackson_test.rb +9 -9
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54b9843d159031758abedb83ec63b78b0f6d8f9767375cbdc2f369e1d6cc72f9
|
4
|
+
data.tar.gz: f08bfca12d285572e3e8028f7d69e6e52972f3255bfeaa5b46675bc766a1f99c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d26095364989129a57bb42c33fec3db622a8ffaf032b782bccde8359ae30a6ff562d588787f69f74babf265ae5f039a767d5f03e4ef3b862bc47c4ca5731f10
|
7
|
+
data.tar.gz: 5475be25b476b8ce6122d87fa444efa253c9d1d54f59eb7bcc6bec440b08b21fd2de3db5e9c0f61fce75a9fdfaf625462edb2a086278e0bb063ceabd721f4d25
|
data/.gitignore
CHANGED
data/Mavenfile
CHANGED
@@ -14,7 +14,7 @@ properties 'project.build.sourceEncoding' => 'UTF-8',
|
|
14
14
|
|
15
15
|
jar 'junit:junit', '4.11', :scope => :test
|
16
16
|
|
17
|
-
jar 'org.jruby:jruby', '9.
|
17
|
+
jar 'org.jruby:jruby', '9.2.4.0', :scope => :provided
|
18
18
|
|
19
19
|
plugin :compiler, '3.1', :source => '1.8', :target => '1.8',
|
20
20
|
:showDeprecation => false,
|
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.7'
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.release_date
|
8
|
-
'2018-
|
8
|
+
'2018-11-29'
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.files
|
@@ -13,11 +13,11 @@ module JrJackson
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.jackson_version
|
16
|
-
'2.9.
|
16
|
+
'2.9.7'
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.jar_version
|
20
|
-
'1.2.
|
20
|
+
'1.2.25'
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
data/run_all_individual_bench.sh
CHANGED
@@ -3,23 +3,23 @@
|
|
3
3
|
chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/json-mri-sourced.rb
|
4
4
|
chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/oj-mri-sourced.rb
|
5
5
|
|
6
|
-
chruby-exec jruby-9.
|
7
|
-
chruby-exec jruby-9.
|
6
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-jr-sourced.rb
|
7
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-jr-sourced.rb
|
8
8
|
|
9
|
-
chruby-exec jruby-9.
|
10
|
-
chruby-exec jruby-9.
|
9
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/string-jr-sourced.rb
|
10
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/str-bd-jr-sourced.rb
|
11
11
|
|
12
|
-
chruby-exec jruby-9.
|
13
|
-
chruby-exec jruby-9.
|
12
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/symbol-jr-sourced.rb
|
13
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/sym-bd-jr-sourced.rb
|
14
14
|
|
15
|
-
chruby-exec jruby-9.
|
16
|
-
chruby-exec jruby-9.
|
15
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-jr-sourced.rb
|
16
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-bd-jr-sourced.rb
|
17
17
|
|
18
|
-
chruby-exec jruby-9.
|
18
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/sj-jr-sourced.rb
|
19
19
|
|
20
20
|
chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/json-gen-mri-sourced.rb
|
21
21
|
chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/oj-gen-mri-sourced.rb
|
22
22
|
|
23
|
-
chruby-exec jruby-9.
|
24
|
-
chruby-exec jruby-9.
|
25
|
-
chruby-exec jruby-9.
|
23
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-gen-jr-sourced.rb
|
24
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-gen-jr-sourced.rb
|
25
|
+
chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-gen-jr-sourced.rb
|
@@ -173,6 +173,7 @@ public class RubyAnySerializer extends JsonSerializer<IRubyObject> {
|
|
173
173
|
jgen.writeNumber(RubyNumeric.num2dbl(value));
|
174
174
|
break;
|
175
175
|
case Fixnum:
|
176
|
+
case Integer:
|
176
177
|
jgen.writeNumber(RubyNumeric.num2long(value));
|
177
178
|
break;
|
178
179
|
case Bignum:
|
@@ -265,6 +266,7 @@ public class RubyAnySerializer extends JsonSerializer<IRubyObject> {
|
|
265
266
|
enum RUBYCLASS {
|
266
267
|
String,
|
267
268
|
Fixnum,
|
269
|
+
Integer,
|
268
270
|
Hash,
|
269
271
|
Array,
|
270
272
|
Float,
|
@@ -12,11 +12,9 @@ import org.jruby.Ruby;
|
|
12
12
|
import org.jruby.runtime.builtin.IRubyObject;
|
13
13
|
|
14
14
|
import java.text.SimpleDateFormat;
|
15
|
+
import java.util.TimeZone;
|
15
16
|
|
16
17
|
public class RubyJacksonModule extends SimpleModule {
|
17
|
-
|
18
|
-
private static final SimpleDateFormat RDF = new RubyDateFormat("yyyy-MM-dd HH:mm:ss Z");
|
19
|
-
|
20
18
|
public static final ObjectMapper static_mapper = new ObjectMapper();
|
21
19
|
public static final JsonFactory factory = new JsonFactory(static_mapper).disable(JsonFactory.Feature.FAIL_ON_SYMBOL_HASH_OVERFLOW);
|
22
20
|
|
@@ -56,11 +54,9 @@ public class RubyJacksonModule extends SimpleModule {
|
|
56
54
|
}
|
57
55
|
|
58
56
|
public static DefaultSerializerProvider createProvider() {
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
static_mapper.getSerializerFactory()
|
63
|
-
);
|
57
|
+
SimpleDateFormat rdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
|
58
|
+
rdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
59
|
+
return createProvider(rdf);
|
64
60
|
}
|
65
61
|
|
66
62
|
public static ObjectMapper rawBigNumberMapper() {
|
data/test/jrjackson_test.rb
CHANGED
@@ -70,7 +70,7 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
70
70
|
@now = tm
|
71
71
|
end
|
72
72
|
def to_time
|
73
|
-
@now.to_time
|
73
|
+
@now.to_time.utc
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -281,7 +281,7 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
281
281
|
end
|
282
282
|
|
283
283
|
def test_serialize_non_json_datatypes_as_values
|
284
|
-
dt = Time.now
|
284
|
+
dt = Time.now.utc
|
285
285
|
today = Date.today
|
286
286
|
co1 = CustomToH.new("uno", :two, 6.0)
|
287
287
|
co2 = CustomToHash.new("uno", :two, 6.0)
|
@@ -292,12 +292,12 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
292
292
|
json_string = JrJackson::Json.dump(source)
|
293
293
|
expected = {
|
294
294
|
:sym => "a_symbol",
|
295
|
-
:dt => dt.
|
295
|
+
:dt => dt.strftime('%F %T %z'),
|
296
296
|
:co1 => {:one => "uno", :two => "two", :six => 6.0 },
|
297
297
|
:co2 => {:one => "uno", :two => "two", :six => 6.0 },
|
298
298
|
:co3 => {:one => 1.0, :two => 2.0, :six => 6.0 },
|
299
299
|
:co4 => [1, 2, 6],
|
300
|
-
:co5 => today.to_time.
|
300
|
+
:co5 => today.to_time.utc.strftime('%F %T %z')
|
301
301
|
}
|
302
302
|
actual = JrJackson::Json.load(json_string, :symbolize_keys => true)
|
303
303
|
assert_equal expected, actual
|
@@ -340,7 +340,7 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
340
340
|
time = Time.new(2014,6,10,18,18,40, "-04:00")
|
341
341
|
# using date_format option
|
342
342
|
assert_equal "{\"time\":\"2014-06-10\"}", JrJackson::Json.dump({"time" => time}, :date_format => "yyyy-MM-dd")
|
343
|
-
assert_match
|
343
|
+
assert_match(/\{"time"\:"\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}[+-]\d{4}"\}/, JrJackson::Json.dump({"time" => time}, :date_format => "yyyy-MM-dd'T'HH:mm:ss.SSSZ"))
|
344
344
|
end
|
345
345
|
|
346
346
|
def test_serialize_date_date_format_timezone
|
@@ -370,7 +370,7 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
370
370
|
assert_equal "żółć", actual["utf8"]
|
371
371
|
assert_equal Java::JavaUtil::HashMap, actual["zzz"].class
|
372
372
|
assert_equal Bignum, actual["zzz"]["bar"].class
|
373
|
-
assert_equal
|
373
|
+
assert_equal(-9, actual["zzz"]["bar"])
|
374
374
|
end
|
375
375
|
|
376
376
|
def test_can_parse_returning_ruby_objects_string_keys
|
@@ -451,7 +451,7 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
451
451
|
end
|
452
452
|
|
453
453
|
def test_can_parse_big_decimals
|
454
|
-
expected = BigDecimal
|
454
|
+
expected = BigDecimal('0.12345678901234567890123456789')
|
455
455
|
json = '{"foo":0.12345678901234567890123456789}'
|
456
456
|
|
457
457
|
actual = JrJackson::Json.parse(json, :use_bigdecimal => true)['foo']
|
@@ -514,7 +514,7 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
514
514
|
|
515
515
|
def test_can_mix_java_and_ruby_objects
|
516
516
|
json = '{"utf8":"żółć", "moo": "bar", "arr": [2,3,4], "flo": 3.33}'
|
517
|
-
timeobj = Time.new(2015,11,11,11,11,11).utc
|
517
|
+
timeobj = Time.new(2015,11,11,11,11,11,0).utc
|
518
518
|
expected = '{"mixed":{"arr":[2,3,4],"utf8":"żółć","flo":3.33,"zzz":{"one":1.0,"two":2,"six":6.0},"moo":"bar"},"time":"2015-11-11 11:11:11 +0000"}'
|
519
519
|
object = JrJackson::Json.parse_java(json)
|
520
520
|
object["zzz"] = CustomToJson.new(1.0, 2, 6.0)
|
@@ -546,7 +546,7 @@ class JrJacksonTest < Test::Unit::TestCase
|
|
546
546
|
end
|
547
547
|
|
548
548
|
def assert_bigdecimal_similar(expected, actual)
|
549
|
-
assert_equal BigDecimal
|
549
|
+
assert_equal BigDecimal(expected.to_s).round(11), BigDecimal(actual.to_s).round(11)
|
550
550
|
assert_equal Java::JavaMath::BigDecimal, actual.class
|
551
551
|
end
|
552
552
|
end
|
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.7
|
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
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,13 +60,13 @@ files:
|
|
60
60
|
- alt_bench.rb
|
61
61
|
- changelog.md
|
62
62
|
- jrjackson.gemspec
|
63
|
-
- lib/com/fasterxml/jackson/core/jackson-annotations/2.9.
|
64
|
-
- lib/com/fasterxml/jackson/core/jackson-core/2.9.
|
65
|
-
- lib/com/fasterxml/jackson/core/jackson-databind/2.9.
|
66
|
-
- lib/com/fasterxml/jackson/module/jackson-module-afterburner/2.9.
|
63
|
+
- lib/com/fasterxml/jackson/core/jackson-annotations/2.9.7/jackson-annotations-2.9.7.jar
|
64
|
+
- lib/com/fasterxml/jackson/core/jackson-core/2.9.7/jackson-core-2.9.7.jar
|
65
|
+
- lib/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar
|
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.25.jar
|
70
70
|
- lib/jrjackson/jrjackson.rb
|
71
71
|
- lib/jrjackson_jars.rb
|
72
72
|
- lib/require_relative_patch.rb
|
@@ -134,12 +134,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements:
|
137
|
-
- jar com.fasterxml.jackson.core:jackson-core, 2.9.
|
138
|
-
- jar com.fasterxml.jackson.core:jackson-annotations, 2.9.
|
139
|
-
- jar com.fasterxml.jackson.core:jackson-databind, 2.9.
|
140
|
-
- jar com.fasterxml.jackson.module:jackson-module-afterburner, 2.9.
|
137
|
+
- jar com.fasterxml.jackson.core:jackson-core, 2.9.7
|
138
|
+
- jar com.fasterxml.jackson.core:jackson-annotations, 2.9.7
|
139
|
+
- jar com.fasterxml.jackson.core:jackson-databind, 2.9.7
|
140
|
+
- jar com.fasterxml.jackson.module:jackson-module-afterburner, 2.9.7
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.6
|
142
|
+
rubygems_version: 2.7.6
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: A JRuby wrapper for the java jackson json processor jar
|