Upgrade kotlinpoet to 562b5c4a5297e85ae2727fc9f6c4e96e770d7420 am: 2ce0395b31 am: ea3cf49ba6 am: a00f60e1a9 am: 2c59cab21b am: 3480104013

Original change: https://android-review.googlesource.com/c/platform/external/kotlinpoet/+/2781899

Change-Id: I5e983f6da2a7fbd1e4db74ff7d4e83cc87c0bfbc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b9ff4be..0bd44d1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -17,7 +17,7 @@
 
     steps:
       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
       - name: Validate Gradle Wrapper
         uses: gradle/wrapper-validation-action@v1
@@ -37,7 +37,7 @@
 
     steps:
       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
       - name: Configure JDK
         uses: actions/setup-java@v3
diff --git a/.github/workflows/mkdocs-requirements.txt b/.github/workflows/mkdocs-requirements.txt
index cb9f093..213346e 100644
--- a/.github/workflows/mkdocs-requirements.txt
+++ b/.github/workflows/mkdocs-requirements.txt
@@ -1,19 +1,18 @@
-click==8.1.6
+click==8.1.7
 future==0.18.3
 Jinja2==3.1.2
 livereload==2.6.3
-lunr==0.6.2
-Markdown==3.3.7 # See https://github.com/mkdocs/mkdocs/issues/2892.
+lunr==0.7.0.post1
 MarkupSafe==2.1.3
-mkdocs==1.4.3
-mkdocs-macros-plugin==1.0.2
-mkdocs-material==9.1.19
-mkdocs-material-extensions==1.1.1
-Pygments==2.15.1
-pymdown-extensions==10.1
+mkdocs==1.5.3
+mkdocs-macros-plugin==1.0.4
+mkdocs-material==9.4.5
+mkdocs-material-extensions==1.2
+Pygments==2.16.1
+pymdown-extensions==10.3
 python-dateutil==2.8.2
 PyYAML==6.0.1
 repackage==0.7.3
 six==1.16.0
 termcolor==2.3.0
-tornado==6.3.2
+tornado==6.3.3
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index fe264de..cb8950a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -17,7 +17,7 @@
 
     steps:
       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4
 
       - name: Configure JDK
         uses: actions/setup-java@v3
diff --git a/METADATA b/METADATA
index c00b263..fbd5831 100644
--- a/METADATA
+++ b/METADATA
@@ -1,6 +1,6 @@
 # This project was upgraded with external_updater.
 # Usage: tools/external_updater/updater.sh update kotlinpoet
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
 
 name: "kotlinpoet"
 description: "A Kotlin API for generating .kt source files"
@@ -13,11 +13,11 @@
     type: GIT
     value: "https://github.com/square/kotlinpoet.git"
   }
-  version: "7ba293ecb6af9f66de19c689c4b69d8a3e20745e"
+  version: "562b5c4a5297e85ae2727fc9f6c4e96e770d7420"
   license_type: NOTICE
   last_upgrade_date {
     year: 2023
-    month: 7
-    day: 26
+    month: 10
+    day: 10
   }
 }
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 7e65f1f..6bba5eb 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -13,22 +13,22 @@
 # limitations under the License.
 
 [versions]
-kotlin = "1.9.0"
-kct = "0.3.1"
-ksp = "1.9.0-1.0.12"
+kotlin = "1.9.10"
+kct = "0.3.2"
+ksp = "1.9.10-1.0.13"
 ktlint = "0.48.2"
 
 [plugins]
 kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
-dokka = { id = "org.jetbrains.dokka", version = "1.8.20" }
+dokka = { id = "org.jetbrains.dokka", version = "1.9.0" }
 ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
-spotless = { id = "com.diffplug.spotless", version = "6.20.0" }
+spotless = { id = "com.diffplug.spotless", version = "6.22.0" }
 mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.25.3" }
 kotlinBinaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.13.2" }
 
 [libraries]
 autoCommon = { module = "com.google.auto:auto-common", version = "1.2.2" }
-guava = { module = "com.google.guava:guava", version = "32.1.1-jre" }
+guava = { module = "com.google.guava:guava", version = "32.1.2-jre" }
 javapoet = "com.squareup:javapoet:1.13.0"
 
 autoService = "com.google.auto.service:auto-service-annotations:1.1.1"
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 033e24c..7f93135 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index c747538..8838ba9 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
 networkTimeout=10000
 validateDistributionUrl=true
 zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
index fcb6fca..1aa94a4 100755
--- a/gradlew
+++ b/gradlew
@@ -83,7 +83,8 @@
 # This is normally unused
 # shellcheck disable=SC2034
 APP_BASE_NAME=${0##*/}
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
 
 # Use the maximum available, or set MAX_FD != -1 to use that value.
 MAX_FD=maximum
@@ -144,7 +145,7 @@
     case $MAX_FD in #(
       max*)
         # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
-        # shellcheck disable=SC3045
+        # shellcheck disable=SC2039,SC3045
         MAX_FD=$( ulimit -H -n ) ||
             warn "Could not query maximum file descriptor limit"
     esac
@@ -152,7 +153,7 @@
       '' | soft) :;; #(
       *)
         # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
-        # shellcheck disable=SC3045
+        # shellcheck disable=SC2039,SC3045
         ulimit -n "$MAX_FD" ||
             warn "Could not set maximum file descriptor limit to $MAX_FD"
     esac
@@ -201,11 +202,11 @@
 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 
