Format api and api/.../processing
diff --git a/api/build.gradle.kts b/api/build.gradle.kts
index 2ad2738..5393df6 100644
--- a/api/build.gradle.kts
+++ b/api/build.gradle.kts
@@ -20,14 +20,16 @@
     id("org.jetbrains.dokka")
 }
 
-val sourceJar = tasks.register<Jar>("sourcesJar") {
-    archiveClassifier.set("sources")
-    from(sourceSets.main.map { it.allSource })
-}
-val dokkaJavadocJar = tasks.register<Jar>("dokkaJavadocJar") {
-    archiveClassifier.set("javadoc")
-    from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
-}
+val sourceJar =
+    tasks.register<Jar>("sourcesJar") {
+        archiveClassifier.set("sources")
+        from(sourceSets.main.map { it.allSource })
+    }
+val dokkaJavadocJar =
+    tasks.register<Jar>("dokkaJavadocJar") {
+        archiveClassifier.set("javadoc")
+        from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
+    }
 
 publishing {
     publications {
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/KspExperimental.kt b/api/src/main/kotlin/com/google/devtools/ksp/KspExperimental.kt
index 611ea95..57f0d17 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/KspExperimental.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/KspExperimental.kt
@@ -18,8 +18,9 @@
 package com.google.devtools.ksp
 
 @RequiresOptIn(
-    message = "This API is experimental." +
-        "It may be changed in the future without notice or might be removed."
+    message =
+        "This API is experimental." +
+            "It may be changed in the future without notice or might be removed."
 )
 @Retention(AnnotationRetention.BINARY)
 annotation class KspExperimental
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/errors/InternalKSPException.kt b/api/src/main/kotlin/com/google/devtools/ksp/errors/InternalKSPException.kt
index 0dd0d63..0d9c7ee 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/errors/InternalKSPException.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/errors/InternalKSPException.kt
@@ -29,25 +29,27 @@
 internal class InternalKSPException(
     message: String,
     val location: Location,
-    val originatingClass: Class<*>
-) : Exception(
-    buildString {
-        appendLine(">>> Internal KSP Error")
-        appendLine("   | *** THIS IS A BUG IN KSP ***")
-        appendLine("   |")
-        message.lines().forEach { messageLine ->
-            appendLine("   | $messageLine")
+    val originatingClass: Class<*>,
+) :
+    Exception(
+        buildString {
+            appendLine(">>> Internal KSP Error")
+            appendLine("   | *** THIS IS A BUG IN KSP ***")
+            appendLine("   |")
+            message.lines().forEach { messageLine ->
+                appendLine("   | $messageLine")
+            }
+            appendLine("   |")
+            appendLine("   | Location           : ${location.render()}")
+            appendLine("   | Class at occurrence: $originatingClass")
+            appendLine("   |")
+            appendLine("   | You can report it at https://github.com/google/ksp/issues/new")
+            appendLine("   |")
         }
-        appendLine("   |")
-        appendLine("   | Location           : ${location.render()}")
-        appendLine("   | Class at occurrence: $originatingClass")
-        appendLine("   |")
-        appendLine("   | You can report it at https://github.com/google/ksp/issues/new")
-        appendLine("   |")
-    }
-) {
+    ) {
     override fun toString(): String {
-        // N.B.: Override the toString method to prevent the big error message being printed in the stack trace.
+        // N.B.: Override the toString method to prevent the big error message being printed in the
+        // stack trace.
         return buildString {
             append(javaClass.name)
             append(": ")
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/CodeGenerator.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/CodeGenerator.kt
index bcddbe7..e85678f 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/CodeGenerator.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/CodeGenerator.kt
@@ -23,36 +23,40 @@
 /**
  * [CodeGenerator] creates and manages files.
  *
- * Files created by [CodeGenerator] are considered in incremental processing.
- * Kotlin and Java files will be compiled together with other source files in the module.
- * Files created without using this API will not participate in incremental processing nor subsequent compilations.
+ * Files created by [CodeGenerator] are considered in incremental processing. Kotlin and Java files
+ * will be compiled together with other source files in the module. Files created without using this
+ * API will not participate in incremental processing nor subsequent compilations.
  */
 interface CodeGenerator {
     /**
      * Creates a file which is managed by [CodeGenerator]
      *
-     * Sources of corresponding [KSNode]s which are obtained directly from [Resolver] need to be specified.
-     * Namely, the containing files of those [KSNode]s who are obtained from:
-     *   * [Resolver.getAllFiles]
-     *   * [Resolver.getSymbolsWithAnnotation]
-     *   * [Resolver.getClassDeclarationByName]
+     * Sources of corresponding [KSNode]s which are obtained directly from [Resolver] need to be
+     * specified. Namely, the containing files of those [KSNode]s who are obtained from:
+     * * [Resolver.getAllFiles]
+     * * [Resolver.getSymbolsWithAnnotation]
+     * * [Resolver.getClassDeclarationByName]
      *
-     * Instead of requiring processors to specify all source files which are relevant in generating the given output,
-     * KSP traces dependencies automatically and only needs to know those sources that only processors know what they
-     * are for. If a [KSFile] is indirectly obtained through other [KSNode]s, it hasn't to be specified for the given
-     * output, even if its contents contribute to the generation of the output.
+     * Instead of requiring processors to specify all source files which are relevant in generating
+     * the given output, KSP traces dependencies automatically and only needs to know those sources
+     * that only processors know what they are for. If a [KSFile] is indirectly obtained through
+     * other [KSNode]s, it hasn't to be specified for the given output, even if its contents
+     * contribute to the generation of the output.
      *
-     * For example, a processor generates an output `O` after reading class `A` in `A.kt` and class `B` in `B.kt`,
-     * where `A` extends `B`. The processor got `A` by [Resolver.getSymbolsWithAnnotation] and then got `B` by
-     * [KSClassDeclaration.superTypes] from `A`. Because the inclusion of `B` is due to `A`, `B.kt` needn't to be
-     * specified in [dependencies] for `O`. Note that specifying `B.kt` in this case doesn't hurt, it is only unnecessary.
+     * For example, a processor generates an output `O` after reading class `A` in `A.kt` and class
+     * `B` in `B.kt`, where `A` extends `B`. The processor got `A` by
+     * [Resolver.getSymbolsWithAnnotation] and then got `B` by [KSClassDeclaration.superTypes] from
+     * `A`. Because the inclusion of `B` is due to `A`, `B.kt` needn't to be specified in
+     * [dependencies] for `O`. Note that specifying `B.kt` in this case doesn't hurt, it is only
+     * unnecessary.
      *
-     * @param dependencies are [KSFile]s from which this output is built. Only those that are obtained directly
-     *                     from [Resolver] are required.
-     * @param packageName corresponds to the relative path of the generated file; using either '.'or '/' as separator.
+     * @param dependencies are [KSFile]s from which this output is built. Only those that are
+     *   obtained directly from [Resolver] are required.
+     * @param packageName corresponds to the relative path of the generated file; using either '.'or
+     *   '/' as separator.
      * @param fileName file name
      * @param extensionName If "kt" or "java", this file will participate in subsequent compilation.
-     *                      Otherwise its creation is only considered in incremental processing.
+     *   Otherwise its creation is only considered in incremental processing.
      * @return OutputStream for writing into files.
      * @see [CodeGenerator] for more details.
      */
@@ -60,31 +64,35 @@
         dependencies: Dependencies,
         packageName: String,
         fileName: String,
-        extensionName: String = "kt"
+        extensionName: String = "kt",
     ): OutputStream
 
     /**
      * Creates a file which is managed by [CodeGenerator]
      *
-     * Sources of corresponding [KSNode]s which are obtained directly from [Resolver] need to be specified.
-     * Namely, the containing files of those [KSNode]s who are obtained from:
-     *   * [Resolver.getAllFiles]
-     *   * [Resolver.getSymbolsWithAnnotation]
-     *   * [Resolver.getClassDeclarationByName]
+     * Sources of corresponding [KSNode]s which are obtained directly from [Resolver] need to be
+     * specified. Namely, the containing files of those [KSNode]s who are obtained from:
+     * * [Resolver.getAllFiles]
+     * * [Resolver.getSymbolsWithAnnotation]
+     * * [Resolver.getClassDeclarationByName]
      *
-     * Instead of requiring processors to specify all source files which are relevant in generating the given output,
-     * KSP traces dependencies automatically and only needs to know those sources that only processors know what they
-     * are for. If a [KSFile] is indirectly obtained through other [KSNode]s, it hasn't to be specified for the given
-     * output, even if its contents contribute to the generation of the output.
+     * Instead of requiring processors to specify all source files which are relevant in generating
+     * the given output, KSP traces dependencies automatically and only needs to know those sources
+     * that only processors know what they are for. If a [KSFile] is indirectly obtained through
+     * other [KSNode]s, it hasn't to be specified for the given output, even if its contents
+     * contribute to the generation of the output.
      *
-     * For example, a processor generates an output `O` after reading class `A` in `A.kt` and class `B` in `B.kt`,
-     * where `A` extends `B`. The processor got `A` by [Resolver.getSymbolsWithAnnotation] and then got `B` by
-     * [KSClassDeclaration.superTypes] from `A`. Because the inclusion of `B` is due to `A`, `B.kt` needn't to be
-     * specified in [dependencies] for `O`. Note that specifying `B.kt` in this case doesn't hurt, it is only unnecessary.
+     * For example, a processor generates an output `O` after reading class `A` in `A.kt` and class
+     * `B` in `B.kt`, where `A` extends `B`. The processor got `A` by
+     * [Resolver.getSymbolsWithAnnotation] and then got `B` by [KSClassDeclaration.superTypes] from
+     * `A`. Because the inclusion of `B` is due to `A`, `B.kt` needn't to be specified in
+     * [dependencies] for `O`. Note that specifying `B.kt` in this case doesn't hurt, it is only
+     * unnecessary.
      *
-     * @param dependencies are [KSFile]s from which this output is built. Only those that are obtained directly
-     *                     from [Resolver] are required.
-     * @param path corresponds to the relative path of the generated file; includes the full file name
+     * @param dependencies are [KSFile]s from which this output is built. Only those that are
+     *   obtained directly from [Resolver] are required.
+     * @param path corresponds to the relative path of the generated file; includes the full file
+     *   name
      * @param fileType determines the target directory to store the file
      * @return OutputStream for writing into files.
      * @see [CodeGenerator] for more details.
@@ -92,28 +100,35 @@
     fun createNewFileByPath(
         dependencies: Dependencies,
         path: String,
-        extensionName: String = "kt"
+        extensionName: String = "kt",
     ): OutputStream
 
     /**
      * Associate [sources] to an output file.
      *
-     * @param sources are [KSFile]s from which this output is built. Only those that are obtained directly
-     *                     from [Resolver] are required.
-     * @param packageName corresponds to the relative path of the generated file; using either '.'or '/' as separator.
+     * @param sources are [KSFile]s from which this output is built. Only those that are obtained
+     *   directly from [Resolver] are required.
+     * @param packageName corresponds to the relative path of the generated file; using either '.'or
+     *   '/' as separator.
      * @param fileName file name
      * @param extensionName If "kt" or "java", this file will participate in subsequent compilation.
-     *                      Otherwise its creation is only considered in incremental processing.
+     *   Otherwise its creation is only considered in incremental processing.
      * @see [CodeGenerator] for more details.
      */
-    fun associate(sources: List<KSFile>, packageName: String, fileName: String, extensionName: String = "kt")
+    fun associate(
+        sources: List<KSFile>,
+        packageName: String,
+        fileName: String,
+        extensionName: String = "kt",
+    )
 
     /**
      * Associate [sources] to an output file.
      *
-     * @param sources are [KSFile]s from which this output is built. Only those that are obtained directly
-     *                     from [Resolver] are required.
-     * @param path corresponds to the relative path of the generated file; includes the full file name
+     * @param sources are [KSFile]s from which this output is built. Only those that are obtained
+     *   directly from [Resolver] are required.
+     * @param path corresponds to the relative path of the generated file; includes the full file
+     *   name
      * @param fileType determines the target directory where the file should exist
      * @see [CodeGenerator] for more details.
      */
@@ -122,19 +137,20 @@
     /**
      * Associate [classes] to an output file.
      *
-     * @param classes are [KSClassDeclaration]s from which this output is built. Only those that are obtained directly
-     *                     from [Resolver] are required.
-     * @param packageName corresponds to the relative path of the generated file; using either '.'or '/' as separator.
+     * @param classes are [KSClassDeclaration]s from which this output is built. Only those that are
+     *   obtained directly from [Resolver] are required.
+     * @param packageName corresponds to the relative path of the generated file; using either '.'or
+     *   '/' as separator.
      * @param fileName file name
      * @param extensionName If "kt" or "java", this file will participate in subsequent compilation.
-     *                      Otherwise its creation is only considered in incremental processing.
+     *   Otherwise its creation is only considered in incremental processing.
      * @see [CodeGenerator] for more details.
      */
     fun associateWithClasses(
         classes: List<KSClassDeclaration>,
         packageName: String,
         fileName: String,
-        extensionName: String = "kt"
+        extensionName: String = "kt",
     )
 
     val generatedFile: Collection<File>
@@ -142,64 +158,69 @@
     /**
      * Associate [functions] to an output file.
      *
-     * @param functions are [KSFunctionDeclaration]s from which this output is built. Only those that are obtained
-     *              directly from [Resolver] are required.
-     * @param packageName corresponds to the relative path of the generated file; using either '.'or '/' as separator.
+     * @param functions are [KSFunctionDeclaration]s from which this output is built. Only those
+     *   that are obtained directly from [Resolver] are required.
+     * @param packageName corresponds to the relative path of the generated file; using either '.'or
+     *   '/' as separator.
      * @param fileName file name
      * @param extensionName If "kt" or "java", this file will participate in subsequent compilation.
-     *                      Otherwise its creation is only considered in incremental processing.
+     *   Otherwise its creation is only considered in incremental processing.
      * @see [CodeGenerator] for more details.
      */
     fun associateWithFunctions(
         functions: List<KSFunctionDeclaration>,
         packageName: String,
         fileName: String,
-        extensionName: String = "kt"
+        extensionName: String = "kt",
     ) = Unit
 
     /**
      * Associate [properties] to an output file.
      *
-     * @param properties are [KSPropertyDeclaration]s from which this output is built. Only those that are obtained
-     *              directly from [Resolver] are required.
-     * @param packageName corresponds to the relative path of the generated file; using either '.'or '/' as separator.
+     * @param properties are [KSPropertyDeclaration]s from which this output is built. Only those
+     *   that are obtained directly from [Resolver] are required.
+     * @param packageName corresponds to the relative path of the generated file; using either '.'or
+     *   '/' as separator.
      * @param fileName file name
      * @param extensionName If "kt" or "java", this file will participate in subsequent compilation.
-     *                      Otherwise its creation is only considered in incremental processing.
+     *   Otherwise its creation is only considered in incremental processing.
      * @see [CodeGenerator] for more details.
      */
     fun associateWithProperties(
         properties: List<KSPropertyDeclaration>,
         packageName: String,
         fileName: String,
-        extensionName: String = "kt"
+        extensionName: String = "kt",
     ) = Unit
 }
 
-/**
- * Dependencies of an output file.
- */
-class Dependencies private constructor(
+/** Dependencies of an output file. */
+class Dependencies
+private constructor(
     val isAllSources: Boolean,
     val aggregating: Boolean,
-    val originatingFiles: List<KSFile>
+    val originatingFiles: List<KSFile>,
 ) {
 
     /**
      * Create a [Dependencies] to associate with an output.
      *
-     * @param aggregating whether the output should be invalidated by a new source file or a change in any of the existing files.
-     *                           Namely, whenever there is new information.
+     * @param aggregating whether the output should be invalidated by a new source file or a change
+     *   in any of the existing files. Namely, whenever there is new information.
      * @param sources Sources for this output to depend on.
      */
-    constructor(aggregating: Boolean, vararg sources: KSFile) : this(false, aggregating, sources.toList())
+    constructor(
+        aggregating: Boolean,
+        vararg sources: KSFile,
+    ) : this(false, aggregating, sources.toList())
 
     companion object {
         /**
          * A short-hand to all source files.
          *
-         * Associating an output to [ALL_SOURCES] essentially disables incremental processing, as the tiniest change will clobber all files.
-         * This should not be used in processors which care about processing speed.
+         * Associating an output to [ALL_SOURCES] essentially disables incremental processing, as
+         * the tiniest change will clobber all files. This should not be used in processors which
+         * care about processing speed.
          */
         val ALL_FILES = Dependencies(true, true, emptyList())
     }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/ExitCode.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/ExitCode.kt
index bc14bbc..afc9205 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/ExitCode.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/ExitCode.kt
@@ -1,13 +1,11 @@
 package com.google.devtools.ksp.processing
 
-enum class ExitCode(
-    @Suppress("UNUSED_PARAMETER")
-    code: Int
-) {
+enum class ExitCode(@Suppress("UNUSED_PARAMETER") code: Int) {
     OK(0),
 
     // Whenever there are some error messages.
     PROCESSING_ERROR(1),
 
-    // Let exceptions pop through to the caller. Don't catch and convert them to, e.g., INTERNAL_ERROR.
+    // Let exceptions pop through to the caller. Don't catch and convert them to, e.g.,
+    // INTERNAL_ERROR.
 }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/KSBuiltIns.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/KSBuiltIns.kt
index 95da7de..4c3c55a 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/KSBuiltIns.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/KSBuiltIns.kt
@@ -19,9 +19,7 @@
 import com.google.devtools.ksp.symbol.KSType
 
 interface KSBuiltIns {
-    /**
-     * Common Standard Library types. Use [Resolver.getClassDeclarationByName] for other types.
-     */
+    /** Common Standard Library types. Use [Resolver.getClassDeclarationByName] for other types. */
     val anyType: KSType
     val nothingType: KSType
     val unitType: KSType
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/KSPLogger.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/KSPLogger.kt
index 3ca30a6..a5b6ed2 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/KSPLogger.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/KSPLogger.kt
@@ -21,8 +21,11 @@
 interface KSPLogger {
 
     fun logging(message: String, symbol: KSNode? = null)
+
     fun info(message: String, symbol: KSNode? = null)
+
     fun warn(message: String, symbol: KSNode? = null)
+
     fun error(message: String, symbol: KSNode? = null)
 
     fun exception(e: Throwable)
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/PlatformInfo.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/PlatformInfo.kt
index 1b9db85..441fe86 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/PlatformInfo.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/PlatformInfo.kt
@@ -17,9 +17,7 @@
 
 package com.google.devtools.ksp.processing
 
-/**
- * Platform specific information
- */
+/** Platform specific information */
 interface PlatformInfo {
     val platformName: String
 }
@@ -28,30 +26,20 @@
  * Platform information for JVM
  */
 interface JvmPlatformInfo : PlatformInfo {
-    /**
-     * JVM target version. Correspond to `-jvm-target` to Kotlin compiler
-     */
+    /** JVM target version. Correspond to `-jvm-target` to Kotlin compiler */
     val jvmTarget: String
 
-    /**
-     * JVM default mode. Correspond to `-jvm-default' to Kotlin compiler
-     */
+    /** JVM default mode. Correspond to `-jvm-default' to Kotlin compiler */
     val jvmDefaultMode: String
 }
 
-/**
- * Platform information for JS
- */
+/** Platform information for JS */
 interface JsPlatformInfo : PlatformInfo
 
-/**
- * Platform information for native platforms
- */
+/** Platform information for native platforms */
 interface NativePlatformInfo : PlatformInfo {
     val targetName: String
 }
 
-/**
- * Unknown platform to KSP
- */
+/** Unknown platform to KSP */
 interface UnknownPlatformInfo : PlatformInfo
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt
index 6df2586..25b0c63 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/Resolver.kt
@@ -19,9 +19,7 @@
 import com.google.devtools.ksp.KspExperimental
 import com.google.devtools.ksp.symbol.*
 
-/**
- * [Resolver] provides [SymbolProcessor] with access to compiler details such as Symbols.
- */
+/** [Resolver] provides [SymbolProcessor] with access to compiler details such as Symbols. */
 interface Resolver {
     /**
      * Get all new files in the module / compilation unit.
@@ -33,33 +31,39 @@
     /**
      * Get all files in the module / compilation unit.
      *
-     * @return all input files including generated files from previous rounds, note when incremental is enabled, only dirty files up for processing will be returned.
+     * @return all input files including generated files from previous rounds, note when incremental
+     *   is enabled, only dirty files up for processing will be returned.
      */
     fun getAllFiles(): Sequence<KSFile>
 
     /**
-     * Get all symbols with specified annotation in the current compilation unit.
-     * Note that in multiple round processing, only symbols from deferred symbols of last round and symbols from newly generated files will be returned in this function.
+     * Get all symbols with specified annotation in the current compilation unit. Note that in
+     * multiple round processing, only symbols from deferred symbols of last round and symbols from
+     * newly generated files will be returned in this function.
      *
      * @param annotationName is the fully qualified name of the annotation; using '.' as separator.
-     * @param inDepth whether to check symbols in depth, i.e. check symbols from local declarations. Operation can be expensive if true.
+     * @param inDepth whether to check symbols in depth, i.e. check symbols from local declarations.
+     *   Operation can be expensive if true.
      * @return Elements annotated with the specified annotation.
-     *
      * @see getDeclarationsFromPackage to get declarations outside the current compilation unit.
      */
-    fun getSymbolsWithAnnotation(annotationName: String, inDepth: Boolean = false): Sequence<KSAnnotated>
+    fun getSymbolsWithAnnotation(
+        annotationName: String,
+        inDepth: Boolean = false,
+    ): Sequence<KSAnnotated>
 
     /**
      * Find a class in the compilation classpath for the given name.
      *
-     * This returns the exact platform class when given a platform name. Note that java.lang.String isn't compatible
-     * with kotlin.String in the type system. Therefore, processors need to use mapJavaNameToKotlin() and mapKotlinNameToJava()
-     * explicitly to find the corresponding class names before calling getClassDeclarationByName if type checking
-     * is needed for the classes loaded by this.
+     * This returns the exact platform class when given a platform name. Note that java.lang.String
+     * isn't compatible with kotlin.String in the type system. Therefore, processors need to use
+     * mapJavaNameToKotlin() and mapKotlinNameToJava() explicitly to find the corresponding class
+     * names before calling getClassDeclarationByName if type checking is needed for the classes
+     * loaded by this.
      *
-     * This behavior is limited to getClassDeclarationByName; When processors get a class or type from a Java source
-     * file, the conversion is done automatically. E.g., a java.lang.String in a Java source file is loaded as
-     * kotlin.String in KSP.
+     * This behavior is limited to getClassDeclarationByName; When processors get a class or type
+     * from a Java source file, the conversion is done automatically. E.g., a java.lang.String in a
+     * Java source file is loaded as kotlin.String in KSP.
      *
      * @param name fully qualified name of the class to be loaded; using '.' as separator.
      * @return a KSClassDeclaration, or null if not found.
@@ -70,19 +74,27 @@
      * Find functions in the compilation classpath for the given name.
      *
      * @param name fully qualified name of the function to be loaded; using '.' as separator.
-     * @param includeTopLevel a boolean value indicate if top level functions should be searched. Default false. Note if top level functions are included, this operation can be expensive.
+     * @param includeTopLevel a boolean value indicate if top level functions should be searched.
+     *   Default false. Note if top level functions are included, this operation can be expensive.
      * @return a Sequence of KSFunctionDeclaration
      */
-    fun getFunctionDeclarationsByName(name: KSName, includeTopLevel: Boolean = false): Sequence<KSFunctionDeclaration>
+    fun getFunctionDeclarationsByName(
+        name: KSName,
+        includeTopLevel: Boolean = false,
+    ): Sequence<KSFunctionDeclaration>
 
     /**
      * Find a property in the compilation classpath for the given name.
      *
      * @param name fully qualified name of the property to be loaded; using '.' as separator.
-     * @param includeTopLevel a boolean value indicate if top level properties should be searched. Default false. Note if top level properties are included, this operation can be expensive.
+     * @param includeTopLevel a boolean value indicate if top level properties should be searched.
+     *   Default false. Note if top level properties are included, this operation can be expensive.
      * @return a KSPropertyDeclaration, or null if not found.
      */
-    fun getPropertyDeclarationByName(name: KSName, includeTopLevel: Boolean = false): KSPropertyDeclaration?
+    fun getPropertyDeclarationByName(
+        name: KSName,
+        includeTopLevel: Boolean = false,
+    ): KSPropertyDeclaration?
 
     /**
      * Compose a type argument out of a type reference and a variance
@@ -93,186 +105,183 @@
      */
     fun getTypeArgument(typeRef: KSTypeReference, variance: Variance): KSTypeArgument
 
-    /**
-     * Get a [KSName] from a String.
-     */
+    /** Get a [KSName] from a String. */
     fun getKSNameFromString(name: String): KSName
 
-    /**
-     * Create a [KSTypeReference] from a [KSType]
-     */
+    /** Create a [KSTypeReference] from a [KSType] */
     fun createKSTypeReferenceFromKSType(type: KSType): KSTypeReference
 
     /**
-     * Provides built in types for convenience. For example, [KSBuiltins.anyType] is the KSType instance for class 'kotlin.Any'.
+     * Provides built in types for convenience. For example, [KSBuiltins.anyType] is the KSType
+     * instance for class 'kotlin.Any'.
      */
     val builtIns: KSBuiltIns
 
     /**
-     * map a declaration to jvm signature.
-     * This function might fail due to resolution error, in case of error, null is returned.
-     * Resolution error could be caused by bad code that could not be resolved by compiler, or KSP bugs.
-     * If you believe your code is correct, please file a bug at https://github.com/google/ksp/issues/new
+     * map a declaration to jvm signature. This function might fail due to resolution error, in case
+     * of error, null is returned. Resolution error could be caused by bad code that could not be
+     * resolved by compiler, or KSP bugs. If you believe your code is correct, please file a bug at
+     * https://github.com/google/ksp/issues/new
      */
-    @KspExperimental
-    fun mapToJvmSignature(declaration: KSDeclaration): String?
+    @KspExperimental fun mapToJvmSignature(declaration: KSDeclaration): String?
 
     /**
      * @param overrider the candidate overriding declaration being checked.
      * @param overridee the candidate overridden declaration being checked.
-     * @return boolean value indicating whether [overrider] overrides [overridee]
-     * Calling [overrides] is expensive and should be avoided if possible.
+     * @return boolean value indicating whether [overrider] overrides [overridee] Calling
+     *   [overrides] is expensive and should be avoided if possible.
      */
     fun overrides(overrider: KSDeclaration, overridee: KSDeclaration): Boolean
 
     /**
      * @param overrider the candidate overriding declaration being checked.
      * @param overridee the candidate overridden declaration being checked.
-     * @param containingClass the containing class of candidate overriding and overridden declaration being checked.
-     * @return boolean value indicating whether [overrider] overrides [overridee]
-     * Calling [overrides] is expensive and should be avoided if possible.
+     * @param containingClass the containing class of candidate overriding and overridden
+     *   declaration being checked.
+     * @return boolean value indicating whether [overrider] overrides [overridee] Calling
+     *   [overrides] is expensive and should be avoided if possible.
      */
-    fun overrides(overrider: KSDeclaration, overridee: KSDeclaration, containingClass: KSClassDeclaration): Boolean
+    fun overrides(
+        overrider: KSDeclaration,
+        overridee: KSDeclaration,
+        containingClass: KSClassDeclaration,
+    ): Boolean
 
     /**
-     * Returns the jvm name of the given function.
-     * This function might fail due to resolution error, in case of error, null is returned.
-     * Resolution error could be caused by bad code that could not be resolved by compiler, or KSP bugs.
-     * If you believe your code is correct, please file a bug at https://github.com/google/ksp/issues/new
+     * Returns the jvm name of the given function. This function might fail due to resolution error,
+     * in case of error, null is returned. Resolution error could be caused by bad code that could
+     * not be resolved by compiler, or KSP bugs. If you believe your code is correct, please file a
+     * bug at https://github.com/google/ksp/issues/new
      *
-     * The jvm name of a function might depend on the Kotlin Compiler version hence it is not guaranteed to be
-     * compatible between different compiler versions except for the rules outlined in the Java interoperability
-     * documentation: https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html.
+     * The jvm name of a function might depend on the Kotlin Compiler version hence it is not
+     * guaranteed to be compatible between different compiler versions except for the rules outlined
+     * in the Java interoperability documentation:
+     * https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html.
      *
-     * If the [declaration] is annotated with [JvmName], that name will be returned from this function.
+     * If the [declaration] is annotated with [JvmName], that name will be returned from this
+     * function.
      *
-     * Note that this might be different from the name declared in the Kotlin source code in two cases:
-     * a) If the function receives or returns an inline class, its name will be mangled according to
-     * https://kotlinlang.org/docs/reference/inline-classes.html#mangling.
-     * b) If the function is declared as internal, it will include a suffix with the module name.
+     * Note that this might be different from the name declared in the Kotlin source code in two
+     * cases: a) If the function receives or returns an inline class, its name will be mangled
+     * according to https://kotlinlang.org/docs/reference/inline-classes.html#mangling. b) If the
+     * function is declared as internal, it will include a suffix with the module name.
      *
-     * NOTE: As inline classes are an experimental feature, the result of this function might change based on the
-     * kotlin version used in the project.
+     * NOTE: As inline classes are an experimental feature, the result of this function might change
+     * based on the kotlin version used in the project.
      */
-    @KspExperimental
-    fun getJvmName(declaration: KSFunctionDeclaration): String?
+    @KspExperimental fun getJvmName(declaration: KSFunctionDeclaration): String?
 
     /**
-     * Returns the jvm name of the given property accessor.
-     * This function might fail due to resolution error, in case of error, null is returned.
-     * Resolution error could be caused by bad code that could not be resolved by compiler, or KSP bugs.
-     * If you believe your code is correct, please file a bug at https://github.com/google/ksp/issues/new
+     * Returns the jvm name of the given property accessor. This function might fail due to
+     * resolution error, in case of error, null is returned. Resolution error could be caused by bad
+     * code that could not be resolved by compiler, or KSP bugs. If you believe your code is
+     * correct, please file a bug at https://github.com/google/ksp/issues/new
      *
-     * The jvm name of an accessor might depend on the Kotlin Compiler version hence it is not guaranteed to be
-     * compatible between different compiler versions except for the rules outlined in the Java interoperability
-     * documentation: https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html.
+     * The jvm name of an accessor might depend on the Kotlin Compiler version hence it is not
+     * guaranteed to be compatible between different compiler versions except for the rules outlined
+     * in the Java interoperability documentation:
+     * https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html.
      *
      * If the [accessor] is annotated with [JvmName], that name will be returned from this function.
      *
      * By default, this name will match the name calculated according to
-     * https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#properties.
-     * Note that the result of this function might be different from that name in two cases:
-     * a) If the property's type is an internal class, accessor's name will be mangled according to
-     * https://kotlinlang.org/docs/reference/inline-classes.html#mangling.
-     * b) If the function is declared as internal, it will include a suffix with the module name.
+     * https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#properties. Note that the
+     * result of this function might be different from that name in two cases: a) If the property's
+     * type is an internal class, accessor's name will be mangled according to
+     * https://kotlinlang.org/docs/reference/inline-classes.html#mangling. b) If the function is
+     * declared as internal, it will include a suffix with the module name.
      *
-     * NOTE: As inline classes are an experimental feature, the result of this function might change based on the
-     * kotlin version used in the project.
-     * see: https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#properties
+     * NOTE: As inline classes are an experimental feature, the result of this function might change
+     * based on the kotlin version used in the project. see:
+     * https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#properties
      */
-    @KspExperimental
-    fun getJvmName(accessor: KSPropertyAccessor): String?
+    @KspExperimental fun getJvmName(accessor: KSPropertyAccessor): String?
 
     /**
-     * Returns the [binary class name](https://asm.ow2.io/javadoc/org/objectweb/asm/Type.html#getClassName()) of the
-     * owner class in JVM for the given [KSPropertyDeclaration].
+     * Returns the
+     * [binary class name](https://asm.ow2.io/javadoc/org/objectweb/asm/Type.html#getClassName()) of
+     * the owner class in JVM for the given [KSPropertyDeclaration].
      *
-     * For properties declared in classes / interfaces; this value is the binary class name of the declaring class.
+     * For properties declared in classes / interfaces; this value is the binary class name of the
+     * declaring class.
      *
-     * For top level properties, this is the binary class name of the synthetic class that is generated for the Kotlin
-     * file.
-     * see: https://kotlinlang.org/docs/java-to-kotlin-interop.html#package-level-functions
+     * For top level properties, this is the binary class name of the synthetic class that is
+     * generated for the Kotlin file. see:
+     * https://kotlinlang.org/docs/java-to-kotlin-interop.html#package-level-functions
      *
-     * Note that, for properties declared in companion objects, the returned owner class will be the Companion class.
-     * see: https://kotlinlang.org/docs/java-to-kotlin-interop.html#static-methods
+     * Note that, for properties declared in companion objects, the returned owner class will be the
+     * Companion class. see: https://kotlinlang.org/docs/java-to-kotlin-interop.html#static-methods
      */
-    @KspExperimental
-    fun getOwnerJvmClassName(declaration: KSPropertyDeclaration): String?
+    @KspExperimental fun getOwnerJvmClassName(declaration: KSPropertyDeclaration): String?
 
     /**
-     * Returns the [binary class name](https://asm.ow2.io/javadoc/org/objectweb/asm/Type.html#getClassName()) of the
-     * owner class in JVM for the given [KSFunctionDeclaration].
+     * Returns the
+     * [binary class name](https://asm.ow2.io/javadoc/org/objectweb/asm/Type.html#getClassName()) of
+     * the owner class in JVM for the given [KSFunctionDeclaration].
      *
-     * For functions declared in classes / interfaces; this value is the binary class name of the declaring class.
+     * For functions declared in classes / interfaces; this value is the binary class name of the
+     * declaring class.
      *
-     * For top level functions, this is the binary class name of the synthetic class that is generated for the Kotlin
-     * file.
-     * see: https://kotlinlang.org/docs/java-to-kotlin-interop.html#package-level-functions
+     * For top level functions, this is the binary class name of the synthetic class that is
+     * generated for the Kotlin file. see:
+     * https://kotlinlang.org/docs/java-to-kotlin-interop.html#package-level-functions
      *
-     * Note that, for functions declared in companion objects, the returned owner class will be the Companion class.
-     * see: https://kotlinlang.org/docs/java-to-kotlin-interop.html#static-methods
+     * Note that, for functions declared in companion objects, the returned owner class will be the
+     * Companion class. see: https://kotlinlang.org/docs/java-to-kotlin-interop.html#static-methods
      */
-    @KspExperimental
-    fun getOwnerJvmClassName(declaration: KSFunctionDeclaration): String?
+    @KspExperimental fun getOwnerJvmClassName(declaration: KSFunctionDeclaration): String?
 
     /**
      * Returns checked exceptions declared in a function's header.
-     * @return A sequence of [KSType] declared in `throws` statement for a Java method or in @Throws annotation for a Kotlin function.
-     * Checked exceptions from class files are not supported yet, an empty sequence will be returned instead.
+     *
+     * @return A sequence of [KSType] declared in `throws` statement for a Java method or in @Throws
+     *   annotation for a Kotlin function. Checked exceptions from class files are not supported
+     *   yet, an empty sequence will be returned instead.
      */
-    @KspExperimental
-    fun getJvmCheckedException(function: KSFunctionDeclaration): Sequence<KSType>
+    @KspExperimental fun getJvmCheckedException(function: KSFunctionDeclaration): Sequence<KSType>
 
     /**
      * Returns checked exceptions declared in a property accessor's header.
+     *
      * @return A sequence of [KSType] declared @Throws annotation for a Kotlin property accessor.
-     * Checked exceptions from class files are not supported yet, an empty sequence will be returned instead.
+     *   Checked exceptions from class files are not supported yet, an empty sequence will be
+     *   returned instead.
      */
-    @KspExperimental
-    fun getJvmCheckedException(accessor: KSPropertyAccessor): Sequence<KSType>
+    @KspExperimental fun getJvmCheckedException(accessor: KSPropertyAccessor): Sequence<KSType>
 
     /**
      * Returns declarations with the given package name.
      *
-     * getDeclarationsFromPackage looks for declaration in the whole classpath, including dependencies.
+     * getDeclarationsFromPackage looks for declaration in the whole classpath, including
+     * dependencies.
      *
      * @param packageName the package name to look up.
-     * @return A sequence of [KSDeclaration] with matching package name.
-     * This will return declarations from both dependencies and source.
+     * @return A sequence of [KSDeclaration] with matching package name. This will return
+     *   declarations from both dependencies and source.
      */
-    @KspExperimental
-    fun getDeclarationsFromPackage(packageName: String): Sequence<KSDeclaration>
+    @KspExperimental fun getDeclarationsFromPackage(packageName: String): Sequence<KSDeclaration>
 
     /**
      * Returns the corresponding Kotlin class with the given Java class.
      *
-     * E.g.
-     * java.lang.String -> kotlin.String
-     * java.lang.Integer -> kotlin.Int
-     * java.util.List -> kotlin.List
-     * java.util.Map.Entry -> kotlin.Map.Entry
-     * java.lang.Void -> null
+     * E.g. java.lang.String -> kotlin.String java.lang.Integer -> kotlin.Int java.util.List ->
+     * kotlin.List java.util.Map.Entry -> kotlin.Map.Entry java.lang.Void -> null
      *
      * @param javaName a Java class name
      * @return corresponding Kotlin class name or null
      */
-    @KspExperimental
-    fun mapJavaNameToKotlin(javaName: KSName): KSName?
+    @KspExperimental fun mapJavaNameToKotlin(javaName: KSName): KSName?
 
     /**
      * Returns the corresponding Java class with the given Kotlin class.
      *
-     * E.g.
-     * kotlin.Throwable -> java.lang.Throwable
-     * kotlin.Int -> java.lang.Integer
-     * kotlin.Nothing -> java.lang.Void
-     * kotlin.IntArray -> null
+     * E.g. kotlin.Throwable -> java.lang.Throwable kotlin.Int -> java.lang.Integer kotlin.Nothing
+     * -> java.lang.Void kotlin.IntArray -> null
      *
      * @param kotlinName a Java class name
      * @return corresponding Java class name or null
      */
-    @KspExperimental
-    fun mapKotlinNameToJava(kotlinName: KSName): KSName?
+    @KspExperimental fun mapKotlinNameToJava(kotlinName: KSName): KSName?
 
     /**
      * Same as KSDeclarationContainer.declarations, but sorted by declaration order in the source.
@@ -283,10 +292,10 @@
     fun getDeclarationsInSourceOrder(container: KSDeclarationContainer): Sequence<KSDeclaration>
 
     /**
-     * Returns a set of effective Java modifiers, if declaration is being / was generated to Java bytecode.
+     * Returns a set of effective Java modifiers, if declaration is being / was generated to Java
+     * bytecode.
      */
-    @KspExperimental
-    fun effectiveJavaModifiers(declaration: KSDeclaration): Set<Modifier>
+    @KspExperimental fun effectiveJavaModifiers(declaration: KSDeclaration): Set<Modifier>
 
     /**
      * Compute the corresponding Java wildcard, from the given reference.
@@ -294,17 +303,16 @@
      * @param reference the reference to the type usage
      * @return an equivalent type reference from the Java wildcard's point of view
      */
-    @KspExperimental
-    fun getJavaWildcard(reference: KSTypeReference): KSTypeReference
+    @KspExperimental fun getJavaWildcard(reference: KSTypeReference): KSTypeReference
 
     /**
-     * Tests a type if it was declared as legacy "raw" type in Java - a type with its type arguments fully omitted.
+     * Tests a type if it was declared as legacy "raw" type in Java - a type with its type arguments
+     * fully omitted.
      *
      * @param type a type to check.
      * @return True if the type is a "raw" type.
      */
-    @KspExperimental
-    fun isJavaRawType(type: KSType): Boolean
+    @KspExperimental fun isJavaRawType(type: KSType): Boolean
 
     /**
      * Returns annotations applied in package-info.java (if applicable) for given package name.
@@ -312,8 +320,7 @@
      * @param packageName package name to check.
      * @return a sequence of KSAnnotations applied in corresponding package-info.java file.
      */
-    @KspExperimental
-    fun getPackageAnnotations(packageName: String): Sequence<KSAnnotation>
+    @KspExperimental fun getPackageAnnotations(packageName: String): Sequence<KSAnnotation>
 
     /**
      * Returns name of packages with given annotation.
@@ -321,12 +328,8 @@
      * @param annotationName name of the annotation to be queried.
      * @return a sequence of package names with corresponding annotation name.
      */
-    @KspExperimental
-    fun getPackagesWithAnnotation(annotationName: String): Sequence<String>
+    @KspExperimental fun getPackagesWithAnnotation(annotationName: String): Sequence<String>
 
-    /**
-     * @return the name of the kotlin module this resolver is running on.
-     */
-    @KspExperimental
-    fun getModuleName(): KSName
+    /** @return the name of the kotlin module this resolver is running on. */
+    @KspExperimental fun getModuleName(): KSName
 }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessor.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessor.kt
index a952ef1..e41c47d 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessor.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessor.kt
@@ -20,30 +20,28 @@
 
 /**
  * [SymbolProcessor] is the interface used by plugins to integrate into Kotlin Symbol Processing.
- * SymbolProcessor supports multiple rounds of execution, a processor may return a list of deferred symbols at the end
- * of every round, which will be passed to processors again in the next round, together with the newly generated symbols.
- * On exceptions, KSP will try to distinguish between exceptions from KSP and exceptions from processors.
- * Exceptions from processors will immediately terminate processing and be logged as an error in KSPLogger.
- * Exceptions from KSP should be reported to KSP developers for further investigation.
- * At the end of the round where exceptions or errors happened, all processors will invoke onError() function to do
- * their own error handling.
+ * SymbolProcessor supports multiple rounds of execution, a processor may return a list of deferred
+ * symbols at the end of every round, which will be passed to processors again in the next round,
+ * together with the newly generated symbols. On exceptions, KSP will try to distinguish between
+ * exceptions from KSP and exceptions from processors. Exceptions from processors will immediately
+ * terminate processing and be logged as an error in KSPLogger. Exceptions from KSP should be
+ * reported to KSP developers for further investigation. At the end of the round where exceptions or
+ * errors happened, all processors will invoke onError() function to do their own error handling.
  */
 interface SymbolProcessor {
     /**
      * Called by Kotlin Symbol Processing to run the processing task.
      *
      * @param resolver provides [SymbolProcessor] with access to compiler details such as Symbols.
-     * @return A list of deferred symbols that the processor can't process. Only symbols that can't be processed at this round should be returned. Symbols in compiled code (libraries) are always valid and are ignored if returned in the deferral list.
+     * @return A list of deferred symbols that the processor can't process. Only symbols that can't
+     *   be processed at this round should be returned. Symbols in compiled code (libraries) are
+     *   always valid and are ignored if returned in the deferral list.
      */
     fun process(resolver: Resolver): List<KSAnnotated>
 
-    /**
-     * Called by Kotlin Symbol Processing to finalize the processing of a compilation.
-     */
+    /** Called by Kotlin Symbol Processing to finalize the processing of a compilation. */
     fun finish() {}
 
-    /**
-     * Called by Kotlin Symbol Processing to handle errors after a round of processing.
-     */
+    /** Called by Kotlin Symbol Processing to handle errors after a round of processing. */
     fun onError() {}
 }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorEnvironment.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorEnvironment.kt
index b541b51..c8cc503 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorEnvironment.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorEnvironment.kt
@@ -18,34 +18,22 @@
 package com.google.devtools.ksp.processing
 
 class SymbolProcessorEnvironment(
-    /**
-     * passed from command line, Gradle, etc.
-     */
+    /** passed from command line, Gradle, etc. */
     val options: Map<String, String>,
 
-    /**
-     * language version of compilation environment.
-     */
+    /** language version of compilation environment. */
     val kotlinVersion: KotlinVersion,
 
-    /**
-     * creates managed files.
-     */
+    /** creates managed files. */
     val codeGenerator: CodeGenerator,
 
-    /**
-     * for logging to build output.
-     */
+    /** for logging to build output. */
     val logger: KSPLogger,
 
-    /**
-     * Kotlin API version of compilation environment.
-     */
+    /** Kotlin API version of compilation environment. */
     val apiVersion: KotlinVersion,
 
-    /**
-     * Kotlin compiler version of compilation environment.
-     */
+    /** Kotlin compiler version of compilation environment. */
     val compilerVersion: KotlinVersion,
 
     /**
@@ -55,9 +43,7 @@
      */
     val platforms: List<PlatformInfo>,
 
-    /**
-     * KSP version
-     */
+    /** KSP version */
     val kspVersion: KotlinVersion,
 ) {
     // For compatibility with KSP 1.0.2 and earlier
@@ -65,7 +51,7 @@
         options: Map<String, String>,
         kotlinVersion: KotlinVersion,
         codeGenerator: CodeGenerator,
-        logger: KSPLogger
+        logger: KSPLogger,
     ) : this(
         options,
         kotlinVersion,
@@ -74,7 +60,7 @@
         kotlinVersion,
         kotlinVersion,
         emptyList(),
-        KotlinVersion(1, 0)
+        KotlinVersion(1, 0),
     )
 
     constructor(
@@ -93,6 +79,6 @@
         apiVersion,
         compilerVersion,
         platforms,
-        KotlinVersion(1, 0)
+        KotlinVersion(1, 0),
     )
 }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorProvider.kt b/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorProvider.kt
index b9ab7a0..32fd4ff 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorProvider.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorProvider.kt
@@ -1,11 +1,10 @@
 package com.google.devtools.ksp.processing
 
 /**
- * [SymbolProcessorProvider] is the interface used by plugins to integrate into Kotlin Symbol Processing.
+ * [SymbolProcessorProvider] is the interface used by plugins to integrate into Kotlin Symbol
+ * Processing.
  */
 fun interface SymbolProcessorProvider {
-    /**
-     * Called by Kotlin Symbol Processing to create the processor.
-     */
+    /** Called by Kotlin Symbol Processing to create the processor. */
     fun create(environment: SymbolProcessorEnvironment): SymbolProcessor
 }
diff --git a/api/src/main/kotlin/com/google/devtools/ksp/utils.kt b/api/src/main/kotlin/com/google/devtools/ksp/utils.kt
index 274bfdb..3224595 100644
--- a/api/src/main/kotlin/com/google/devtools/ksp/utils.kt
+++ b/api/src/main/kotlin/com/google/devtools/ksp/utils.kt
@@ -48,7 +48,6 @@
  *
  * @param T The class to resolve a [KSClassDeclaration] for.
  * @return Resolved [KSClassDeclaration] if found, `null` otherwise.
- *
  * @see [Resolver.getClassDeclarationByName]
  */
 inline fun <reified T> Resolver.getClassDeclarationByName(): KSClassDeclaration? {
@@ -70,28 +69,34 @@
  * Find functions in the compilation classpath for the given name.
  *
  * @param name fully qualified name of the function to be loaded; using '.' as separator.
- * @param includeTopLevel a boolean value indicate if top level functions should be searched. Default false. Note if top level functions are included, this operation can be expensive.
+ * @param includeTopLevel a boolean value indicate if top level functions should be searched.
+ *   Default false. Note if top level functions are included, this operation can be expensive.
  * @return a Sequence of KSFunctionDeclaration.
  */
 fun Resolver.getFunctionDeclarationsByName(
     name: String,
-    includeTopLevel: Boolean = false
-): Sequence<KSFunctionDeclaration> = getFunctionDeclarationsByName(getKSNameFromString(name), includeTopLevel)
+    includeTopLevel: Boolean = false,
+): Sequence<KSFunctionDeclaration> =
+    getFunctionDeclarationsByName(getKSNameFromString(name), includeTopLevel)
 
 /**
  * Find a property in the compilation classpath for the given name.
  *
  * @param name fully qualified name of the property to be loaded; using '.' as separator.
- * @param includeTopLevel a boolean value indicate if top level properties should be searched. Default false. Note if top level properties are included, this operation can be expensive.
+ * @param includeTopLevel a boolean value indicate if top level properties should be searched.
+ *   Default false. Note if top level properties are included, this operation can be expensive.
  * @return a KSPropertyDeclaration, or null if not found.
  */
-fun Resolver.getPropertyDeclarationByName(name: String, includeTopLevel: Boolean = false): KSPropertyDeclaration? =
-    getPropertyDeclarationByName(getKSNameFromString(name), includeTopLevel)
+fun Resolver.getPropertyDeclarationByName(
+    name: String,
+    includeTopLevel: Boolean = false,
+): KSPropertyDeclaration? = getPropertyDeclarationByName(getKSNameFromString(name), includeTopLevel)
 
 /**
  * Find the containing file of a KSNode.
- * @return KSFile if the given KSNode has a containing file.
- * example of symbols without a containing file: symbols from class files, synthetic symbols created by user.
+ *
+ * @return KSFile if the given KSNode has a containing file. example of symbols without a containing
+ *   file: symbols from class files, synthetic symbols created by user.
  */
 val KSNode.containingFile: KSFile?
     get() {
@@ -115,8 +120,8 @@
 /**
  * Get properties directly declared inside the class declaration.
  *
- * What are included: member properties, extension properties declared inside it, etc.
- * What are NOT included: inherited properties, extension properties declared outside it.
+ * What are included: member properties, extension properties declared inside it, etc. What are NOT
+ * included: inherited properties, extension properties declared outside it.
  */
 fun KSClassDeclaration.getDeclaredProperties(): Sequence<KSPropertyDeclaration> {
     return this.declarations.filterIsInstance<KSPropertyDeclaration>()
@@ -128,24 +133,23 @@
     }
 }
 
-/**
- * Check whether this is a local declaration, or namely, declared in a function.
- */
+/** Check whether this is a local declaration, or namely, declared in a function. */
 fun KSDeclaration.isLocal(): Boolean {
     return this.parentDeclaration != null && this.parentDeclaration !is KSClassDeclaration
 }
 
 /**
- * Perform a validation on a given symbol to check if all interested types in symbols enclosed scope are valid, i.e. resolvable.
- * @param predicate A lambda for filtering interested symbols for performance purpose. Default checks all.
+ * Perform a validation on a given symbol to check if all interested types in symbols enclosed scope
+ * are valid, i.e. resolvable.
+ *
+ * @param predicate A lambda for filtering interested symbols for performance purpose. Default
+ *   checks all.
  */
 fun KSNode.validate(predicate: (KSNode?, KSNode) -> Boolean = { _, _ -> true }): Boolean {
     return this.accept(KSValidateVisitor(predicate), null)
 }
 
-/**
- * Find the KSClassDeclaration that the alias points to, recursively.
- */
+/** Find the KSClassDeclaration that the alias points to, recursively. */
 fun KSTypeAlias.findActualType(): KSClassDeclaration {
     val resolvedType = this.type.resolve().declaration
     return if (resolvedType is KSTypeAlias) {
@@ -155,9 +159,7 @@
     }
 }
 
-/**
- * Determine [Visibility] of a [KSDeclaration].
- */
+/** Determine [Visibility] of a [KSDeclaration]. */
 fun KSDeclaration.getVisibility(): Visibility {
     return when {
         this.modifiers.contains(Modifier.PUBLIC) -> Visibility.PUBLIC
@@ -171,23 +173,25 @@
 
         this.isLocal() -> Visibility.LOCAL
         this.modifiers.contains(Modifier.PRIVATE) -> Visibility.PRIVATE
-        this.modifiers.contains(Modifier.PROTECTED) ||
-            this.modifiers.contains(Modifier.OVERRIDE) -> Visibility.PROTECTED
+        this.modifiers.contains(Modifier.PROTECTED) || this.modifiers.contains(Modifier.OVERRIDE) ->
+            Visibility.PROTECTED
 
         this.modifiers.contains(Modifier.INTERNAL) -> Visibility.INTERNAL
-        // for synthetic origin from Java source, synthetic members follow visibility from parent to avoid
+        // for synthetic origin from Java source, synthetic members follow visibility from parent to
+        // avoid
         // package private synthetic members being mishandled as public.
         this.origin == Origin.SYNTHETIC && this.parentDeclaration?.origin == Origin.JAVA ->
             this.parentDeclaration!!.getVisibility()
 
-        else -> if (this.origin != Origin.JAVA && this.origin != Origin.JAVA_LIB)
-            Visibility.PUBLIC else Visibility.JAVA_PACKAGE
+        else ->
+            if (this.origin != Origin.JAVA && this.origin != Origin.JAVA_LIB) Visibility.PUBLIC
+            else Visibility.JAVA_PACKAGE
     }
 }
 
 /**
- * get all super types for a class declaration
- * Calling [getAllSuperTypes] requires type resolution therefore is expensive and should be avoided if possible.
+ * get all super types for a class declaration Calling [getAllSuperTypes] requires type resolution
+ * therefore is expensive and should be avoided if possible.
  */
 fun KSClassDeclaration.getAllSuperTypes(): Sequence<KSType> {
 
@@ -197,11 +201,12 @@
                 is KSClassDeclaration -> sequenceOf(resolvedDeclaration)
                 is KSTypeAlias -> sequenceOf(resolvedDeclaration.findActualType())
                 is KSTypeParameter -> resolvedDeclaration.getTypesUpperBound()
-                else -> throw InternalKSPException(
-                    "Unhandled type parameter bound",
-                    resolvedDeclaration.location,
-                    resolvedDeclaration.javaClass,
-                )
+                else ->
+                    throw InternalKSPException(
+                        "Unhandled type parameter bound",
+                        resolvedDeclaration.location,
+                        resolvedDeclaration.javaClass,
+                    )
             }
         }
 
@@ -214,12 +219,14 @@
                     when (it) {
                         is KSClassDeclaration -> it.getAllSuperTypes()
                         is KSTypeAlias -> it.findActualType().getAllSuperTypes()
-                        is KSTypeParameter -> it.getTypesUpperBound().flatMap { it.getAllSuperTypes() }
-                        else -> throw InternalKSPException(
-                            "Unhandled super type kind",
-                            it.location,
-                            it.javaClass,
-                        )
+                        is KSTypeParameter ->
+                            it.getTypesUpperBound().flatMap { it.getAllSuperTypes() }
+                        else ->
+                            throw InternalKSPException(
+                                "Unhandled super type kind",
+                                it.location,
+                                it.javaClass,
+                            )
                     }
                 }
         )
@@ -240,19 +247,18 @@
         (setter?.modifiers?.contains(Modifier.ABSTRACT) ?: true)
 }
 
-fun KSDeclaration.isOpen() = !this.isLocal() && !this.modifiers.contains(Modifier.FINAL) &&
-    (
-        (this as? KSClassDeclaration)?.classKind == ClassKind.INTERFACE ||
+fun KSDeclaration.isOpen() =
+    !this.isLocal() &&
+        !this.modifiers.contains(Modifier.FINAL) &&
+        ((this as? KSClassDeclaration)?.classKind == ClassKind.INTERFACE ||
             this.modifiers.contains(Modifier.OVERRIDE) ||
             this.modifiers.contains(Modifier.ABSTRACT) ||
             this.modifiers.contains(Modifier.OPEN) ||
             this.modifiers.contains(Modifier.SEALED) ||
-            (
-                this !is KSClassDeclaration &&
-                    (this.parentDeclaration as? KSClassDeclaration)?.classKind == ClassKind.INTERFACE
-                ) ||
-            (!this.modifiers.contains(Modifier.FINAL) && this.origin == Origin.JAVA)
-        )
+            (this !is KSClassDeclaration &&
+                (this.parentDeclaration as? KSClassDeclaration)?.classKind ==
+                    ClassKind.INTERFACE) ||
+            (!this.modifiers.contains(Modifier.FINAL) && this.origin == Origin.JAVA))
 
 fun KSDeclaration.isPublic() = this.getVisibility() == Visibility.PUBLIC
 
@@ -292,11 +298,10 @@
     fun KSDeclaration.isVisibleInPrivate(other: KSDeclaration) =
         (other.isLocal() && other.parentDeclarationsForLocal().contains(this.parentDeclaration)) ||
             this.parentDeclaration == other.parentDeclaration ||
-            this.parentDeclaration == other || (
-            this.parentDeclaration == null &&
+            this.parentDeclaration == other ||
+            (this.parentDeclaration == null &&
                 other.parentDeclaration == null &&
-                this.containingFile == other.containingFile
-            )
+                this.containingFile == other.containingFile)
 
     return when {
         // locals are limited to lexical scope
@@ -308,26 +313,27 @@
         this.isInternal() && other.containingFile != null && this.containingFile != null -> true
         this.isJavaPackagePrivate() -> this.isSamePackage(other)
         this.isProtected() -> {
-            this.isVisibleInPrivate(other) || this.isSamePackage(other) || other.closestClassDeclaration()?.let {
-                this.closestClassDeclaration()!!.asStarProjectedType().isAssignableFrom(it.asStarProjectedType())
-            } ?: false
+            this.isVisibleInPrivate(other) ||
+                this.isSamePackage(other) ||
+                other.closestClassDeclaration()?.let {
+                    this.closestClassDeclaration()!!
+                        .asStarProjectedType()
+                        .isAssignableFrom(it.asStarProjectedType())
+                } ?: false
         }
 
         else -> false
     }
 }
 
-/**
- * Returns `true` if this is a constructor function.
- */
+/** Returns `true` if this is a constructor function. */
 fun KSFunctionDeclaration.isConstructor() = this.simpleName.asString() == "<init>"
 
 const val ExceptionMessage = "please file a bug at https://github.com/google/ksp/issues/new"
 
 val KSType.outerType: KSType?
     get() {
-        if (Modifier.INNER !in declaration.modifiers)
-            return null
+        if (Modifier.INNER !in declaration.modifiers) return null
         val outerDecl = declaration.parentDeclaration as? KSClassDeclaration ?: return null
         return outerDecl.asType(arguments.subList(declaration.typeParameters.size, arguments.size))
     }
@@ -357,10 +363,13 @@
 
 @KspExperimental
 fun <T : Annotation> KSAnnotated.getAnnotationsByType(annotationKClass: KClass<T>): Sequence<T> {
-    return this.annotations.filter {
-        it.shortName.getShortName() == annotationKClass.simpleName && it.annotationType.resolve().declaration
-            .qualifiedName?.asString() == annotationKClass.qualifiedName
-    }.map { it.toAnnotation(annotationKClass.java) }
+    return this.annotations
+        .filter {
+            it.shortName.getShortName() == annotationKClass.simpleName &&
+                it.annotationType.resolve().declaration.qualifiedName?.asString() ==
+                    annotationKClass.qualifiedName
+        }
+        .map { it.toAnnotation(annotationKClass.java) }
 }
 
 @KspExperimental
@@ -373,7 +382,7 @@
     return Proxy.newProxyInstance(
         annotationClass.classLoader,
         arrayOf(annotationClass),
-        createInvocationHandler(annotationClass)
+        createInvocationHandler(annotationClass),
     ) as T
 }
 
@@ -384,12 +393,17 @@
     return InvocationHandler { proxy, method, _ ->
         if (method.name == "toString" && arguments.none { it.name?.asString() == "toString" }) {
             clazz.canonicalName +
-                arguments.map { argument: KSValueArgument ->
-                    // handles default values for enums otherwise returns null
-                    val methodName = argument.name?.asString()
-                    val value = proxy.javaClass.methods.find { m -> m.name == methodName }?.invoke(proxy)
-                    "$methodName=$value"
-                }.toList()
+                arguments
+                    .map { argument: KSValueArgument ->
+                        // handles default values for enums otherwise returns null
+                        val methodName = argument.name?.asString()
+                        val value =
+                            proxy.javaClass.methods
+                                .find { m -> m.name == methodName }
+                                ?.invoke(proxy)
+                        "$methodName=$value"
+                    }
+                    .toList()
         } else {
             val argument = arguments.first { it.name?.asString() == method.name }
             when (val result = argument.value ?: method.defaultValue) {
@@ -408,7 +422,9 @@
                                 val value = { result.asArray(method, clazz) }
                                 cache.getOrPut(Pair(method.returnType, value), value)
                             } else {
-                                throw IllegalStateException("unhandled value type, $ExceptionMessage")
+                                throw IllegalStateException(
+                                    "unhandled value type, $ExceptionMessage"
+                                )
                             }
                         }
 
@@ -426,13 +442,15 @@
                             cache.getOrPut(Pair(method.returnType, result)) {
                                 when (result) {
                                     is KSType -> result.asClass(clazz)
-                                    // Handles com.intellij.psi.impl.source.PsiImmediateClassType using reflection
+                                    // Handles com.intellij.psi.impl.source.PsiImmediateClassType
+                                    // using reflection
                                     // since api doesn't contain a reference to this
-                                    else -> Class.forName(
-                                        result.javaClass.methods
-                                            .first { it.name == "getCanonicalText" }
-                                            .invoke(result, false) as String
-                                    )
+                                    else ->
+                                        Class.forName(
+                                            result.javaClass.methods
+                                                .first { it.name == "getCanonicalText" }
+                                                .invoke(result, false) as String
+                                        )
                                 }
                             }
                         }
@@ -472,12 +490,11 @@
 
 @KspExperimental
 @Suppress("UNCHECKED_CAST")
-private fun KSAnnotation.asAnnotation(
-    annotationInterface: Class<*>,
-): Any {
+private fun KSAnnotation.asAnnotation(annotationInterface: Class<*>): Any {
     return Proxy.newProxyInstance(
-        annotationInterface.classLoader, arrayOf(annotationInterface),
-        this.createInvocationHandler(annotationInterface)
+        annotationInterface.classLoader,
+        arrayOf(annotationInterface),
+        this.createInvocationHandler(annotationInterface),
     ) as Proxy
 }
 
@@ -498,7 +515,9 @@
         else -> { // arrays of enums or annotations
             when {
                 method.returnType.componentType.isEnum -> {
-                    this.toArray(method) { result -> result.asEnum(method.returnType.componentType) }
+                    this.toArray(method) { result ->
+                        result.asEnum(method.returnType.componentType)
+                    }
                 }
 
                 method.returnType.componentType.isAnnotation -> {
@@ -507,17 +526,21 @@
                     }
                 }
 
-                else -> throw IllegalStateException("Unable to process type ${method.returnType.componentType.name}")
+                else ->
+                    throw IllegalStateException(
+                        "Unable to process type ${method.returnType.componentType.name}"
+                    )
             }
         }
     }
 
 @Suppress("UNCHECKED_CAST")
 private fun List<*>.toArray(method: Method, valueProvider: (Any) -> Any): Array<Any?> {
-    val array: Array<Any?> = java.lang.reflect.Array.newInstance(
-        method.returnType.componentType,
-        this.size
-    ) as Array<Any?>
+    val array: Array<Any?> =
+        java.lang.reflect.Array.newInstance(
+            method.returnType.componentType,
+            this.size,
+        ) as Array<Any?>
     for (r in 0 until this.size) {
         array[r] = this[r]?.let { valueProvider.invoke(it) }
     }
@@ -526,7 +549,8 @@
 
 @Suppress("UNCHECKED_CAST")
 private fun <T> Any.asEnum(returnType: Class<T>): T =
-    returnType.getDeclaredMethod("valueOf", String::class.java)
+    returnType
+        .getDeclaredMethod("valueOf", String::class.java)
         .invoke(
             null,
             when (this) {
@@ -541,7 +565,7 @@
                 else -> {
                     this.toString()
                 }
-            }
+            },
         ) as T
 
 private fun Any.asByte(): Byte = if (this is Int) this.toByte() else this as Byte
@@ -560,34 +584,37 @@
 
 // for Class[]/Array<KClass<*>> member.
 @KspExperimental
-class KSTypesNotPresentException(val ksTypes: List<KSType>, cause: Throwable) : RuntimeException(cause)
+class KSTypesNotPresentException(val ksTypes: List<KSType>, cause: Throwable) :
+    RuntimeException(cause)
 
 @KspExperimental
-private fun KSType.asClass(proxyClass: Class<*>) = try {
-    Class.forName(this.declaration.toJavaClassName(), true, proxyClass.classLoader)
-} catch (e: Exception) {
-    throw KSTypeNotPresentException(this, e)
-}
+private fun KSType.asClass(proxyClass: Class<*>) =
+    try {
+        Class.forName(this.declaration.toJavaClassName(), true, proxyClass.classLoader)
+    } catch (e: Exception) {
+        throw KSTypeNotPresentException(this, e)
+    }
 
 @KspExperimental
-private fun List<KSType>.asClasses(proxyClass: Class<*>) = try {
-    this.map { type -> type.asClass(proxyClass) }
-} catch (e: Exception) {
-    throw KSTypesNotPresentException(this, e)
-}
+private fun List<KSType>.asClasses(proxyClass: Class<*>) =
+    try {
+        this.map { type -> type.asClass(proxyClass) }
+    } catch (e: Exception) {
+        throw KSTypesNotPresentException(this, e)
+    }
 
 fun KSValueArgument.isDefault() = origin == Origin.SYNTHETIC
 
 @KspExperimental
-private fun Any.asArray(method: Method, proxyClass: Class<*>) = listOf(this).asArray(method, proxyClass)
+private fun Any.asArray(method: Method, proxyClass: Class<*>) =
+    listOf(this).asArray(method, proxyClass)
 
 private fun KSDeclaration.toJavaClassName(): String {
     val nameDelimiter = '.'
     val packageNameString = packageName.asString()
     val qualifiedNameString = qualifiedName!!.asString()
-    val simpleNames = qualifiedNameString
-        .removePrefix("${packageNameString}$nameDelimiter")
-        .split(nameDelimiter)
+    val simpleNames =
+        qualifiedNameString.removePrefix("${packageNameString}$nameDelimiter").split(nameDelimiter)
 
     return if (simpleNames.size > 1) {
         buildString {