Commit Graph

21 Commits

Author SHA1 Message Date
renovate[bot]
ce7abc3e5c Remove kotlin metadata dependencies (#1851)
* Update dependency org.jetbrains.kotlinx:kotlinx-metadata-jvm to v0.9.0

* Remove deps

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
2024-06-03 17:48:09 -04:00
renovate[bot]
c24acaf03c Update kotlinpoet to v1.17.0 (#1761)
* Update kotlinpoet to v1.17.0

* Remove metadata preview

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
2024-06-03 15:50:51 -04:00
Zac Sweers
7de0cba7c4 Spotless 2024-06-03 15:38:51 -04:00
Zac Sweers
16f03f2254 Add KSP2 testing 2024-06-03 15:38:51 -04:00
Zac Sweers
c8f00d182e Make KSP1 tests pass 2024-06-03 15:38:51 -04:00
Zac Sweers
b648d6ee33 Remove KAPT support (#1848)
* Remove KAPT support

* Stick KSP on the root classpath

* Another

* Another
2024-06-03 10:35:36 -04:00
renovate[bot]
516c005952 Update dependency com.pinterest.ktlint:ktlint-cli to v1.2.0 (#1814)
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.2.0

* Appease ktlint

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2024-02-28 21:59:39 +00:00
Jake Wharton
2cc9ebb88e Update formatters to latest
Ensure renovate can bump them by specifying full coordinates in toml.
2024-01-29 12:10:47 -05:00
Chris Povirk
c9c9f9d838 Insert !! to make some types in generated code non-nullable.
Hi, Square folks.

The background here is that we're working to put nullness annotations on
more "JDK classes," such as `java.lang.Class`, at least in Google's
build system. That means that calls to methods like
`clazz.getMethod(...)` and `clazz.getDeclaredConstructor` must pass
non-nullable `Class` instances. If they don't, we see errors:

```
error: type mismatch: inferred type is Class<Int>? but Class<*> was expected
          String::class.java, String::class.java, Int::class.javaPrimitiveType, String::class.java,
                                                  ^
```

```
error: type mismatch: inferred type is Class<Int>? but Class<*> was expected
          String::class.java, FooResponse::class.java, Int::class.javaPrimitiveType,
                                                       ^
```

```
error: type mismatch: inferred type is Class<CapturedType(*)>? but Class<*> was expected
          Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
          ^
```

Expressions like `Int::class.javaPrimitiveType` are always non-nullable,
so we can use `!!` (or `checkNotNull` or whatever you might prefer)
there without risk.

(Note that it would be possible to avoiding using `!!` for
`INT_TYPE_BLOCK`: We could do so by passing `Integer.TYPE`. The more
general case of `TypeName.asTypeBlock` could theoretically be handled
similarly but would likely require maintaining a mapping from Kotlin
type name to Java primitive wrapper class.)

As for `DEFAULT_CONSTRUCTOR_MARKER`, I haven't looked at the generated
code enough to prove that it's non-nullable here. But if I'm reading the
bytecode right, the property value is being passed to
`getDeclaredConstructor`, so I'd expect NPE there if it were null.

Let me know what you think. I could check with our internal Moshi owners
about maintaining this as a Google-local patch if that's better, but I'm
hoping that this is a fairly harmless change, and our research so far
suggests that we _probably_ won't be back soon to ask about other
changes for this nullness work.
2023-08-30 11:31:50 -04:00
Zac Sweers
f6f80a40dd Update to Kotlin 1.9.0 (#1719) 2023-08-03 13:33:12 -04:00
renovate[bot]
c403e74fec Update plugin mavenShadow to v8.1.1 (#1635)
* Update plugin mavenShadow to v8.1.1

* Update API

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
2023-05-05 22:21:03 +00:00
renovate[bot]
c11f0e168c Update kotlin monorepo (#1614)
* Update kotlin monorepo

* Update ksp to v1.8.0-1.0.9

* Lower metadata to 0.5.0

* Update KCT

* Update to compilerOptions

* Suppress deprecation

* Add missing java target too

* Raise it again because it's broken on all

* Kotlin 1.8.20 + updated kotlinpoet

* Update kotlinpoet

* Update kotlin

* Fix KSP equality check for KotlinPoet 1.13.x

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <github@jakewharton.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
2023-05-05 18:04:57 -04:00
Trevor Jones
bf4b83d1dc test case and possible fix for messaging when type resolution fails due to invalid syntax of a generic property (#1527) 2023-05-02 00:30:18 -04:00
renovate[bot]
e6110de8c3 Update plugin spotless to v6.14.0 (#1620)
* Update plugin spotless to v6.14.0

* Update Spotless version and apply

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2023-01-30 14:03:50 +00:00
Michael Bailey
a6dd821990 Suppress warning in generated code (#1547) 2022-07-15 11:19:51 -04:00
Zac Sweers
53bb46c208 Remove redundant opt-in flags (#1544)
* Remove "-opt-in=com.squareup.kotlinpoet.ksp.KotlinPoetKspPreview"

Unused now

* Remove redundant -opt-in=RequiresOptIn
2022-06-13 17:11:29 -04:00
Zac Sweers
e95af32df8 Update dependencies + Kotlin 1.7 + KotlinPoet 1.12.0 (#1543) 2022-06-13 17:02:27 -04:00
Zac Sweers
ffaedac610 Don't suffix the value param when overriding (#1503) 2022-01-12 14:27:08 -05:00
Zac Sweers
1fdc61dc31 Update a few misc build deps (#1500) 2022-01-12 13:50:48 -05:00
Zac Sweers
e2c346e1de Convert util package to Kotlin (#1461)
* Rename .java to .kt

* Convert NonNullJsonAdapter

* Rename .java to .kt

* Convert NullSafeJsonAdapter

* Fix missing null-check

* Rename .java to .kt

* Convert Util (initial pass)

* Push to top-level Util

* Use extensions and properties where possible

* Use knownNotNull

* Spotless

* Clean up impl type classes a bit

* Update code gen

* Use extension for resolving

* Spotless

* Fix master conflicts

* Rename to toStringWithAnnotations()

* for (t in args.indices) {

* for (i in interfaces.indices) {

* Template
2022-01-06 14:54:13 -05:00
Jesse Wilson
7578984f25 Change the directory structure to match our modules (#1451) 2021-12-08 23:52:51 -05:00