From 2c25bb2ce2a151f5913f4cda9f261adaa2e5c56a Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Mena Date: Wed, 12 Feb 2025 14:54:30 +0100 Subject: [PATCH] Fix problem with optics-ksp-plugin --- .../src/test/kotlin/arrow/optics/plugin/Compilation.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arrow-libs/optics/arrow-optics-ksp-plugin/src/test/kotlin/arrow/optics/plugin/Compilation.kt b/arrow-libs/optics/arrow-optics-ksp-plugin/src/test/kotlin/arrow/optics/plugin/Compilation.kt index a5b6398e8b..043c099426 100644 --- a/arrow-libs/optics/arrow-optics-ksp-plugin/src/test/kotlin/arrow/optics/plugin/Compilation.kt +++ b/arrow-libs/optics/arrow-optics-ksp-plugin/src/test/kotlin/arrow/optics/plugin/Compilation.kt @@ -60,17 +60,18 @@ internal fun compile(text: String, allWarningsAsErrors: Boolean = false): Compil } fun buildCompilation(text: String, allWarningsAsErrors: Boolean = false) = KotlinCompilation().apply { + jvmTarget = "11" classpaths = listOf( "arrow-annotations:$arrowVersion", "arrow-core:$arrowVersion", "arrow-optics:$arrowVersion", ).map { classpathOf(it) } - symbolProcessorProviders = mutableListOf(OpticsProcessorProvider()) sources = listOf(SourceFile.kotlin(SOURCE_FILENAME, text.trimMargin())) verbose = false this.allWarningsAsErrors = allWarningsAsErrors languageVersion = "1.9" kspWithCompilation = true + symbolProcessorProviders = mutableListOf(OpticsProcessorProvider()) } private fun classpathOf(dependency: String): File { @@ -110,7 +111,7 @@ private fun eval(expression: String, classesDirectory: File): Any? { val fullClassName = getFullClassName(classesDirectory) val field = classLoader.loadClass(fullClassName).getDeclaredField(expression) field.isAccessible = true - return field.get(Object()) + return field.get(Any()) } private fun getFullClassName(classesDirectory: File): String = Files.walk(Paths.get(classesDirectory.toURI()))