diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dc1e9e0e..f40c862b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,10 +19,10 @@ gjf = "1.13.0" incap = "1.0.0" jdk = "20" jvmTarget = "11" -kotlin = "1.9.20" +kotlin = "2.0.0-Beta1" kotlinCompileTesting = "0.4.0" kotlinpoet = "1.15.0" -ksp = "1.9.20-1.0.14" +ksp = "2.0.0-Beta1-1.0.14" ktfmt = "0.46" moshi = "1.15.0" okhttp = "4.12.0" diff --git a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/BaseSymbols.kt b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/BaseSymbols.kt index 9ebcef3d..6b6d05ca 100644 --- a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/BaseSymbols.kt +++ b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/BaseSymbols.kt @@ -1,3 +1,5 @@ +@file:OptIn(UnsafeDuringIrConstructionAPI::class) + package dev.zacsweers.moshix.ir.compiler import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext @@ -23,6 +25,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.classifierOrNull diff --git a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrGenerationExtension.kt b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrGenerationExtension.kt index a91fcaef..03b947cf 100644 --- a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrGenerationExtension.kt +++ b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrGenerationExtension.kt @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.name.ClassId internal class MoshiIrGenerationExtension( @@ -29,6 +30,7 @@ internal class MoshiIrGenerationExtension( private val debug: Boolean ) : IrGenerationExtension { + @OptIn(UnsafeDuringIrConstructionAPI::class) override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { val generatedAnnotation = generatedAnnotationName?.let { name -> diff --git a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrUtil.kt b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrUtil.kt index a4323e5e..ae97b896 100644 --- a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrUtil.kt +++ b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiIrUtil.kt @@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.declarations.IrProperty import org.jetbrains.kotlin.ir.expressions.IrConst import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.classOrNull import org.jetbrains.kotlin.ir.util.file import org.jetbrains.kotlin.ir.util.getAnnotation @@ -38,6 +39,7 @@ import org.jetbrains.kotlin.name.FqName internal val JSON_ANNOTATION = FqName("com.squareup.moshi.Json") internal val JSON_QUALIFIER_ANNOTATION = FqName("com.squareup.moshi.JsonQualifier") +@OptIn(UnsafeDuringIrConstructionAPI::class) internal fun IrAnnotationContainer?.jsonQualifiers(): Set { if (this == null) return emptySet() return annotations.filterTo(LinkedHashSet()) { @@ -81,6 +83,7 @@ private val TargetProperty.isVisible: Boolean * Returns a generator for this property, or null if either there is an error and this property * cannot be used with code gen, or if no codegen is necessary for this property. */ +@OptIn(UnsafeDuringIrConstructionAPI::class) internal fun TargetProperty.generator( originalType: IrClass, errors: MutableList<(logger: MessageCollector) -> Unit> diff --git a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiSymbols.kt b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiSymbols.kt index 6a999506..d88b96b4 100644 --- a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiSymbols.kt +++ b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/MoshiSymbols.kt @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(UnsafeDuringIrConstructionAPI::class) + package dev.zacsweers.moshix.ir.compiler import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext @@ -28,6 +30,7 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.ir.declarations.IrPackageFragment import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.defaultType import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.makeNullable diff --git a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/util/IrSourcePrinter.kt b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/util/IrSourcePrinter.kt index 77d1e80e..4b78d7eb 100644 --- a/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/util/IrSourcePrinter.kt +++ b/moshi-ir/moshi-compiler-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/compiler/util/IrSourcePrinter.kt @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(UnsafeDuringIrConstructionAPI::class) + package dev.zacsweers.moshix.ir.compiler.util import java.util.Locale @@ -87,6 +89,7 @@ import org.jetbrains.kotlin.ir.expressions.IrWhen import org.jetbrains.kotlin.ir.expressions.IrWhileLoop import org.jetbrains.kotlin.ir.expressions.impl.IrIfThenElseImpl import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.IrDynamicType import org.jetbrains.kotlin.ir.types.IrErrorType import org.jetbrains.kotlin.ir.types.IrSimpleType diff --git a/moshi-proguard-rule-gen/src/test/kotlin/dev/zacsweers/moshix/proguardgen/MoshiProguardGenSymbolProcessorTest.kt b/moshi-proguard-rule-gen/src/test/kotlin/dev/zacsweers/moshix/proguardgen/MoshiProguardGenSymbolProcessorTest.kt index 8f4106ef..f3d84fa6 100644 --- a/moshi-proguard-rule-gen/src/test/kotlin/dev/zacsweers/moshix/proguardgen/MoshiProguardGenSymbolProcessorTest.kt +++ b/moshi-proguard-rule-gen/src/test/kotlin/dev/zacsweers/moshix/proguardgen/MoshiProguardGenSymbolProcessorTest.kt @@ -177,6 +177,7 @@ class MoshiSealedSymbolProcessorProviderTest { sources = sourceFiles.toList() inheritClassPath = true symbolProcessorProviders = listOf(MoshiProguardGenSymbolProcessor.Provider()) + languageVersion = "1.9" block() } diff --git a/moshi-sealed/codegen/src/test/kotlin/dev/zacsweers/moshix/sealed/codegen/ksp/MoshiSealedSymbolProcessorTest.kt b/moshi-sealed/codegen/src/test/kotlin/dev/zacsweers/moshix/sealed/codegen/ksp/MoshiSealedSymbolProcessorTest.kt index 9f888ed3..3103b47a 100644 --- a/moshi-sealed/codegen/src/test/kotlin/dev/zacsweers/moshix/sealed/codegen/ksp/MoshiSealedSymbolProcessorTest.kt +++ b/moshi-sealed/codegen/src/test/kotlin/dev/zacsweers/moshix/sealed/codegen/ksp/MoshiSealedSymbolProcessorTest.kt @@ -512,6 +512,7 @@ class MoshiSealedSymbolProcessorProviderTest { sources = sourceFiles.toList() inheritClassPath = true symbolProcessorProviders = listOf(MoshiSealedSymbolProcessorProvider()) + languageVersion = "1.9" } private fun compile(