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>
This commit is contained in:
renovate[bot]
2023-01-30 14:03:50 +00:00
committed by GitHub
parent 187f9f03b8
commit e6110de8c3
67 changed files with 546 additions and 495 deletions

View File

@@ -23,7 +23,7 @@ import java.util.Date
"""This class moved to avoid a package name conflict in the Java Platform Module System.
The new class is com.squareup.moshi.adapters.Rfc3339DateJsonAdapter.""",
replaceWith = ReplaceWith("com.squareup.moshi.adapters.Rfc3339DateJsonAdapter"),
level = DeprecationLevel.ERROR
level = DeprecationLevel.ERROR,
)
public class Rfc3339DateJsonAdapter : JsonAdapter<Date>() {

View File

@@ -78,12 +78,12 @@ public class EnumJsonAdapter<T : Enum<T>> internal constructor(
if (!useFallbackValue) {
val name = reader.nextString()
throw JsonDataException(
"Expected one of ${nameStrings.toList()} but was $name at path $path"
"Expected one of ${nameStrings.toList()} but was $name at path $path",
)
}
if (reader.peek() != STRING) {
throw JsonDataException(
"Expected a string but was ${reader.peek()} at path $path"
"Expected a string but was ${reader.peek()} at path $path",
)
}
reader.skipValue()
@@ -94,7 +94,7 @@ public class EnumJsonAdapter<T : Enum<T>> internal constructor(
override fun toJson(writer: JsonWriter, value: T?) {
if (value == null) {
throw NullPointerException(
"value was null! Wrap in .nullSafe() to write nullable values."
"value was null! Wrap in .nullSafe() to write nullable values.",
)
}
writer.value(nameStrings[value.ordinal])

View File

@@ -107,7 +107,6 @@ internal fun String.parseIsoDate(): Date {
return GregorianCalendar(year, month - 1, day).time
}
if (hasT) {
// extract hours, minutes, seconds and milliseconds
hour = parseInt(this, 1.let { offset += it; offset }, 2.let { offset += it; offset })
if (checkOffset(this, offset, ':')) {
@@ -164,14 +163,14 @@ internal fun String.parseIsoDate(): Date {
val cleaned = act.replace(":", "")
if (cleaned != timezoneId) {
throw IndexOutOfBoundsException(
"Mismatching time zone indicator: $timezoneId given, resolves to ${timezone.id}"
"Mismatching time zone indicator: $timezoneId given, resolves to ${timezone.id}",
)
}
}
}
} else {
throw IndexOutOfBoundsException(
"Invalid time zone indicator '$timezoneIndicator'"
"Invalid time zone indicator '$timezoneIndicator'",
)
}
val calendar: Calendar = GregorianCalendar(timezone)

View File

@@ -103,7 +103,7 @@ public class PolymorphicJsonAdapterFactory<T> internal constructor(
private val labelKey: String,
private val labels: List<String>,
private val subtypes: List<Type>,
private val fallbackJsonAdapter: JsonAdapter<Any>?
private val fallbackJsonAdapter: JsonAdapter<Any>?,
) : Factory {
/** Returns a new factory that decodes instances of `subtype`. */
public fun withSubtype(subtype: Class<out T>, label: String): PolymorphicJsonAdapterFactory<T> {
@@ -121,7 +121,7 @@ public class PolymorphicJsonAdapterFactory<T> internal constructor(
labelKey = labelKey,
labels = newLabels,
subtypes = newSubtypes,
fallbackJsonAdapter = fallbackJsonAdapter
fallbackJsonAdapter = fallbackJsonAdapter,
)
}
@@ -133,14 +133,14 @@ public class PolymorphicJsonAdapterFactory<T> internal constructor(
* it within your implementation of [JsonAdapter.fromJson]
*/
public fun withFallbackJsonAdapter(
fallbackJsonAdapter: JsonAdapter<Any>?
fallbackJsonAdapter: JsonAdapter<Any>?,
): PolymorphicJsonAdapterFactory<T> {
return PolymorphicJsonAdapterFactory(
baseType = baseType,
labelKey = labelKey,
labels = labels,
subtypes = subtypes,
fallbackJsonAdapter = fallbackJsonAdapter
fallbackJsonAdapter = fallbackJsonAdapter,
)
}
@@ -161,7 +161,7 @@ public class PolymorphicJsonAdapterFactory<T> internal constructor(
override fun toJson(writer: JsonWriter, value: Any?) {
throw IllegalArgumentException(
"Expected one of $subtypes but found $value, a ${value?.javaClass}. Register this subtype."
"Expected one of $subtypes but found $value, a ${value?.javaClass}. Register this subtype.",
)
}
}
@@ -181,7 +181,7 @@ public class PolymorphicJsonAdapterFactory<T> internal constructor(
private val labels: List<String>,
private val subtypes: List<Type>,
private val jsonAdapters: List<JsonAdapter<Any>>,
private val fallbackJsonAdapter: JsonAdapter<Any>?
private val fallbackJsonAdapter: JsonAdapter<Any>?,
) : JsonAdapter<Any>() {
/** Single-element options containing the label's key only. */
private val labelKeyOptions: Options = Options.of(labelKey)
@@ -211,7 +211,7 @@ public class PolymorphicJsonAdapterFactory<T> internal constructor(
val labelIndex = reader.selectString(labelOptions)
if (labelIndex == -1 && fallbackJsonAdapter == null) {
throw JsonDataException(
"Expected one of $labels for key '$labelKey' but found '${reader.nextString()}'. Register a subtype for this label."
"Expected one of $labels for key '$labelKey' but found '${reader.nextString()}'. Register a subtype for this label.",
)
}
return labelIndex
@@ -259,7 +259,7 @@ public class PolymorphicJsonAdapterFactory<T> internal constructor(
labelKey = labelKey,
labels = emptyList(),
subtypes = emptyList(),
fallbackJsonAdapter = null
fallbackJsonAdapter = null,
)
}
}