Commit Graph

939 Commits

Author SHA1 Message Date
Zac Sweers
954ca46b9e Add @Json.ignore (#1417)
* Default Json.name to an unset value

* Promote shared transient tests to DualKotlinTest

* Add new ignore property to Json

* Support it in ClassJsonAdapter

* Mention no enum/record support

* Support in KotlinJsonAdapter

* Rework code gen API to know of "ignored"

* Support in apt code gen

* Support in KSP

* Update old non-working transient example test

* Synthetic holders

* Use field on both
2021-11-08 11:16:57 -05:00
Zac Sweers
48e6dd3f03 Support externally-compiled transient property recognition in KSP (#1416) 2021-11-03 15:49:28 -04:00
Sangeet Narayan
92add003fe Update README.md to include Kotlin Examples (#1355) 2021-10-31 16:25:55 -04:00
Zac Sweers
c288ad6133 Switch from internal to experimental internal annotation (#1410) 2021-10-30 12:15:08 -04:00
Zac Sweers
313683fa98 Parameterize kotlin test infra on CI (#1407) 2021-10-25 11:00:56 -04:00
Zac Sweers
7dd3b39376 Expose maven gradle props as env instead (#1408) 2021-10-22 16:17:32 -04:00
Zac Sweers
b8fbe38118 Support direct annotation instantiation in code gen on Kotlin 1.6 (#1390) 2021-10-22 13:43:09 -04:00
Zac Sweers
a9eaa849e5 Only assign setters if present (#1405)
* Only assign setters if present

Rather than generating

```kotlin
val result: Content
result = Content()
result.content = if (contentSet) content else result.content
result.text = if (textSet) text else result.text
```

This will now conditionally set

```kotlin
val result: Content
result = Content()
if (contentSet) {
  result.content = content
}
if (textSet) {
  result.text = text
}
```

* Spotless
2021-10-22 12:18:59 -04:00
Zac Sweers
3a88349f34 Add --stacktrace to snapshot publishing (#1406)
Trying to diagnose why these are failing
2021-10-22 12:18:48 -04:00
Zac Sweers
862ff7ddcd Update to JDK 17 (#1394)
Everything still targets JDK 8 (non-records) or JDK 16 (records only)
2021-10-16 02:18:51 -04:00
Zac Sweers
2db351f8ed Upstream KSP implementation (#1393) 2021-10-16 01:52:04 -04:00
Zac Sweers
de8bbf12f5 Update KotlinPoet to 1.10.0 (#1396) 2021-09-20 16:13:56 -04:00
Chitranshi Srivastava
628a193d69 fix: corrected a grammatical error. (#1298) 2021-09-12 20:55:53 -04:00
iury souza
29d2f0f0ed Update README to include enum section in ProGuard/R8 rules (#1354) 2021-09-12 20:54:44 -04:00
Zac Sweers
5756136a72 Move apt-specific classes to apt package (#1392) 2021-09-09 22:14:29 -04:00
Zac Sweers
213fb33012 Fix snapshots (#1385) 2021-08-27 13:28:20 -04:00
Zac Sweers
6947ab00d0 Modernize build a bit (#1383) 2021-08-23 17:09:59 -04:00
Zac Sweers
95250b0359 Implement reflective support for Java Records (#1381)
* Standardize around JDK 8

* Update GJF to support newer JDKs

* Fix misc java 8 issues in tests

* Prepare java 16/records checking at runtime

* Implement real RecordJsonAdapter

* Spotless

* Prepare build for JDK 16+

* Fix property name for kapt

* Small cleanup

* Make FallbackEnum java-8 happy

* Remove animalsniffer

* Fix format

* Add opens for ExtendsPlatformClassWithProtectedFields

* Return null every time in shim for main tests

* Use JDK 16 + release 8 to replace animalsniffer

* Simplify accessor accessible handling

* Remove manifest attrs

* Fix typo

* Fix KCT tests + upgrade it

* Cover another

* Try explicit kotlin daemon args for java 17?

* Disable 17-ea for now until kotlin 1.5.30

* Add JsonQualifier and Json(name) tests + fix qualifiers

* Ensure constructor is accessible

* GJF it properly

* GJF 1.11

* Unwrap InvocationTargetException

* Use MethodHandle for constructor

* Use MethodHandle for accessor too

* Revert "Remove manifest attrs"

This reverts commit 3eb768fd6904bb5c979aa01c3c182e0fb9329d62.

* Proper MR jar

* *actually* fix GJF, which wasn't getting applied before

We can just enable this everywhere now since we require JDK 16 anyway

* Make IDE happy about modules access

* Fixup records tests to play nice with modules

Gotta be public

* Add complex smoke test

* Remove comment

Not a regression test in this case
2021-08-23 12:00:06 -04:00
Goooler
2572c29e42 Code cleanups 2021-08-18 14:51:52 -04:00
Jake Wharton
ce78d34c14 Merge pull request #1379 from Goooler/gradle
Update gradle 7.2
2021-08-17 08:32:24 -04:00
Goooler
c1f5ce2b1b Update gradle 7.2 2021-08-17 19:52:43 +08:00
Jake Wharton
e41b79170e Merge pull request #1377 from Goooler/action
Disable publish action in forked repository
2021-08-16 10:55:33 -04:00
Jake Wharton
201a1d8a4b Merge pull request #1376 from Goooler/bump
Bump gradle to 7.1.1
2021-08-16 10:55:15 -04:00
Goooler
2eb40a0cff Disable publish action in forked repository 2021-08-16 22:29:22 +08:00
Goooler
6c2c578637 Bump gradle to 7.1.1 2021-08-16 22:19:00 +08:00
Jake Wharton
5379ac8539 Merge pull request #1374 from Goooler/attr
Add .gitattributes
2021-08-16 10:05:59 -04:00
Jake Wharton
620e340181 Merge pull request #1373 from Goooler/config
Add .editorconfig
2021-08-16 10:05:39 -04:00
Goooler
06cce171c6 Bump setup-java action to v2 2021-08-16 10:05:05 -04:00
Goooler
4bca55b113 Add .gitattributes 2021-08-16 17:04:42 +08:00
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