From 9021ffc94e57d4e296aa354b9ab05a628aa474ab Mon Sep 17 00:00:00 2001 From: Ting-Yuan Huang Date: Thu, 17 Aug 2023 10:26:20 -0700 Subject: [PATCH] Remove PsiJavaFile cases from KSFileImpl now that we have KSFileJavaImpl. (cherry picked from commit 7efd2809000ba622ac06caba911ccc4daecfeb60) --- .../google/devtools/ksp/processing/impl/KSPCompilationError.kt | 0 .../com/google/devtools/ksp/impl/symbol/kotlin/KSFileImpl.kt | 3 --- 2 files changed, 3 deletions(-) rename {compiler-plugin => common-util}/src/main/kotlin/com/google/devtools/ksp/processing/impl/KSPCompilationError.kt (100%) diff --git a/compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/KSPCompilationError.kt b/common-util/src/main/kotlin/com/google/devtools/ksp/processing/impl/KSPCompilationError.kt similarity index 100% rename from compiler-plugin/src/main/kotlin/com/google/devtools/ksp/processing/impl/KSPCompilationError.kt rename to common-util/src/main/kotlin/com/google/devtools/ksp/processing/impl/KSPCompilationError.kt diff --git a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSFileImpl.kt b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSFileImpl.kt index 50915fdfdd..c8bcd78baa 100644 --- a/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSFileImpl.kt +++ b/kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSFileImpl.kt @@ -28,7 +28,6 @@ import com.google.devtools.ksp.symbol.KSVisitor import com.google.devtools.ksp.symbol.Location import com.google.devtools.ksp.symbol.Origin import com.intellij.psi.PsiFile -import com.intellij.psi.PsiJavaFile import org.jetbrains.kotlin.analysis.api.symbols.KtFileSymbol import org.jetbrains.kotlin.analysis.api.symbols.KtFunctionSymbol import org.jetbrains.kotlin.analysis.api.symbols.KtNamedClassOrObjectSymbol @@ -47,7 +46,6 @@ class KSFileImpl private constructor(private val ktFileSymbol: KtFileSymbol) : K override val packageName: KSName by lazy { when (psi) { is KtFile -> KSNameImpl.getCached((psi as KtFile).packageFqName.asString()) - is PsiJavaFile -> KSNameImpl.getCached((psi as PsiJavaFile).packageName) else -> throw IllegalStateException("Unhandled psi file type ${psi.javaClass}") } } @@ -99,7 +97,6 @@ class KSFileImpl private constructor(private val ktFileSymbol: KtFileSymbol) : K return Restorable { when (psi) { is KtFile -> analyze { getCached(psi.getFileSymbol()) } - is PsiJavaFile -> null else -> throw IllegalStateException("Unhandled psi file type ${psi.javaClass}") } }