K2: add JVM checker for NO_REFLECTION_IN_CLASS_PATH warning

It's based on the existing K1 checker `JvmReflectionAPICallChecker`.

 #KT-60587 Fixed
This commit is contained in:
Alexander Udalov
2023-07-29 00:56:16 +02:00
committed by Space Team
parent bd46bb02c1
commit 7fc3e60854
15 changed files with 158 additions and 67 deletions
@@ -5055,6 +5055,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token,
)
}
add(FirJvmErrors.NO_REFLECTION_IN_CLASS_PATH) { firDiagnostic ->
NoReflectionInClassPathImpl(
firDiagnostic as KtPsiDiagnostic,
token,
)
}
add(FirJsErrors.IMPLEMENTING_FUNCTION_INTERFACE) { firDiagnostic ->
ImplementingFunctionInterfaceImpl(
firDiagnostic as KtPsiDiagnostic,
@@ -3523,6 +3523,10 @@ sealed interface KtFirDiagnostic<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = JavaSamInterfaceConstructorReference::class
}
interface NoReflectionInClassPath : KtFirDiagnostic<PsiElement> {
override val diagnosticClass get() = NoReflectionInClassPath::class
}
interface ImplementingFunctionInterface : KtFirDiagnostic<KtClassOrObject> {
override val diagnosticClass get() = ImplementingFunctionInterface::class
}
@@ -4257,6 +4257,11 @@ internal class JavaSamInterfaceConstructorReferenceImpl(
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.JavaSamInterfaceConstructorReference
internal class NoReflectionInClassPathImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,
) : KtAbstractFirDiagnostic<PsiElement>(firDiagnostic, token), KtFirDiagnostic.NoReflectionInClassPath
internal class ImplementingFunctionInterfaceImpl(
firDiagnostic: KtPsiDiagnostic,
token: KtLifetimeToken,