Johannes Frohnmeyer
b6cc63919d
Merge remote-tracking branch 'origin/master'
...
ci/woodpecker/push/woodpecker Pipeline failed
Details
# Conflicts:
# .github/ISSUE_TEMPLATE/bug_report.md
# .github/workflows/build.yml
# extras/pom.xml
# extras/src/main/java/com/google/gson/graph/GraphAdapterBuilder.java
# extras/src/main/java/com/google/gson/typeadapters/UtcDateTypeAdapter.java
# extras/src/test/java/com/google/gson/interceptors/InterceptorTest.java
# extras/src/test/java/com/google/gson/typeadapters/PostConstructAdapterFactoryTest.java
# extras/src/test/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactoryTest.java
# extras/src/test/java/com/google/gson/typeadapters/UtcDateTypeAdapterTest.java
# gson/src/test/java/com/google/gson/CommentsTest.java
# gson/src/test/java/com/google/gson/ToNumberPolicyTest.java
# gson/src/test/java/com/google/gson/functional/EnumWithObfuscatedTest.java
# gson/src/test/java/com/google/gson/functional/JsonParserTest.java
# gson/src/test/java/com/google/gson/functional/LeniencyTest.java
# gson/src/test/java/com/google/gson/functional/MapTest.java
# gson/src/test/java/com/google/gson/functional/PrimitiveCharacterTest.java
# gson/src/test/java/com/google/gson/functional/ReflectionAccessTest.java
# gson/src/test/java/com/google/gson/functional/SecurityTest.java
# gson/src/test/java/com/google/gson/stream/JsonReaderTest.java
# gson/src/test/resources/testcases-proguard.conf
# metrics/pom.xml
# metrics/src/main/java/com/google/gson/metrics/BagOfPrimitives.java
# proto/pom.xml
# proto/src/test/java/com/google/gson/protobuf/functional/ProtosWithAnnotationsTest.java
# proto/src/test/java/com/google/gson/protobuf/functional/ProtosWithComplexAndRepeatedFieldsTest.java
# proto/src/test/java/com/google/gson/protobuf/functional/ProtosWithPrimitiveTypesTest.java
2023-01-21 14:24:25 +01:00
Marcono1234
f2f53fbe8e
Add troubleshooting guide ( #2285 )
2022-12-15 08:27:16 -08:00
Maicol
0a42c31efe
Code cleanup ( #2282 )
...
* Simplify `if` condition in JsonReader.peekNumber()
* Remove `if` to simplify a `return` in Excluder.excludeClassChecks()
* Remove redundant variable in Gson.fromJson()
* equal condition replace by `Objects.equals()` in $Gson$Types.equal()
* equal condition replace by `Objects.equals()` in LinkedTreeMap.equal()
* Replace `switch` with `if` in UtcDateTypeAdapter.read()
* Remove redundant `throws` clause in GraphAdapterBuilder.read()
* Remove redundant `throws` clause in JsonTreeReader.UNREADABLE_READER
* Remove redundant `throws` clause in JsonTreeWriter.UNREADABLE_READER
* Remove unnecessary `.initCause()` call
* Remove redundant cast in TreeTypeAdapter.GsonContextImpl.deserialize
* Replace `StringBuilder` with `String`
* Fix the import and restore the `switch`
* Fix the import
* Add the `util.Objects` import
* Fix indentation
* Add a comment to clarify the condition
* Fix indentation
* Fix imports
* Fix indentation
* Fix indentation
* Fix indentation
2022-12-13 08:50:25 -08:00
Johannes Frohnmeyer
9409197165
Merge remote-tracking branch 'origin/master'
...
# Conflicts:
# gson/src/main/java/com/google/gson/stream/JsonReader.java
# gson/src/test/java/com/google/gson/functional/ReflectionAccessFilterTest.java
# gson/src/test/java/com/google/gson/functional/ReflectionAccessTest.java
# gson/src/test/java/com/google/gson/internal/bind/DefaultDateTypeAdapterTest.java
# pom.xml
2022-10-31 12:44:34 +01:00
Marcono1234
5269701679
Improve `JsonReader.skipValue()` ( #2062 )
...
* Fix JsonReader.skipValue() not behaving properly at end of document
JsonReader implementation erroneously reset `peeked` to PEEKED_NONE;
JsonTreeReader threw ArrayIndexOutOfBoundsException.
* Fix JsonReader.skipValue() not behaving properly at end of array and object
For JsonReader this caused an IllegalStateException (in the past it caused
JsonReader to get stuck in an infinite loop); for JsonTreeReader it only
popped the empty iterator but not the JsonArray or JsonObject, which caused
peek() to again report END_ARRAY or END_OBJECT.
* Only have JsonReader.skipValue() overwrite path name when name was skipped
This improves the JSON path when the value for a property was skipped and
before the subsequent property (or the end of the object) getPath() is called.
* Address feedback; improve test coverage
Co-authored-by: Éamonn McManus <emcmanus@google.com>
2022-10-10 07:51:36 -07:00
Marcono1234
2591ede59b
Fix incorrect HTML headings in Javadoc ( #2200 )
2022-09-24 17:02:11 -07:00
Éamonn McManus
0864a02e86
Build on JDK 17 as well as 11. ( #2198 )
...
* Build on JDK 8 and 17 as well as 11.
* Remove JDK 8 for now.
`DefaultDateTypeAdapterTest` fails.
* Tweak javadoc to avoid warnings.
Mostly these are about using `<h3>` when the previous tag was `<h1>`,
and the like. This previous tag might be implicit (part of what javadoc
itself outputs rather than the HTML in doc comments).
Apparently JDK 11 puts method javadoc inside `<h2>` while JDK 11 puts it
inside `<h3>`. Or something like that. Anyway it doesn't appear to be
possible to use `<h3>` _or_ `<h4>` and please both.
2022-09-23 14:33:28 -07:00
Johannes Frohnmeyer
ce02cb3bc1
Merge remote-tracking branch 'origin/master'
...
# Conflicts:
# gson/pom.xml
# gson/src/main/java/com/google/gson/Gson.java
# gson/src/main/java/com/google/gson/GsonBuilder.java
# gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java
# gson/src/main/java/com/google/gson/stream/JsonWriter.java
# gson/src/test/java/com/google/gson/functional/ArrayTest.java
# gson/src/test/java/com/google/gson/functional/MapTest.java
# pom.xml
2022-09-14 19:20:24 +02:00
Marcono1234
f7a164d98b
Fail Maven build on compiler warnings; remove some warning suppressions ( #2183 )
...
* Fail Maven build on compiler warnings; remove some warning suppressions
* Fix compiler warnings causing failure for newer JDK
* Improve placement of "raw" and "unchecked" warning suppressions
* Adjust javac documentation link
* Fix compilation error on newer JDKs
2022-08-26 17:36:18 -07:00
Marcono1234
7f77ad4ff6
Replace `$Gson$Preconditions.checkNotNull` with `Objects.requireNonNull` ( #2180 )
...
* Replace $Gson$Preconditions.checkNotNull with Objects.requireNonNull
* Add back checkNotNull
2022-08-22 07:22:32 -07:00
Marcono1234
d53b3ea84a
Clarify doc about non-finite numbers for non-lenient JsonReader ( #1723 )
2022-08-08 06:40:07 -07:00
Marcono1234
cbc0af867b
Improve lenient mode documentation ( #2122 )
2022-06-28 09:48:05 -07:00
Johannes Frohnmeyer
dc4e61ac7b
Several breaking changes
2022-05-17 21:20:10 +02:00
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