Marcono1234
4dda4ec5ba
Use diamond operator when creating generic instances ( #2104 )
2022-04-17 15:27:21 -07:00
Marcono1234
49ddab9eeb
Add CodeQL GitHub code scanning workflow ( #2076 )
...
* Add CodeQL GitHub code scanning workflow
* Only compile main sources for code scanning
* Move test .proto files to test sources
`annotations.proto` also seems to be only relevant for tests because the test
explicitly registers them as extensions. By default the Proto adapter does not
consider them.
* Address some code scanning findings
* Fix some more findings
2022-02-17 18:40:40 -08:00
Marcono1234
710a76c8b8
Fix JsonReader.hasNext() returning true at end of document ( #2061 )
2022-01-27 15:59:50 -08:00
Marcono1234
6ffcdf3029
Fix Javadoc warnings and errors ( #2040 )
2021-12-26 15:30:21 -08:00
Éamonn McManus
6e06bf0d89
Fix for an ArrayIndexOutOfBoundsException.
...
The `fillBuffer` method changes `pos`, so it is incorrect to cache
its previous value.
2021-11-11 14:12:44 -05:00
Marcono1234
b4dab86b10
Make default adapters stricter; improve exception messages ( #2000 )
...
* Make default adapters stricter; improve exception messages
* Reduce scope of synchronized blocks
* Improve JsonReader.getPath / getPreviousPath Javadoc
2021-11-01 15:08:04 -07:00
Marcono1234
530cb74470
Fix javadoc doclint HTML warnings ( #1653 )
2020-02-17 14:46:15 -08:00
Degubi
9bf25c2eb6
Refactor prefix array & loop logic, use if-s instead ( #1505 )
2019-10-04 13:45:06 -07:00
Degubi
bac26b8e42
Optimize array copies
2019-03-05 12:12:04 -05:00
sourabh gupta
5848096f3e
Size allocation of StringBuilder ( #1047 )
...
Size allocation of StringBuilder
2017-05-24 15:49:09 -07:00
Eric Cochran
3270e8d972
Remove need for synthetic accessor methods.
2017-04-22 17:32:59 -07:00
Michele Vivoda
9a2421997e
negative zero test and fix ( #1069 )
2017-04-19 14:26:36 -07:00
Mohammad Yasir
4644837207
Incorporating the review comments. While more than 1 charachter might be read from the buffer the output will have only one escaped charachter.
2017-02-17 11:54:30 +05:30
Mohammad Yasir
9c30b0e203
Incorporating code review suggestions
2017-02-17 07:25:23 +05:30
Mohammad Yasir
ba4643134a
Removing unused variable
2017-02-16 03:00:02 +05:30
Mohammad Yasir
410b4a8c62
Optimizing for memory
2017-02-16 02:51:02 +05:30
inder123
ebad966efd
Merge pull request #870 from google/jw/reader-location
...
Consolidate location and path rendering for exceptions.
2016-06-09 15:26:10 -07:00
Jake Wharton
ecaa57114f
Consolidate location and path rendering for exceptions.
2016-06-09 18:02:36 -04:00
Archit Dey
3f8726ecaf
Enhancing the json reader, adding corresponding test case for it
2016-06-02 09:19:43 -04:00
Scott Brown
0669ff7fd1
allow unquoted long and integer keys
2016-03-12 11:52:13 -07:00
Jake Wharton
c8627c8ab8
Update reader and writer for RFC 7159.
2016-01-18 15:07:33 -05:00
Jake Wharton
3360c93a76
Add setting for leniency on Gson instance.
...
Add a JsonReader factory (for parity with the JsonWriter one) which provides a configured instance using the Gson settings.
2016-01-18 12:08:11 -05:00
Jake Wharton
7a1c94f986
Remove synthetic accessors from being generated.
2015-12-27 01:39:19 -05:00
Jesse Wilson
d6c8c1e3cf
Fix bugs in getPath() with arrays of objects and arrays of arrays
2014-11-11 01:59:48 +00:00
Jesse Wilson
fbc7e69c81
Implement JsonPath in JsonReader.
2014-07-31 05:17:54 +00:00
Joel Leitch
70f9280cb6
Remove usage of StringPool as it appears to slow things down and avoid Java String intern for the common cases.
2013-04-08 18:36:23 +00:00
Joel Leitch
84201c015f
Do not peek during a "skipValue" if a value has already been peeked.
2013-01-14 18:38:46 +00:00
Jesse Wilson
084047d80b
Reintroduce string pooling in JsonReader.
...
This makes Hotspot slower. From my before/after measurements using ParseBenchmark, times in microseconds:
TWEETS: 350 -> 370 (+6%)
READER_SHORT: 77 -> 76 (-1%)
READER_LONG: 870 -> 940 (+8%)
But it makes Dalvik faster by a greater margin. These before/after measurements use times in milliseconds:
TWEETS: 25 -> 20 (-20%)
READER_SHORT: 5.6 -> 4.7 (-16%)
READER_LONG: 52 -> 47 (-10%)
It's a net win because we're saving a greater fraction of time, and because we're helping the platform that needs the most help. We're paying microseconds on Hotspot to gain milliseconds on Dalvik.
2012-09-10 16:13:33 +00:00
Jesse Wilson
b3b919770b
Change number parsing to use one big loop. This changes it to return JsonToken.STRING for very long (>8k digits) numbers.
2012-09-02 20:12:19 +00:00
Jesse Wilson
3920d95fac
rename peekedInteger to peekedLong
2012-09-02 17:46:02 +00:00
Jesse Wilson
8daf3aaeb4
Inline position computation. This is uglier but faster.
2012-08-28 03:52:18 +00:00
Jesse Wilson
46b73632b0
Fix a bug where we weren't reading enough characters when a BOM was encountered.
2012-08-28 01:48:25 +00:00
Jesse Wilson
980796005f
Use a conventional for loop in nextQuotedValue() to make hotspot's job easier.
2012-08-27 04:42:39 +00:00
Jesse Wilson
bdf2cac6d4
Replace switch with if/else when processing whitespace. If/else is faster!
2012-08-27 04:17:29 +00:00
Jesse Wilson
b0a172944a
More number parsing improvements.
2012-08-27 03:17:41 +00:00
Jesse Wilson
448063dde1
Fix a goof in number parsing.
2012-08-27 03:07:20 +00:00
Jesse Wilson
4c2980e6ff
Fix a bug in integer parsing.
2012-08-27 02:34:52 +00:00
Jesse Wilson
c7cb503cdb
Restore fast skips.
...
document api ns linear runtime
TWEETS GSON_STREAM 397568 =========
TWEETS GSON_SKIP 300058 =======
READER_SHORT GSON_STREAM 76632 =
READER_SHORT GSON_SKIP 57796 =
READER_LONG GSON_STREAM 894690 =====================
READER_LONG GSON_SKIP 565114 =============
2012-08-27 01:17:50 +00:00
Jesse Wilson
085856c128
Don't leave the JsonReader in an invalid state if nextInt(), nextDouble() or nextLong() fails. We now save a reference to the string before we parse it, and keep that referenced value if parsing fails.
2012-08-26 22:06:57 +00:00
Jesse Wilson
e7bfd0c97d
Promote JsonReader2 to be the main JsonReader implementation.
2012-08-26 19:34:46 +00:00
Jesse Wilson
553fa6b742
Prepare to replace JsonReader with JsonReader2
2012-08-26 19:33:49 +00:00
Jesse Wilson
35c13173b0
Switch on ints rather than enums in JsonReader.
...
Using enums was triggering this Android bug:
http://code.google.com/p/android/issues/detail?id=36349
2012-08-14 21:32:18 +00:00
Jesse Wilson
6d351fea07
Fix a documentation typo.
...
Fixes bug 423.
2012-04-12 18:09:07 +00:00
Jesse Wilson
ad3489f557
First steps to StringMap, an alternative to LinkedHashmap.
2012-03-11 13:54:41 +00:00
Jesse Wilson
15e7819e9a
Fix testStringEndingInSlash by fixing nextNonWhitespace to always return the character at buffer[pos-1].
2012-02-16 22:49:53 +00:00
Jesse Wilson
7b75efd09e
Write some tests prescribed by missing code coverage. I found a bug where our nonexecute prefix code causes a problem.
2012-02-11 20:15:39 +00:00
Jesse Wilson
8d5de3136c
Inline character unescaping. This saves ~10% on the READER_LONG benchmark.
2011-12-25 07:09:46 +00:00
Jesse Wilson
b7c3e0067c
Avoid local field accesses in nextString(char). This saves a modest 2%.
2011-12-14 06:07:40 +00:00
Jesse Wilson
d01d39aa26
Use locals instead of fields when figuring out the buffer's offset line and column. This saves about 2% when parsing twitter data.
2011-12-14 05:49:58 +00:00
Jesse Wilson
aa52435951
Apply an ugly optimization to save 5% on pretty printed JSON documents. This uses locals instead of fields in an inner loop to save field reads and writes.
2011-12-14 05:26:29 +00:00