Eric Cochran
aede26d5e1
Clarify negation in condition. ( #444 )
2018-02-18 06:56:29 -05:00
Eric Cochran
3b89cf1fcb
Fix ClassJsonAdapter to handle ParameterizedTypes. ( #422 )
2018-02-17 22:56:05 -05:00
Jake Wharton
bc7d849362
Reduce visual complexity of branching.
2018-02-13 15:04:34 -05:00
Jesse Wilson
5ad9d31bd8
Move modules into their own packages.
...
This sets the Automatic-Module-Name for moshi, moshi-adapters, and moshi-kotlin.
It moves moshi-adapters into its own .adapters package and forwards the existing
adapter. It moves the moshi-kotlin into its own .kotlin package and forwards the
existing adapter.
I'm not certain this is necessary or sufficient, but I think it's the right idea
for JPMS compatibility.
2018-02-07 04:41:06 -05:00
Eric Cochran
d26b2a151f
Fix error message for invalid toJson signature. ( #431 )
...
void toJson(JsonWriter, JsonAdapter) does not make sense. This looks like my copy-paste error.
2018-02-03 23:50:22 -05:00
Eric Cochran
dba2f05b13
Improve error message for local classes. ( #423 )
2018-01-10 21:56:37 -05:00
Jesse Wilson
359244e996
Fix JsonValueReader to support up to 255 levels of nesting. ( #417 )
...
Follow up to https://github.com/square/moshi/pull/349
2018-01-07 14:55:02 -05:00
Eric Cochran
a210d89a55
Don't handle WildcardTypes in ClassJsonAdapter. ( #406 )
2018-01-07 14:05:49 -05:00
Jesse Wilson
0a6e836762
Support up to 255 levels of nesting. ( #349 )
...
Closes: https://github.com/square/moshi/issues/348
2018-01-07 12:17:00 -05:00
Eric Cochran
f53a77d311
Fix doc reference to Token. ( #403 )
...
JsonReader.Token is less redundant than Gson's JsonReader.JsonToken.
2017-12-01 12:07:26 -08:00
Eric Cochran
a8b1550e7e
Make selectString consistent across JsonReaders. ( #399 )
...
Make JsonValueReader.selectString return -1 for non-strings instead of throwing.
2017-11-27 15:33:03 -08:00
Eric Cochran
f922371fa8
Let JsonValueReader.nextString read numbers. ( #390 )
...
* Let JsonValueReader.nextString read numbers.
This adds parity with JsonUtf8Reader and lets big number literals in JSON be read in as strings in Java.
* Remove trailing 0 in float literal.
2017-11-24 07:23:12 -05:00
Eric Cochran
2b7e5a3453
Add error message for accidental primitive usage.
...
Also, add a test for the requirement.
2017-11-11 18:37:04 -08:00
Eric Cochran
e643a04ee5
Add @CheckReturnValue to appropriate public APIs.
2017-11-04 21:13:07 -07:00
Jesse Wilson
8bf298ac14
Merge pull request #360 from square/eric.20171004.delegate-adapters
...
Allow delegates for intermediates in adapters.
2017-10-04 21:53:12 -04:00
Eric Cochran
4376a50f1f
Clarify delegation with qualifiers test. ( #359 )
2017-10-04 16:49:23 -07:00
Eric Cochran
f847d47daa
Remove Types.equal. ( #358 )
...
Nobody uses this helper method.
2017-10-04 15:54:17 -07:00
Eric Cochran
de336ef86e
Allow delegates for intermediates in adapters.
2017-10-04 15:53:33 -07:00
Eric Cochran
2db89355f1
Add CheckReturnValue for toJson's string result.
...
This helps Error Prone and the IDE find accidental usages of toJson(value) instead of toJson(writer, value).
2017-09-25 14:18:31 -04:00
Eric Cochran
00694e9878
Fail earlier with null annotation set.
2017-07-19 11:29:06 -07:00
jwilson
9e9655b556
Change the adapter for Object.class to delegate.
...
Previously if we ever had an opaque Object, the content of this object
would always only use the built-in adapters for its members.
This changes the built-in Object adapter to do one layer of type checking
and then to delegate to user-supplied adapters.
The big upside of this is that application code can now change the default
numeric type to use when decoding an untyped object. Typically this will
be used to replace our default of Double with a user-specified numeric type
like BigDecimal.
2017-05-26 23:44:46 -04:00
jwilson
798f14bda5
[maven-release-plugin] prepare for next development iteration
2017-05-14 22:20:00 -04:00
jwilson
f42ae45f4c
[maven-release-plugin] prepare release moshi-parent-1.5.0
2017-05-14 22:19:55 -04:00
Eric Cochran
e59dbf4f96
Add @Nullable to result of Types.nextAnnotations. ( #298 )
2017-05-06 21:07:59 -04:00
Jesse Wilson
c65b3bf1cb
Import jsr305 and use it to mark @Nullable stuff. ( #297 )
2017-05-06 20:31:24 -04:00
jwilson
0ea1959b7e
Enable Checkstyle 7.7.
2017-05-06 14:48:55 -04:00
Eric Cochran
13fd0b252c
Throw NPE for null indent string in factory method. ( #289 )
...
Fail when creating the JsonAdapter rather than when using it.
2017-04-29 21:46:08 -04:00
Serj Lotutovici
f942e0fd52
Make Types.equals(Type, Type) public. ( #292 )
2017-04-29 21:45:06 -04:00
Eric Cochran
d95dd07c56
Fix Types.equals for arrays. ( #279 )
2017-04-20 17:27:47 -05:00
Eric Cochran
448a2d3298
Treat negative zero as a number, not a long. ( #285 )
...
Updates logic from https://github.com/google/gson/issues/1053
2017-04-20 17:22:06 -05:00
Jesse Wilson
81bbe870f1
KotlinJsonAdapter ( #281 )
...
* Add kotlin-module with support for Kotlin data classes
* Naming and style changes to KotlinJsonAdapter.
Biggest changes:
* Attempt to support regular classes and data classes
* Avoid parameter hashing when indexing is sufficient for
constructor parameters
2017-04-18 23:51:37 -04:00
Jesse Wilson
8c18caf574
Add a test to confirm types are canonicalized. ( #278 )
...
Obsoletes https://github.com/square/moshi/pull/129/files
2017-04-16 12:15:53 -04:00
Eric Cochran
11dbc3c50b
Fix @ToJson IAE message. ( #275 )
2017-03-28 05:57:53 -04:00
Eric Cochran
718f832864
Allow easy delegates in adapter methods. ( #272 )
2017-03-27 21:48:19 -04:00
Eric Cochran
1b634bbb74
Update adapter methods ISE message. ( #273 )
2017-03-27 19:25:31 -04:00
Jake Wharton
05b0a46961
Add error-prone compiler. ( #259 )
...
* Fix error-prone warning
* Add error-prone compiler.
* Suppress warning about calling getClass() on annotation.
2017-02-14 22:28:24 -05:00
jwilson
49092ece96
[maven-release-plugin] prepare for next development iteration
2017-02-04 15:20:11 -05:00
jwilson
d075a3e56a
[maven-release-plugin] prepare release moshi-parent-1.4.0
2017-02-04 15:20:05 -05:00
Eric Cochran
332adcadf5
Add JsonReader.readJsonValue
2017-02-03 20:29:59 -08:00
jwilson
5ea65a5f95
Fix a typo in the name of JsonUtf8Writer.
2017-02-03 13:02:18 -05:00
jwilson
e9d8538ec3
Rename toJsonObject() to toJsonValue(), fromJsonObject() to fromJsonValue().
...
Also rename the JsonReader and JsonWriter implementations.
2017-02-02 21:28:38 -05:00
Jesse Wilson
3af58f4a43
Merge pull request #245 from NightlyNexus/eric/platform-fields
...
Fix isPlatformType
2017-02-02 09:10:45 -05:00
jwilson
fdaecb9fb8
Use BigDecimal to encode exotic number types.
...
Previously we'd retain whatever types the caller passed in. This was
potentially problematic for non-immutable numeric types like AtomicInteger.
2017-02-02 08:27:07 -05:00
Eric Cochran
9420b6493c
Fix isPlatformType
...
createFieldBindings should not take the allowed platform types into
account.
2017-02-01 18:37:44 -08:00
Jesse Wilson
3c23da50cf
Merge pull request #242 from NightlyNexus/eric/nextAnnotations
...
Add Types.nextAnnotations
2017-01-31 21:08:14 -05:00
Eric Cochran
9417cd8207
Add tests for duplicate JSON keys
2017-01-31 14:44:17 -08:00
Eric Cochran
05b594a26c
Add Types.nextAnnotations
2017-01-31 11:18:13 -08:00
Eric Cochran
6a2981108f
Add arrayOf, subtypeOf, supertypeOf tests
2017-01-30 23:03:20 -08:00
Jesse Wilson
ed164fd806
Merge pull request #235 from NightlyNexus/master
...
Improve error message for qualified platform types
2017-01-30 20:56:34 -05:00
Jesse Wilson
14a430cb58
Merge pull request #237 from NightlyNexus/patch-1
...
Add Types.createJsonQualifierImplementation
2017-01-30 20:55:00 -05:00