Commit Graph

910 Commits

Author SHA1 Message Date
Goooler
6d48f16d1f Add .editorconfig 2021-08-16 17:03:24 +08:00
Zac Sweers
ce45a68cc3 Small grammar and naming followups for proguard gen (#1365) 2021-07-16 03:06:43 -04:00
Steve SeongUg Jung
72f464bbdc Add an argument to be disable proguard code generating (#1353)
Co-authored-by: SeongUg Jung <seongug.jung@hanwha.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
2021-07-15 21:24:31 -04:00
Dkhusainov
3c108919ee JsonReader.nextSource javadoc (#1350)
Co-authored-by: Dinar <d.khusainov@infotech.team>
2021-05-31 16:35:32 -04:00
Zac Sweers
e343751593 Update to Kotlin 1.5 (and associated deps) (#1339) 2021-05-07 12:51:33 -04:00
Zac Sweers
45c8595bfa Update to Gradle 7 + Kotlin 1.4.32 + AutoService 1.0 (#1334) 2021-04-10 13:03:34 -04:00
wrongwrong
9c17bb823f fix version on readme (#1333) 2021-04-07 10:34:17 -04:00
Yuichiro Kawano
1654313fee update version on README (#1332) 2021-04-05 19:44:39 -04:00
Jesse Wilson
aea17e09bc Prepare next development version. 2021-04-01 16:31:07 -04:00
Jesse Wilson
cdf9546df5 Prepare for release 1.12.0. 2021-04-01 16:30:45 -04:00
Zac Sweers
7372baaaa0 Invoke constructor directly if all params with default are set (#1326)
Resolves #1302
2021-03-29 21:47:22 -04:00
Zac Sweers
b33a94dfc1 Update more dependencies (#1319) 2021-03-29 21:37:54 -04:00
wrongwrong
37f34e16f0 Improve KotlinJsonAdapter performance by invoke KFunction by "call". (#1286) 2021-03-29 20:46:42 -04:00
Zac Sweers
bcfce60577 Warn on missing TypeElement rather than error (#1323)
One example I found for this is when a property is annotated with android's `@SuppressLint`, which is only available from the android jar and not visible during apt. This should just be a warning (if even?) and not a hard error.
2021-03-29 20:44:55 -04:00
Ralf Wondratschek
7ef4a32d52 Bump the Kotlin JVM metadata library to the latest release. This will avoid problems with Kotlin 1.5.0-M2. (#1325) 2021-03-29 11:00:03 -04:00
Zac Sweers
797140c5cf Add some short basic docs to JsonAdapter methods (#1313) 2021-03-13 20:52:40 -05:00
Zac Sweers
103b60328c Improve readability of constructor invocation params (#1312) 2021-03-13 20:52:25 -05:00
Zac Sweers
3bc47519ab Fix reading property function types (#1311) 2021-03-13 20:47:52 -05:00
Zac Sweers
935f8b872a Support generic arrays with defaults in code gen (#1310) 2021-03-13 20:47:27 -05:00
Márton Braun
6df66b81dc Fix typo in PolymorphicJsonAdapterFactory.java (#1314) 2021-03-08 13:54:19 -05:00
Zac Sweers
9ac54dd33f Update dependencies (#1307)
* Gradle 6.8.2

* Truth 1.1.2

* Kotlin 1.4.30

* ASM 9.1

* Lower versions

These require java 8, which we don't actually formally support

* Gradle 6.8.3
2021-02-23 02:51:12 -05:00
Masatoshi Kubode
156b1f0365 Fix a crash when processing a parameter annotated with an annotation that placed in annotation package (#1287)
* Update KotlinPoet to 1.7.2

* Fix a Java NPE crash when processing a parameter annotated with an annotation that placed in annotation package

This problem happens with KotlinPoet 1.7.x.
From KotlinPoet 1.7.x, `TypeName.toString()` is escaped with backquotes if the package name contains keywords.
So NPE will be thrown if an annotation is placed in `annotation` package because `elements.getTypeElement(it.typeName.toString())` returns `null`.

* Reformat imports

* Use rawType().canonicalName instead of toString()

* Fix test case

* Require getTypeElement

* Exclude com.google.guava from shadowJar

* Move a test case of processing a qualifier placed in `annotation` package

* Use checkNull instead
2021-02-22 02:43:04 -05:00
Zac Sweers
7f1e7e229e Suppress some poet deprecations (#1306) 2021-02-20 23:27:56 -05:00
Zac Sweers
99ebab66c0 Reserve simple type names referenced by properties to avoid collisions (#1305) 2021-02-15 13:02:28 -05:00
Zac Sweers
6b09dc443d Suppress RedundantVisibilityModifier in generated adapters (#1303) 2021-02-15 12:58:14 -05:00
Zac Sweers
6e5bb3a29b Prepare project for Kotlin migration (#1257) 2021-02-02 13:11:38 -05:00
Zac Sweers
8518f47f52 Update dependencies (#1258) 2021-02-02 13:11:20 -05:00
Zac Sweers
23d056c054 Add issue templates (#1254) 2021-02-01 18:00:03 -05:00
Alex Vanyo
f0202d5d29 Revert pull-request-target to pull-request (#1295) 2021-02-01 17:58:29 -05:00
Zac Sweers
9c2cd7a37b Use pull_request_target (#1255)
https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#pull_request_target
2020-10-10 07:52:57 -04:00
Zac Sweers
a6caf3ccac Run spotless on changelog (#1251) 2020-10-04 23:33:25 -04:00
Jesse Wilson
e135f5f31f Prepare next development version. 2020-10-04 20:52:28 -04:00
Jesse Wilson
4d3ca9a174 Prepare for release 1.11.0. 2020-10-04 20:52:00 -04:00
Zac Sweers
230c3d801f Promote Kotlin type-inferring APIs to the main Moshi package (round 2!) (#1202)
* Make moshi-root a kotlin project

* Move moshi kotlin extensions to moshi core

* Add appropriate experimental annotations

* Add nextAdapter helper

* Add explicit return type on addAdapter

* Expression body for adapter

* Use nextAdapter helper

* Opportunistically fix a couple Util warnings

* Add Types extensions

* Spotless

* Use extensions in more places for added coverage

* Apply java versions on any java plugin type

This way the kotlin projects get this too

* Fix circularAdapters test?

* Use java 8 in java for code gen too

* Fixup with CircularAdaptersTest

* Add coverage for remaining

* Remove nextAdapter

* Remove leftover function

* Use asserts

left checkNotNull for the contract

* boxIfPrimitive

* Fixup docs

* Copyright fixes

* Add parameterized addAdapter

* Switch to using native javaType API

* Spotless

* Back to 2019

* Spotless

* Use rawType extension

* Fix rebase issues
2020-10-04 18:18:52 -04:00
Zac Sweers
f17e7c2584 Fix infinite loop with type var variance stripping + remove from API (#1246)
* Add test case

* Add TypeVariableResolver to handle backward referencing type vars

* Copy nullability in typevars
2020-10-04 18:10:49 -04:00
Zac Sweers
5ce092857a Fix some misc deprecated KotlinPoet APIs (#1249)
* Move off of deprecated AnnotationSpec.className

* Simplify generatedType check and avoid deprecated KP API
2020-10-04 18:03:45 -04:00
Zac Sweers
850dc206cf Fix snapshots by upping metaspace size (#1247)
See https://github.com/Kotlin/dokka/issues/1405
2020-10-03 06:56:09 -04:00
sinha-shaurya
8fe26e934e Updated Moshi Download version to 1.10.0 2020-10-02 09:52:40 -04:00
Zac Sweers
f192473419 Standardize (almost) all tests on Truth (#1242)
* Replace assertj calls with Truth where possible

* Update test dependencies

* adapters

* reflect

* codegen

* moshi

* Add missing inOrder()

* Spotless
2020-09-26 20:38:39 -04:00
Jesse Wilson
acb2836d39 Merge pull request #1241 from ZacSweers/z/betterJcenterHandling
Use exclusiveContent API for jcenter
2020-09-26 16:01:05 -04:00
Zac Sweers
45ef3daef9 Use exclusiveContent API for jcenter
The previous setup said to only look for those packages in jcenter. This is a more powerful alternative, which says only use jcenter for those packages
2020-09-26 04:34:57 -04:00
Zac Sweers
bc85227f29 Add JsonString recipe to examples (#1230)
* Start recipes module with JsonString recipe

* Make recipes a kotlin project

* Move JsonString sample to examples

* Add license

* Include all java modules

* Add kotlin options

* Spotless

* Remove jvmtarget

I was today years old when I found out 1.7 isn't a valid target

* Make gradle happy

* Add codegen

* Spotless
2020-09-25 22:51:05 -04:00
Zac Sweers
44fa05bce1 Prepare dokka (#1238)
* Prepare dokka

This updates to Dokka 1.4.10 and prepares for a future with Kotlin rewrite and mkdocs

* Spotless
2020-09-25 22:37:13 -04:00
Zac Sweers
a1852a7315 Finish spotless license header configuration (#1231)
* Update spotless and enable copyright header bits again

* Reformat square copyright headers

* Create separate format configuration for external files

* Update CI to use java 15 final

* include stacktrace in ci failures

* Update ktlint to 0.39

* Disable java formatting on JDK 15

* Fix google header
2020-09-25 22:18:51 -04:00
Lachlan McKee
bf72ce8ade Introduced tags to reader/writers (#1227)
* Introduced tags to reader/writers

* Removed getTags method

* Added type safety to tag methods

* Changed to explicit class comparison

* Removed ? extends for tags

* Switched to LinkedHashMap

* Allowed polymorphism for tag values

* Simplified tags tests
2020-09-22 08:56:51 -04:00
Jesse Wilson
53c1bf0cac Fix problems discovered using nextSource() to implement skipValue (#1236) 2020-09-21 23:50:38 -04:00
Jesse Wilson
0a78ed4cb1 Moshi.Builder.addLast() (#1233)
This is mostly useful for KotlinJsonAdapterFactory.
2020-09-21 09:36:55 -04:00
Zac Sweers
517ea36fe5 Fix shadow packaging in code gen artifact (#1214)
* Update to shadow 6.0

* Exclude kotlinpoet core artifact from shading

* Replace runtime scopes with compile

* Opportunistically fix old artifact() dep

Gradle 6.6 supports providers now

* Use api instead

* Add link

* Remove accidental gradle plugin config

This only applies to gradle plugins
2020-09-18 21:43:11 -04:00
Jesse Wilson
9ee711adce Merge pull request #1225 from square/jwilson.0914.nextSourceHacks
Small improvements to JsonReader.nextSource
2020-09-14 23:53:45 -04:00
Jesse Wilson
a09f0a5c26 Small improvements to JsonReader.nextSource
Defer doing I/O until strictly necessary.

Remove some unnecessary branching in doPeek(), which is in the
inner loop of all JSON parsing.
2020-09-14 22:05:27 -04:00