diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSDeclarationDescriptorImpl.kt b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSDeclarationDescriptorImpl.kt index a6ea9b9526..9d9c14f4ca 100644 --- a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSDeclarationDescriptorImpl.kt +++ b/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSDeclarationDescriptorImpl.kt @@ -20,10 +20,10 @@ package com.google.devtools.ksp.symbol.impl.binary import com.google.devtools.ksp.common.impl.KSNameImpl import com.google.devtools.ksp.common.memoized import com.google.devtools.ksp.symbol.* +import org.jetbrains.kotlin.backend.common.serialization.findPackage import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.descriptors.findPackage import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.descriptorUtil.parents @@ -50,7 +50,7 @@ abstract class KSDeclarationDescriptorImpl(private val descriptor: DeclarationDe is ClassDescriptor -> KSClassDeclarationDescriptorImpl.getCached(containingDescriptor) is FunctionDescriptor -> KSFunctionDeclarationDescriptorImpl.getCached(containingDescriptor) else -> null - } + } as KSDeclaration? } override val parent: KSNode? by lazy { diff --git a/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/KSPCmdLineOptionsIT.kt b/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/KSPCmdLineOptionsIT.kt index bb6dcc6804..e06136a849 100644 --- a/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/KSPCmdLineOptionsIT.kt +++ b/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/KSPCmdLineOptionsIT.kt @@ -38,7 +38,6 @@ class KSPCmdLineOptionsIT(val useKSP2: Boolean) { }.maxByOrNull { it.lastModified() }!! val compilerArgs = mutableListOf( "-no-stdlib", - "-language-version", "1.9", "-Xplugin=${kspPluginJar.absolutePath}", "-Xplugin=${kspApiJar.absolutePath}", "-P", "plugin:$kspPluginId:apclasspath=${processorJar.absolutePath}", diff --git a/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt b/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt index 5bb36cb844..138734469d 100644 --- a/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt +++ b/integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PlaygroundIT.kt @@ -223,6 +223,7 @@ class PlaygroundIT(val useKSP2: Boolean) { Assert.assertTrue(jarFile.getEntry("hello/HELLO.class").size > 0) Assert.assertTrue(jarFile.getEntry("com/example/AClassBuilder.class").size > 0) } + Assert.assertTrue(result.output.contains("w: Language version 2.0 is experimental")) project.restore(buildFile.path) } @@ -262,6 +263,7 @@ class PlaygroundIT(val useKSP2: Boolean) { Assert.assertTrue(jarFile.getEntry("hello/HELLO.class").size > 0) Assert.assertTrue(jarFile.getEntry("com/example/AClassBuilder.class").size > 0) } + Assert.assertTrue(result.output.contains("w: Language version 2.0 is experimental")) project.restore(buildFile.path) project.restore(gradleProperties.path) } @@ -301,12 +303,12 @@ class PlaygroundIT(val useKSP2: Boolean) { gradleRunner.withArguments("build").buildAndFail().let { Assert.assertEquals(TaskOutcome.SUCCESS, it.task(":workload:kspKotlin")?.outcome) Assert.assertEquals(TaskOutcome.FAILED, it.task(":workload:compileKotlin")?.outcome) - Assert.assertTrue("Unresolved reference 'AClassBuilder'" in it.output) + Assert.assertTrue("Unresolved reference: AClassBuilder" in it.output) } gradleRunner.withArguments("build").buildAndFail().let { Assert.assertEquals(TaskOutcome.UP_TO_DATE, it.task(":workload:kspKotlin")?.outcome) Assert.assertEquals(TaskOutcome.FAILED, it.task(":workload:compileKotlin")?.outcome) - Assert.assertTrue("Unresolved reference 'AClassBuilder'" in it.output) + Assert.assertTrue("Unresolved reference: AClassBuilder" in it.output) } project.restore("workload/build.gradle.kts")