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
This commit is contained in:
Zac Sweers
2022-01-06 14:54:13 -05:00
committed by GitHub
parent e5e4c48767
commit e2c346e1de
21 changed files with 790 additions and 875 deletions

View File

@@ -68,7 +68,7 @@ public final class EnumJsonAdapter<T extends Enum<T>> extends JsonAdapter<T> {
nameStrings = new String[constants.length];
for (int i = 0; i < constants.length; i++) {
String constantName = constants[i].name();
nameStrings[i] = jsonName(constantName, enumType.getField(constantName));
nameStrings[i] = jsonName(enumType.getField(constantName), constantName);
}
options = JsonReader.Options.of(nameStrings);
} catch (NoSuchFieldException e) {