-# Collect all arguments for the java command;
-#   * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-#     shell script including quotes and variable substitutions, so put them in
-#     double quotes to make sure that they get re-expanded; and
-#   * put everything else in single quotes, so that it's not re-expanded.
+# Collect all arguments for the java command:
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+#     and any embedded shellness will be escaped.
+#   * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+#     treated as '${Hostname}' itself on the command line.
 
 set -- \
         "-Dorg.gradle.appname=$APP_BASE_NAME" \
diff --git a/interop/kotlinx-metadata/api/kotlinx-metadata.api b/interop/kotlinx-metadata/api/kotlinx-metadata.api
index f780eae..091b303 100644
--- a/interop/kotlinx-metadata/api/kotlinx-metadata.api
+++ b/interop/kotlinx-metadata/api/kotlinx-metadata.api
@@ -190,10 +190,6 @@
 	public fun annotationSpec ()Lcom/squareup/kotlinpoet/AnnotationSpec;
 }
 
-public final class com/squareup/kotlinpoet/metadata/specs/JvmModifier$DefaultImpls {
-	public static fun annotationSpec (Lcom/squareup/kotlinpoet/metadata/specs/JvmModifier;)Lcom/squareup/kotlinpoet/AnnotationSpec;
-}
-
 public final class com/squareup/kotlinpoet/metadata/specs/KmTypesKt {
 	public static final fun isExtensionType (Lkotlinx/metadata/KmType;)Z
 }
diff --git a/interop/kotlinx-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/specs/JvmModifier.kt b/interop/kotlinx-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/specs/JvmModifier.kt
index 079a0e9..f09e6ad 100644
--- a/interop/kotlinx-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/specs/JvmModifier.kt
+++ b/interop/kotlinx-metadata/src/main/kotlin/com/squareup/kotlinpoet/metadata/specs/JvmModifier.kt
@@ -26,7 +26,6 @@
  * This API is considered read-only and should not be implemented outside of KotlinPoet.
  */
 @KotlinPoetMetadataPreview
-@JvmDefaultWithCompatibility
 public interface JvmModifier {
   public fun annotationSpec(): AnnotationSpec? {
     return null
diff --git a/kotlinpoet/api/kotlinpoet.api b/kotlinpoet/api/kotlinpoet.api
index c9547c1..114bd19 100644
--- a/kotlinpoet/api/kotlinpoet.api
+++ b/kotlinpoet/api/kotlinpoet.api
@@ -156,10 +156,6 @@
 }
 
 public abstract interface class com/squareup/kotlinpoet/ContextReceivable$Builder {
-	public abstract fun getContextReceiverTypes ()Ljava/util/List;
-}
-
-public final class com/squareup/kotlinpoet/ContextReceivable$Builder$DefaultImpls {
 }
 
 public abstract interface annotation class com/squareup/kotlinpoet/DelicateKotlinPoetApi : java/lang/annotation/Annotation {
diff --git a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/CodeBlock.kt b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/CodeBlock.kt
index 6c8e4bb..6a99631 100644
--- a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/CodeBlock.kt
+++ b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/CodeBlock.kt
@@ -371,6 +371,7 @@
       val format = DecimalFormatSymbols().apply {
         decimalSeparator = '.'
         groupingSeparator = '_'
+        minusSign = '-'
       }
 
       val precision = if (o is Float || o is Double) o.toString().split(".").last().length else 0
diff --git a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/ContextReceivable.kt b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/ContextReceivable.kt
index 127c360..929096b 100644
--- a/kotlinpoet/src/main/java/com/squareup/kotlinpoet/ContextReceivable.kt
+++ b/kotlinpoet/src/main/java/com/squareup/kotlinpoet/ContextReceivable.kt
@@ -23,7 +23,6 @@
   public val contextReceiverTypes: List<TypeName>
 
   /** The builder analogue to [ContextReceivable] types. */
-  @JvmDefaultWithCompatibility
   public interface Builder<out T : Builder<T>> {
 
     /** Mutable map of the current originating elements this builder contains. */
diff --git a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/CodeBlockTest.kt b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/CodeBlockTest.kt
index dc52f38..be4e62d 100644
--- a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/CodeBlockTest.kt
+++ b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/CodeBlockTest.kt
@@ -17,6 +17,7 @@
 
 import com.google.common.truth.Truth.assertThat
 import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
+import java.util.Locale
 import kotlin.test.Test
 
 class CodeBlockTest {
@@ -627,4 +628,16 @@
     assertThat(CodeBlock.of("%S", 10000.12345678901).toString()).isEqualTo("\"10000.12345678901\"")
     assertThat(CodeBlock.of("%S", 1281.toShort()).toString()).isEqualTo("\"1281\"")
   }
+
+  // https://github.com/square/kotlinpoet/issues/1657
+  @Test fun minusSignInSwedishLocale() {
+    val defaultLocale = Locale.getDefault()
+    Locale.setDefault(Locale.forLanguageTag("sv"))
+
+    val i = -42
+    val s = CodeBlock.of("val i = %L", i)
+    assertThat(s.toString()).isEqualTo("val i = -42")
+
+    Locale.setDefault(defaultLocale)
+  }
 }
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 4aefa8e..465f238 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -21,7 +21,7 @@
 }
 
 plugins {
-  id("org.gradle.toolchains.foojay-resolver-convention") version("0.6.0")
+  id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
 }
 
 include(